From 9e9f9babca0cde682c25cab2f826c9a57542480c Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 25 Apr 2025 16:06:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=85=89=E5=AD=90=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=88=86=E6=9E=90->=E7=94=9F=E4=BA=A7=E7=BB=9F=E8=AE=A1->?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E6=95=B0=E7=BB=9F=E8=AE=A1=E5=8E=BB=E6=8E=89?= =?UTF-8?q?AVG=EF=BC=8C=E5=B9=B6=E7=BA=A0=E6=AD=A3=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/statistics/pass_num.vue | 106 +++++++++++++++++------------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/src/views/statistics/pass_num.vue b/src/views/statistics/pass_num.vue index 0b3f5517..a48fa69b 100644 --- a/src/views/statistics/pass_num.vue +++ b/src/views/statistics/pass_num.vue @@ -223,7 +223,7 @@ - + @@ -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;