修改报表

master
夜笙歌 7 months ago
parent 2f4fd1eb5f
commit a376558d35

@ -25,16 +25,37 @@
:data="tableData"
style="width: 100%">
<el-table-column
prop="date"
prop="processName"
label="工序"
width="150">
</el-table-column>
<el-table-column :label="i.label" v-for="i in tableHead">
<el-table-column :label="i" v-for="(i,k) in tableHead">
<el-table-column
v-for="item in i"
:prop="item.value"
:label="item.label"
label="不良数"
width="120">
<template slot-scope="scope">
{{
((tableData.find(v => v.processName === scope.row.processName).children.find(r => r.INSPECTOR_MONTH === tableTimeHead[k]) || {}).QUALITY_SUM) || 0
}}
</template>
</el-table-column>
<el-table-column
label="总产量"
width="120">
<template slot-scope="scope">
{{
((tableData.find(v => v.processName === scope.row.processName).children.find(r => r.INSPECTOR_MONTH === tableTimeHead[k]) || {}).OFF_LINE_NUM) || 0
}}
</template>
</el-table-column>
<el-table-column
label="不良率"
width="120">
<template slot-scope="scope">
{{
((tableData.find(v => v.processName === scope.row.processName).children.find(r => r.INSPECTOR_MONTH === tableTimeHead[k]) || {}).REPAIR_RATE) || '0%'
}}
</template>
</el-table-column>
</el-table-column>
</el-table>
@ -54,226 +75,64 @@ export default {
name: 'ProductOffLine',
data() {
return {
tableData: [
{
date: '2016-05-03',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-02',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-04',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-01',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-08',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-06',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-07',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}],
form: {},
tableData: [],
form: {
year: new Date().getFullYear().toString(),
productionLine: 'CX_02'
},
option: [
{
value: '11',
value: 'CX_01',
label: '一号线'
},
{
value: '22',
value: 'CX_02',
label: '二号线'
},
],
tableHead:[
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
{
label:'今年1月',
children:[
{
label:'不良数',
value:'column1_1',
},
{
label:'总产量',
value:'column1_2',
},
{
label:'不良率',
value:'column1_3',
},
]
},
]
tableTimeHead: [],
tableHead: ['今年1月', '去年1月', '今年2月', '去年2月', '今年3月', '去年3月', '今年4月', '去年4月', '今年5月', '去年5月', '今年6月', '去年6月', '今年7月', '去年7月', '今年8月', '去年8月', '今年9月', '去年9月', '今年10月', '去年10月', '今年11月', '去年11月', '今年12月', '去年12月',]
}
},
created() {
this.form.year = new Date().getFullYear().toString()
},
methods: {
onSubmit(){
adverseRecordYearOnYearList({ year: '2024', productionLine: 'CX_02'}).then(response => {
//
console.log(response)
this.loading = false
onSubmit() {
if(!this.form.year){
this.form.year = new Date().getFullYear().toString()
}
adverseRecordYearOnYearList({year: this.form.year, productionLine: this.form.productionLine}).then(response => {
this.getTableHead()
let processArr = [...new Set(response.data.map(v => v.PROCESS_NAME))]
let data = processArr.map(v => {
return {
processName: v,
children: response.data.filter(val => val.PROCESS_NAME === v)
}
})
console.log(data)
this.tableData = data
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
getTableHead() {
let m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
let head = []
m.forEach(v => {
head.push(this.form.year + '-' + v)
head.push((parseFloat(this.form.year) - 1) + '-' + v)
})
console.log(head)
this.tableTimeHead = head
},
}
}
</script>
<style lang="less" scoped>
/deep/ .el-table .cell{
/deep/ .el-table .cell {
text-align: center !important;
}
</style>

Loading…
Cancel
Save