From 74e65ba199a6a3eaf2de06fcc728ee8e5762121e Mon Sep 17 00:00:00 2001 From: shijing Date: Mon, 29 Apr 2024 16:18:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=9F=B3=E7=81=B0=E7=9F=B3=E7=A0=B4?= =?UTF-8?q?=E7=A2=8Emgroup=E6=A0=B9=E6=8D=AE=E5=90=8D=E7=A7=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_limestone/handoverLog.vue | 2 +- src/views/enm_limestone/report.vue | 302 ++++++++----------- src/views/enm_limestone/workshopAnalysis.vue | 79 +++-- 3 files changed, 168 insertions(+), 215 deletions(-) diff --git a/src/views/enm_limestone/handoverLog.vue b/src/views/enm_limestone/handoverLog.vue index 6777a3ee..77889f4e 100644 --- a/src/views/enm_limestone/handoverLog.vue +++ b/src/views/enm_limestone/handoverLog.vue @@ -246,8 +246,8 @@ export default { this.apiObj = this.$API.wpm.sflog.list; this.deptId = res[0].belong_dept; this.getTeam(); + this.getShfit(); }); - this.getShfit(); }, methods: { getTeam() { diff --git a/src/views/enm_limestone/report.vue b/src/views/enm_limestone/report.vue index f788510a..dad0956d 100644 --- a/src/views/enm_limestone/report.vue +++ b/src/views/enm_limestone/report.vue @@ -306,8 +306,10 @@ export default { }, data() { return { + exportLoading: false, chartShow: false, myOption: null, + timeStamp: null, optionHour: {}, optionDay: {}, optionMonth: {}, @@ -450,50 +452,6 @@ export default { }, ], }, - list: [ - { - x: 1, - y: 1, - z: 99, - k: 11, - }, - { - x: 2, - y: 2, - z: 70, - k: 11, - }, - { - x: 3, - y: 3, - z: 1, - k: 11, - }, - { - x: 4, - y: 4, - z: 30, - k: 11, - }, - { - x: 5, - y: 1, - z: 20, - k: 11, - }, - { - x: 6, - y: 0, - z: 18, - k: 11, - }, - { - x: 7, - y: 10, - z: 12, - k: 11, - }, - ], dataX: [], dataY: [], dataY2: [], @@ -519,34 +477,6 @@ export default { } } let that = this; - this.$nextTick(() => { - this.dataX = this.list.map((item) => item.x); - // 第1个Y轴 - this.dataY.push({ - name: "AA", - type: "line", // 直线 - yAxisIndex: 0, // 第几个Y轴 索引值 - symbolSize: "10", - // lineStyle: { color: '#4485f4' }, - data: this.list.map((item) => item.y), - }); - // 第2个Y轴 - this.dataY.push({ - name: "BB", - type: "line", - yAxisIndex: 1, // 第几个Y轴 索引值 - data: this.list.map((item) => item.z), - }); - // 第3个Y轴 - this.dataY.push({ - name: "CC", - type: "line", - yAxisIndex: 2, // 第几个Y轴 索引值 - data: this.list.map((item) => item.k), - }); - - // this.init(this.dataX, this.dataY); - }); this.$nextTick(() => { var myDate = new Date(); let year = (that.year = myDate.getFullYear()); @@ -574,127 +504,131 @@ export default { let month_h = hourDate.getMonth() + 1; let days_h = hourDate.getDate(); let hours_h = hourDate.getHours(); - - //昨日 - let params3 = {}; - params3.page = 0; - params3.year_s = year_d; - params3.month_s = month_d; - params3.day_s = days_d; - params3.type = "day_s"; - params3.mgroup = this.query.mgroup; - this.$API.enm.enstat.req(params3).then((res3) => { - if (res3.length > 0) { - let data3 = res3[0]; - that.tableDatas[0][3] = data3.total_production; - that.tableDatas[1][3] = data3.elec_consume_unit; - } - }); - //上小时 - let params4 = {}; - params4.page = 0; - params4.year = year_h; - params4.month = month_h; - params4.day = days_h; - params4.hour = hours_h; - params4.type = "hour_st"; - params4.mgroup = this.query.mgroup; - this.$API.enm.enstat.req(params4).then((res4) => { - if (res4.length > 0) { - let data4 = res4[0]; - that.tableDatas[0][2] = data4.total_production; - that.tableDatas[1][2] = data4.elec_consume_unit; - } - }); - //月目标 - let params5 = {}; - params5.page = 0; - params5.mgroup = "3346520558031773696"; - this.$API.mtm.goal.list - .req(params5) - .then((res5) => { - if (res5.length > 0) { - let data5 = res5; - data5.forEach((item5) => { - let str = "goal_val_" + that.month; - debugger; - console.log(str, item5[str]); - - if (item5.goal_cate_name == "总产量(t)") { - that.tableDatas[0][6] = item5[str]; - that.tableDatas[0][8] = item5.goal_val; - } else if ( - item5.goal_cate_name == - "单位产品分布电耗(KW·h/t)" - ) { - that.tableDatas[1][6] = item5[str]; - that.tableDatas[1][8] = item5.goal_val; - } - }); - } - }) + this.$API.mtm.mgroup.list + .req({ page: 0, search: "电石渣" }) .then((res) => { - //年 - let params1 = {}; - params1.page = 0; - params1.year_s = year; - params1.type = "year_s"; - params1.mgroup = this.query.mgroup; - this.$API.enm.enstat.req(params1).then((res1) => { - if (res1.length > 0) { - let data1 = res1[0]; - that.tableDatas[0][5] = data1.total_production; - that.tableDatas[0][9] = precen( - that.tableDatas[0][5], - that.tableDatas[0][8] - ); - - that.tableDatas[1][5] = data1.elec_consume_unit; - that.tableDatas[1][9] = precen( - that.tableDatas[1][5], - that.tableDatas[1][8] - ); - } else { + console.log("电石渣", res); + that.query.mgroup = res[0].id; + //昨日 + let params3 = {}; + params3.page = 0; + params3.year_s = year_d; + params3.month_s = month_d; + params3.day_s = days_d; + params3.type = "day_s"; + params3.mgroup = that.query.mgroup; + that.$API.enm.enstat.req(params3).then((res3) => { + if (res3.length > 0) { + let data3 = res3[0]; + that.tableDatas[0][3] = data3.total_production; + that.tableDatas[1][3] = data3.elec_consume_unit; } }); - //月 - let params2 = {}; - params2.page = 0; - params2.year_s = year; - params2.month_s = month; - params2.type = "month_s"; - params2.mgroup = this.query.mgroup; - this.$API.enm.enstat.req(params2).then((res2) => { - if (res2.length > 0) { - let data2 = res2[0]; - that.tableDatas[0][4] = data2.total_production; - if (that.tableDatas[0][4] > that.tableDatas[0][6]) { - that.wraning = true; + //上小时 + let params4 = {}; + params4.page = 0; + params4.year = year_h; + params4.month = month_h; + params4.day = days_h; + params4.hour = hours_h; + params4.type = "hour_st"; + params4.mgroup = that.query.mgroup; + that.$API.enm.enstat.req(params4).then((res4) => { + if (res4.length > 0) { + let data4 = res4[0]; + that.tableDatas[0][2] = data4.total_production; + that.tableDatas[1][2] = data4.elec_consume_unit; + } + }); + //月目标 + let params5 = {}; + params5.page = 0; + params5.mgroup = that.query.mgroup; + that.$API.mtm.goal.list + .req(params5) + .then((res5) => { + if (res5.length > 0) { + let data5 = res5; + data5.forEach((item5) => { + let str = "goal_val_" + that.month; + if (item5.goal_cate_name == "总产量(t)") { + that.tableDatas[0][6] = item5[str]; + that.tableDatas[0][8] = item5.goal_val; + } else if ( + item5.goal_cate_name == + "单位产品分布电耗(KW·h/t)" + ) { + that.tableDatas[1][6] = item5[str]; + that.tableDatas[1][8] = item5.goal_val; + } + }); } - that.tableDatas[0][7] = precen( - that.tableDatas[0][4], - that.tableDatas[0][6] - ); + }) + .then((res) => { + //年 + let params1 = {}; + params1.page = 0; + params1.year_s = year; + params1.type = "year_s"; + params1.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params1).then((res1) => { + if (res1.length > 0) { + let data1 = res1[0]; + that.tableDatas[0][5] = + data1.total_production; + that.tableDatas[0][9] = precen( + that.tableDatas[0][5], + that.tableDatas[0][8] + ); - that.tableDatas[1][4] = data2.elec_consume_unit; - that.tableDatas[1][7] = precen( - that.tableDatas[1][4], - that.tableDatas[1][6] - ); - } - }); + that.tableDatas[1][5] = + data1.elec_consume_unit; + that.tableDatas[1][9] = precen( + that.tableDatas[1][5], + that.tableDatas[1][8] + ); + } else { + } + }); + //月 + let params2 = {}; + params2.page = 0; + params2.year_s = year; + params2.month_s = month; + params2.type = "month_s"; + params2.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params2).then((res2) => { + if (res2.length > 0) { + let data2 = res2[0]; + that.tableDatas[0][4] = + data2.total_production; + if ( + that.tableDatas[0][4] > + that.tableDatas[0][6] + ) { + that.wraning = true; + } + that.tableDatas[0][7] = precen( + that.tableDatas[0][4], + that.tableDatas[0][6] + ); + + that.tableDatas[1][4] = + data2.elec_consume_unit; + that.tableDatas[1][7] = precen( + that.tableDatas[1][4], + that.tableDatas[1][6] + ); + } + }); + }); + that.getHourData(); + that.getDayData(); + that.getMonthData(); }); - that.getHourData(); - that.getDayData(); - that.getMonthData(); }); }, methods: { - // init(dataX, dataY) { - // this.myChart = echarts.init(document.getElementById("main")); - // // 使用刚指定的配置项和数据显示图表。 - // this.myChart.setOption(this.option); - // }, //获取小时数据 getHourData() { let that = this; diff --git a/src/views/enm_limestone/workshopAnalysis.vue b/src/views/enm_limestone/workshopAnalysis.vue index 1b73486c..94751caa 100644 --- a/src/views/enm_limestone/workshopAnalysis.vue +++ b/src/views/enm_limestone/workshopAnalysis.vue @@ -95,8 +95,10 @@ export default { }, data() { return { + exportLoading: false, chartShow: false, myOption: null, + timeStamp: null, query: { mgroup: "3555859873776693248", }, @@ -116,36 +118,15 @@ export default { var myDate = new Date(); let year = myDate.getFullYear(); that.query.year_s = year; - //月目标 - let paramsGoal = {}; - paramsGoal.page = 0; - paramsGoal.mgroup = that.query.mgroup; - that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { - if (ress.length > 0) { - let monthGoal = []; - ress.forEach((goal) => { - if (goal.goal_cate_name == "单位产品分布电耗(KW·h/t)") { - monthGoal[0] = goal.goal_val; - monthGoal[1] = goal.goal_val_2; - monthGoal[2] = goal.goal_val_3; - monthGoal[3] = goal.goal_val_4; - monthGoal[4] = goal.goal_val_5; - monthGoal[5] = goal.goal_val_6; - monthGoal[6] = goal.goal_val_7; - monthGoal[7] = goal.goal_val_8; - monthGoal[8] = goal.goal_val_9; - monthGoal[9] = goal.goal_val_10; - monthGoal[10] = goal.goal_val_11; - monthGoal[11] = goal.goal_val_12; - monthGoal[12] = goal.goal_val_12; - that.monthGoal = monthGoal; - } - }); - this.getData(); - } else { - this.getData(); - } - }); + that.timeStamp = myDate.getTime(); + this.$API.mtm.mgroup.list + .req({ page: 0, search: "石灰石破碎" }) + .then((res) => { + console.log("石灰石破碎", res); + that.query.mgroup = res[0].id; + //月目标 + this.getMonthGoal(); + }); }, methods: { // 动态绑定Class @@ -164,6 +145,41 @@ export default { } return classInfo; }, + //月目标 + getMonthGoal() { + let that = this; + let paramsGoal = {}; + paramsGoal.page = 0; + paramsGoal.mgroup = that.query.mgroup; + that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { + if (ress.length > 0) { + let monthGoal = []; + ress.forEach((goal) => { + if ( + goal.goal_cate_name == "单位产品分布电耗(KW·h/t)" + ) { + monthGoal[0] = goal.goal_val; + monthGoal[1] = goal.goal_val_2; + monthGoal[2] = goal.goal_val_3; + monthGoal[3] = goal.goal_val_4; + monthGoal[4] = goal.goal_val_5; + monthGoal[5] = goal.goal_val_6; + monthGoal[6] = goal.goal_val_7; + monthGoal[7] = goal.goal_val_8; + monthGoal[8] = goal.goal_val_9; + monthGoal[9] = goal.goal_val_10; + monthGoal[10] = goal.goal_val_11; + monthGoal[11] = goal.goal_val_12; + monthGoal[12] = goal.goal_val_12; + that.monthGoal = monthGoal; + } + }); + this.getData(); + } else { + this.getData(); + } + }); + }, getData() { let that = this; let query0 = {}; @@ -293,6 +309,9 @@ export default { this.chartShow = true; }); }, + handleQuery() { + this.getMonthGoal(); + }, handlePrint() { this.$PRINT("#myReport"); },