修改报表

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

@ -25,16 +25,37 @@
:data="tableData" :data="tableData"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="date" prop="processName"
label="工序" label="工序"
width="150"> width="150">
</el-table-column> </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 <el-table-column
v-for="item in i" label="不良数"
:prop="item.value"
:label="item.label"
width="120"> 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-column> </el-table-column>
</el-table> </el-table>
@ -54,221 +75,59 @@ export default {
name: 'ProductOffLine', name: 'ProductOffLine',
data() { data() {
return { return {
tableData: [ tableData: [],
{ form: {
date: '2016-05-03', year: new Date().getFullYear().toString(),
name: '王小虎', productionLine: 'CX_02'
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: {},
option: [ option: [
{ {
value: '11', value: 'CX_01',
label: '一号线' label: '一号线'
}, },
{ {
value: '22', value: 'CX_02',
label: '二号线' label: '二号线'
}, },
], ],
tableHead:[ 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月',]
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',
},
]
},
]
} }
}, },
created() { created() {
this.form.year = new Date().getFullYear().toString()
}, },
methods: { methods: {
onSubmit() { onSubmit() {
adverseRecordYearOnYearList({ year: '2024', productionLine: 'CX_02'}).then(response => { if(!this.form.year){
// this.form.year = new Date().getFullYear().toString()
console.log(response) }
this.loading = false 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) { resetForm(formName) {
this.$refs[formName].resetFields(); 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> </script>

Loading…
Cancel
Save