fix:光芯质检统计添加底部总计

This commit is contained in:
shijing 2025-06-04 10:27:05 +08:00
parent ae9baae3da
commit 7141116c43
1 changed files with 142 additions and 0 deletions

View File

@ -74,6 +74,9 @@
id="exportDiv" id="exportDiv"
stripe stripe
style="height: 100%;" style="height: 100%;"
:summary-method="getSummaries"
show-summary
> >
<el-table-column label="批次号" class-name="colorheader1" prop="batch" min-width="240" fixed="left"> <el-table-column label="批次号" class-name="colorheader1" prop="batch" min-width="240" fixed="left">
<template #default="scope"><span>{{ scope.row.data.批次号 }}</span></template> <template #default="scope"><span>{{ scope.row.data.批次号 }}</span></template>
@ -395,6 +398,145 @@ export default {
} }
this.getList(); this.getList();
}, },
getSummaries({ columns, data }) {
console.log('data',data);
console.log('columns',columns);
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
let propert = '';
//
if(index == 3&&column.label=='检验数'){
propert = '尺寸检验_count_real';
}else if(column.label=='黑圈内径'){
propert = '尺寸检验_缺陷_黑圈内径';
}else if(column.label=='黑圈外径'){
propert = '尺寸检验_缺陷_黑圈外径';
}else if(column.label=='产品同心度'){
propert = '尺寸检验_缺陷_产品同心度';
}else if(column.label=='圆度'){
propert = '尺寸检验_缺陷_圆度';
}else if(column.label=='产品外径小'){
propert = '尺寸检验_缺陷_产品外径小';
}else if(column.label=='产品外径大(返修)'){
propert = '尺寸检验_缺陷_产品外径大(返修)';
}else if(index == 14&&column.label=='黑圈缺口'){
propert = '尺寸检验_缺陷_黑圈缺口';
}else if(column.label=='外径发货片(B)'){
propert = '尺寸检验_缺陷_外径发货片(B)';
}else if(column.label=='前道崩'){
propert = '尺寸检验_缺陷_前道崩';
}else if(index==17&&column.label=='合格数'){
propert = '尺寸检验_count_ok_full';
}else if(column.label=='准合格(B)'){
propert = '尺寸检验_缺陷_准合格(B)';
}else if(column.label=='圆度准合格'){
propert = '尺寸检验_缺陷_圆准(B)';
}else if(column.label=='总合格数'){
propert = '尺寸检验_count_ok';
}else if(index == 25&&column.label=='检验数'){
propert = '外观检验_count_real';
}else if(index==26&&column.label=='合格数'){
propert = '外观检验_count_ok_full';
}else if(index==28&&column.label=='划麻(返修)'){
propert = '外观检验_缺陷_划麻(返修)';
}else if(index==29&&column.label=='脏(返修)'){
propert = '外观检验_缺陷_脏(返修)';
}else if(index==30&&column.label=='气泡'){
propert = '外观检验_缺陷_气泡';
}else if(index==31&&column.label=='浅气泡(B)'){
propert = '外观检验_缺陷_浅气泡(B)';
}else if(index==32&&column.label=='黑圈变形'){
propert = '外观检验_缺陷_黑圈变形';
}else if(index==33&&column.label=='黑圈缺口'){
propert = '外观检验_缺陷_黑圈缺口';
}else if(index==34&&column.label=='重水纹'){
propert = '外观检验_缺陷_重水纹';
}else if(index==35&&column.label=='浅水纹(B)'){
propert = '外观检验_缺陷_浅水纹(B)';
}else if(index==36&&column.label=='大崩'){
propert = '外观检验_缺陷_大崩';
}else if(index==37&&column.label=='小崩边(B)'){
propert = '外观检验_缺陷_小崩边(B)';
}else if(index==38&&column.label=='棕点'){
propert = '外观检验_缺陷_棕点';
}else if(index==39&&column.label=='浅划麻(B)'){
propert = '外观检验_缺陷_浅划麻(B)';
}else if(index==40&&column.label=='双面划麻'){
propert = '外观检验_缺陷_双面划麻';
}else if(index==41&&column.label=='倒角'){
propert = '外观检验_缺陷_倒角';
}else if(index==42&&column.label=='棕圈'){
propert = '外观检验_缺陷_棕圈';
}else if(index==43&&column.label=='蓝圈'){
propert = '外观检验_缺陷_蓝圈';
}else if(index==44&&column.label=='尺寸小'){
propert = '外观检验_缺陷_尺寸小';
}else if(index==45&&column.label=='破损'){
propert = '外观检验_缺陷_破损';
}else if(index==46&&column.label=='发白'){
propert = '外观检验_缺陷_发白';
}else if(index==47&&column.label=='漏光'){
propert = '外观检验_缺陷_漏光';
}else if(index == 50&&column.label=='返修数'){
propert = '返修_count_real';
}else if(index==51&&column.label=='合格数'){
propert = '返修_count_ok_full';
}else if(index==52&&column.label=='黑圈变形'){
propert = '返修_缺陷_黑圈变形';
}else if(index==53&&column.label=='气泡'){
propert = '返修_缺陷_气泡';
}else if(index==54&&column.label=='浅气泡(B)'){
propert = '返修_缺陷_浅气泡(B)';
}else if(index==55&&column.label=='浅划麻(B)'){
propert = '返修_缺陷_浅划麻(B)';
}else if(index==56&&column.label=='双面划麻'){
propert = '返修_缺陷_双面划麻';
}else if(index==57&&column.label=='浅水纹(B)'){
propert = '返修_缺陷_浅水纹(B)';
}else if(index==58&&column.label=='重水纹'){
propert = '返修_缺陷_重水纹';
}else if(index==59&&column.label=='大崩'){
propert = '返修_缺陷_大崩';
}else if(index==60&&column.label=='小崩边(B)'){
propert = '返修_缺陷_小崩边(B)';
}else if(index==61&&column.label=='倒角'){
propert = '返修_缺陷_倒角';
}else if(index==62&&column.label=='棕点'){
propert = '返修_缺陷_棕点';
}else if(index==63&&column.label=='漏光'){
propert = '返修_缺陷_漏光';
}else if(index==64&&column.label=='黑圈缺口'){
propert = '返修_缺陷_黑圈缺口';
}else if(index==65&&column.label=='破损'){
propert = '返修_缺陷_破损';
}else if(index==66&&column.label=='尺寸小'){
propert = '返修_缺陷_尺寸小';
}else if(column.label=='外观总合格数'){
propert = '外观检验_完全总合格数';
}
if (propert!=='') {
const values = data.map((item) =>
Number(item.data[propert])
);
if (!values.every((value) => Number.isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
let sum = Number(Number(prev) + Number(curr));
if (!isNaN(value)) {
return sum;
} else {
return prev;
}
}, 0);
}
}
});
return sums;
},
handleExport() { handleExport() {
this.exportLoading = true; this.exportLoading = true;
this.$XLSX("#exportDiv", "过程检验统计"); this.$XLSX("#exportDiv", "过程检验统计");