fix:光子统计分析->生产统计->合格数统计去掉AVG,并纠正错误数据展示

This commit is contained in:
shijing 2025-04-25 16:06:29 +08:00
parent 1d3f3a124c
commit 9e9f9babca
1 changed files with 62 additions and 44 deletions

View File

@ -223,7 +223,7 @@
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px">
<!-- <el-card shadow="never" style="margin-bottom: 8px">
<el-row :gutter="10">
<el-col :lg="12">
<el-card shadow="never">
@ -260,7 +260,7 @@
</el-card>
</el-col>
</el-row>
</el-card>
</el-card> -->
</el-main>
</el-container>
</template>
@ -360,7 +360,7 @@ export default {
that.getData6();
that.getData7();
that.getData10();
that.getDataDAVG();
// that.getDataDAVG();
},
methods: {
setChart(name, option = null) {
@ -406,7 +406,6 @@ export default {
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
// console.log('6:',res);
let tableData6 = res.data2.ds0 ? res.data2.ds0 : [];
that.tableData6 = tableData6;
if (tableData6.length > 0) {
@ -424,13 +423,23 @@ export default {
tableData6.forEach((item) => {
let indexX = nameList.indexOf(item.物料名);
let indexY = item. - that.firstWeekNum;
seriesData[indexX][indexY] = item.合格数;
if(seriesData[indexX][indexY]){
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数;
}
});
} else {
tableData6.forEach((item) => {
let indexX = nameList.indexOf(item.物料名);
let indexY = item.month - 1;
seriesData[indexX][indexY] = item.合格数;
if(seriesData[indexX][indexY]){
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数;
}
});
}
for (let n = 0; n < seriesData.length; n++) {
@ -488,7 +497,12 @@ export default {
indexX = nameList.indexOf(item.物料名);
indexY = item. - 1;
}
seriesData[indexX][indexY] = item.合格数;
if(seriesData[indexX][indexY]){
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数;
}
});
for (let n = 0; n < seriesData.length; n++) {
let obj = {};
@ -543,7 +557,12 @@ export default {
indexX = nameList.indexOf(item.物料名);
indexY = item. - 1;
}
seriesData[indexX][indexY] = item.合格数;
if(seriesData[indexX][indexY]){
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数;
}
});
for (let n = 0; n < seriesData.length; n++) {
let obj = {};
@ -560,41 +579,40 @@ export default {
}
});
},
getDataDAVG() {
let that = this;
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "AVG";
let obj = {
query: { start_date: that.start_date, end_date: that.end_date },
};
let exec = that.queryType == "月" ? "AVGWeek" : "AVGMonth";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
// console.log('AVG:',res);
let tableDataAVG = res.data2.ds0 ? res.data2.ds0 : [];
let seriesData = [];
if (tableDataAVG.length > 0) {
tableDataAVG.forEach((item) => {
let index = 0;
if (that.queryType == "月") {
index = item.month - 1;
} else {
index = item. - that.firstWeekNum;
}
seriesData[index] = item.合格数;
});
let obj = {};
obj.name = "AVG";
obj.type = "bar";
obj.barWidth = "15px";
obj.data = seriesData;
option.series.push(obj);
that.setChart("bachart4", option);
} else {
that.setChart("bachart4", option);
}
});
},
// getDataDAVG() {
// let that = this;
// let option = deepCopy(that.basicOption);
// option.xAxis.data = that.xAxisData;
// option.title.text = "AVG";
// let obj = {
// query: { start_date: that.start_date, end_date: that.end_date },
// };
// let exec = that.queryType == "" ? "AVGWeek" : "AVGMonth";
// that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
// let tableDataAVG = res.data2.ds0 ? res.data2.ds0 : [];
// let seriesData = [];
// if (tableDataAVG.length > 0) {
// tableDataAVG.forEach((item) => {
// let index = 0;
// if (that.queryType == "") {
// index = item.month - 1;
// } else {
// index = item. - that.firstWeekNum;
// }
// seriesData[index] = item.;
// });
// let obj = {};
// obj.name = "AVG";
// obj.type = "bar";
// obj.barWidth = "15px";
// obj.data = seriesData;
// option.series.push(obj);
// that.setChart("bachart4", option);
// } else {
// that.setChart("bachart4", option);
// }
// });
// },
handleQuery() {
let that = this;
if (that.queryType == "月") {
@ -632,7 +650,7 @@ export default {
that.getData6();
that.getData7();
that.getData10();
that.getDataDAVG();
// that.getDataDAVG();
},
handleExport(val) {
this.exportLoading = true;