|
|
|
|
@ -18,6 +18,8 @@ |
|
|
|
|
@size-change="sizeChange" |
|
|
|
|
@refresh-change="refreshChange" |
|
|
|
|
@on-load="onLoad" |
|
|
|
|
@cell-click="cellClick" |
|
|
|
|
:cell-class-name="tableCellClassName" |
|
|
|
|
> |
|
|
|
|
<template #menu-left> |
|
|
|
|
<el-button type="primary" @click="handleCost">成本计算</el-button> |
|
|
|
|
@ -72,8 +74,7 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {getList,deleteTable,verifyTable,calculateTable,exportData,getDetail} from "@/api/costManagement/costStatistics" |
|
|
|
|
import { tr } from 'element-plus/es/locales.mjs' |
|
|
|
|
import {getList,deleteTable,verifyTable,calculateTable,exportData,getDetail,exportMaterial,exportWorkCenterMaterial,exportAuxiliaryPersonMaterial} from "@/api/costManagement/costStatistics" |
|
|
|
|
export default { |
|
|
|
|
data(){ |
|
|
|
|
return{ |
|
|
|
|
@ -307,6 +308,92 @@ export default { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
methods:{ |
|
|
|
|
cellClick(row, column, cell, event){ |
|
|
|
|
console.log('row----------',row) |
|
|
|
|
console.log('column----------',column) |
|
|
|
|
|
|
|
|
|
if(column.property == 'materialCost'){ |
|
|
|
|
this.$confirm('是否导出数据?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
// this.loading = true; |
|
|
|
|
exportMaterial({ month: row.month,workCenterId:row.workCenterId }).then(res => { |
|
|
|
|
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); |
|
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
link.href = url; |
|
|
|
|
link.download = `${row.month}月${row.workCenterName}材料费用.xlsx`; |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
|
this.$message.success('导出成功'); |
|
|
|
|
this.loading = false; |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}else if(column.property == 'workCenterMaterialCost'){ |
|
|
|
|
this.$confirm('是否导出数据?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
exportWorkCenterMaterial({ month: row.month,workCenterId:row.workCenterId }).then(res => { |
|
|
|
|
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); |
|
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
link.href = url; |
|
|
|
|
link.download = `${row.month}月${row.workCenterName}作业中心材料费用.xlsx`; |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
|
this.$message.success('导出成功'); |
|
|
|
|
this.loading = false; |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}else if(column.property == 'assistantMaterialCost'){ |
|
|
|
|
this.$confirm('是否导出数据?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
exportAuxiliaryPersonMaterial({ month: row.month }).then(res => { |
|
|
|
|
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); |
|
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
link.href = url; |
|
|
|
|
link.download = `${row.month}月辅助人员材料费用.xlsx`; |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
|
this.$message.success('导出成功'); |
|
|
|
|
this.loading = false; |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
tableCellClassName({ row, column, rowIndex, columnIndex }){ |
|
|
|
|
const monthProps = [ |
|
|
|
|
'materialCost', |
|
|
|
|
'workCenterMaterialCost', |
|
|
|
|
"assistantMaterialCost" |
|
|
|
|
]; |
|
|
|
|
if(monthProps.includes(column.property)){ |
|
|
|
|
return "high_row" |
|
|
|
|
} |
|
|
|
|
return '' |
|
|
|
|
}, |
|
|
|
|
handleCurrentRowChange(row){ |
|
|
|
|
if (!row) { |
|
|
|
|
this.detailData = []; |
|
|
|
|
@ -538,4 +625,14 @@ export default { |
|
|
|
|
::v-deep .el-table__row.current-row td { |
|
|
|
|
background-color: yellow !important; |
|
|
|
|
} |
|
|
|
|
// 新增:可点击单元格的样式 |
|
|
|
|
::v-deep .high_row { |
|
|
|
|
cursor: pointer !important; |
|
|
|
|
|
|
|
|
|
// 可选:增加悬停时的下划线效果,增强交互感 |
|
|
|
|
&:hover { |
|
|
|
|
text-decoration: underline; |
|
|
|
|
color: #284c89 !important; /* Element UI 主题蓝,你可以改为 blue 或其他颜色 */ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |