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