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;