From 141d7db1855ff921117890b25ae5bb4834902c84 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 10 Apr 2025 14:15:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/statistics/hunliao.vue | 32 +++---- src/views/statistics/ppass_num.vue | 120 ++++++++++++++---------- src/views/statistics/product_check2.vue | 6 +- 3 files changed, 87 insertions(+), 71 deletions(-) diff --git a/src/views/statistics/hunliao.vue b/src/views/statistics/hunliao.vue index 3582ba0c..b53cc4a9 100644 --- a/src/views/statistics/hunliao.vue +++ b/src/views/statistics/hunliao.vue @@ -21,13 +21,12 @@
-
导出 - + @@ -53,7 +52,6 @@
-
@@ -131,7 +129,7 @@ export default { barWidth: '15px', }] }, - tableData7: [], + dataList: [], tableData10: [], firstWeekNum: 1, endWeekNum: 4, @@ -158,8 +156,8 @@ export default { that.xAxisOrigin.push('第' + i + '周'); } that.xAxisData = that.xAxisOrigin; - that.getData7(); - that.getData10(); + that.getDataHL(); + that.getDataHLXH(); }, methods: { setChart(name, option = null) { @@ -191,7 +189,7 @@ export default { } // 计算两者之间相隔的周数并返回结果 }, - getData7() { + getDataHL() { let that = this; let obj = { query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 }, @@ -201,20 +199,18 @@ export default { option.title.text = '混料统计'; let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth'; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - let tableData7 = res.data2.ds0 ? res.data2.ds0 : []; - that.tableData7 = tableData7; - debugger; - if (tableData7.length > 0) { - debugger; + let dataList = res.data2.ds0 ? res.data2.ds0 : []; + that.dataList = dataList; + if (dataList.length > 0) { option.series = []; let seriesData = [], nameList = []; - tableData7.forEach(ite => { + dataList.forEach(ite => { if (nameList.indexOf(ite.物料名) > -1) { } else { nameList.push(ite.物料名); seriesData.push([]) } }) - tableData7.forEach(item => { + dataList.forEach(item => { let indexX = 0, indexY = 0; if (that.queryType == '月') { indexX = nameList.indexOf(item.物料名); @@ -223,7 +219,7 @@ export default { indexX = nameList.indexOf(item.物料名); indexY = item.月 - 1; } - seriesData[indexX][indexY] = item.合格数; + seriesData[indexX][indexY] += item.合格数; }); for (let n = 0; n < seriesData.length; n++) { let obj = {}; @@ -240,7 +236,7 @@ export default { } }); }, - getData10() { + getDataHLXH() { let that = this; let option = deepCopy(that.basicOption); option.xAxis.data = that.xAxisData; @@ -320,8 +316,8 @@ export default { } that.xAxisData = that.monthList; } - this.getData7(); - this.getData10(); + this.getDataHL(); + this.getDataHLXH(); }, handleExport(val) { this.exportLoading = true; diff --git a/src/views/statistics/ppass_num.vue b/src/views/statistics/ppass_num.vue index bb1a084f..e37ac3fb 100644 --- a/src/views/statistics/ppass_num.vue +++ b/src/views/statistics/ppass_num.vue @@ -75,12 +75,12 @@
@@ -126,42 +126,42 @@ export default { type: "value", }, series: [ - { - name: "光纤预制棒", - data: [0, 0, 0, 0, 0, 0, 0, 0], - type: "bar", - label: { - show: true, - position: "top", - formatter: "{c}", - color: "rgb(64,158,255)", - }, - barWidth: "15px", - }, - { - name: "光纤预制管", - data: [0, 0, 0, 0, 0, 0, 0, 0], - type: "bar", - label: { - show: true, - position: "top", - formatter: "{c}", - color: "rgb(64,158,255)", - }, - barWidth: "15px", - }, - { - name: "G05", - data: [0, 0, 0, 0, 0, 0, 0, 0], - type: "bar", - label: { - show: true, - position: "top", - formatter: "{c}", - color: "rgb(64,158,255)", - }, - barWidth: "15px", - }, + // { + // name: "光纤预制棒", + // data: [0, 0, 0, 0, 0, 0, 0, 0], + // type: "bar", + // label: { + // show: true, + // position: "top", + // formatter: "{c}", + // color: "rgb(64,158,255)", + // }, + // barWidth: "15px", + // }, + // { + // name: "光纤预制管", + // data: [0, 0, 0, 0, 0, 0, 0, 0], + // type: "bar", + // label: { + // show: true, + // position: "top", + // formatter: "{c}", + // color: "rgb(64,158,255)", + // }, + // barWidth: "15px", + // }, + // { + // name: "G05", + // data: [0, 0, 0, 0, 0, 0, 0, 0], + // type: "bar", + // label: { + // show: true, + // position: "top", + // formatter: "{c}", + // color: "rgb(64,158,255)", + // }, + // barWidth: "15px", + // }, ], }, processData: [], @@ -213,7 +213,7 @@ export default { ",EXTRACT ( MONTH FROM mlog.handle_date )"; obj.query.order_bys_date = ", 月"; } - let xAxisData = [],data2 = [],data1 = [],data0 = []; + let xAxisData = [],nameData=[],seriesData=[],data2 = [],data1 = [],data0 = []; that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => { let data = res.data2.ds0; that.tableData = data; @@ -222,21 +222,43 @@ export default { } else { xAxisData.push(item.工段); } - console.log("xAxisData:", xAxisData); - let index = xAxisData.indexOf(item.工段); - if (item.物料名.indexOf("G05") > -1) { - data2[index] = item.合格数; - }else if (item.物料名.indexOf("棒") > -1) { - data0[index] = item.合格数; + if (nameData.indexOf(item.物料名) > -1) { } else { - data1[index] = item.合格数; + nameData.push(item.物料名); + let obj = { + name:'', + type: "bar", + label:{ + show: true, + position: "top", + formatter: "{c}", + color: "rgb(64,158,255)", + }, + barWidth: "15px", + data:[0, 0, 0, 0, 0, 0, 0, 0], + }; + obj.name=item.物料名, + seriesData.push(obj); } + console.log("xAxisData:", xAxisData); + console.log("nameData:", nameData); + let index = xAxisData.indexOf(item.工段); + let indexY = nameData.indexOf(item.物料名); + seriesData[indexY].data[index] += item.合格数; + // if (item.物料名.indexOf("G05") > -1) { + // data2[index] = item.合格数; + // }else if (item.物料名.indexOf("棒") > -1) { + // data0[index] = item.合格数; + // } else { + // data1[index] = item.合格数; + // } }); that.xAxisData = xAxisData; that.option.xAxis.data = that.xAxisData; - that.option.series[0].data = data0; - that.option.series[1].data = data1; - that.option.series[2].data = data2; + that.option.series = seriesData; + // that.option.series[0].data = data0; + // that.option.series[1].data = data1; + // that.option.series[2].data = data2; }); }, handleQuery() { diff --git a/src/views/statistics/product_check2.vue b/src/views/statistics/product_check2.vue index 3d57f81b..3cf6a5a7 100644 --- a/src/views/statistics/product_check2.vue +++ b/src/views/statistics/product_check2.vue @@ -141,10 +141,8 @@ this.currentYear = year; this.currentMonth = month; this.queryDate = year + '-' + month; - // this.start_date =year+'-'+month+'-01'; - // this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate(); - this.start_date ='2023-01-01'; - this.end_date = '2023-12-31'; + this.start_date =year+'-'+month+'-01'; + this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate(); this.getProcess(); }, methods:{