From 07b336e0c6eca2c93bc6de507ff20dfbdb379aea Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sat, 28 Dec 2024 12:43:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=85=A4=E7=A3=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=80=BC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_coal/workshopAnalysis.vue | 53 +++++++++++-------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/src/views/enm_coal/workshopAnalysis.vue b/src/views/enm_coal/workshopAnalysis.vue index 0f459421..4cce12b9 100644 --- a/src/views/enm_coal/workshopAnalysis.vue +++ b/src/views/enm_coal/workshopAnalysis.vue @@ -126,47 +126,42 @@ export default { asynDialog: false, }; }, - mounted() { + async mounted() { let that = this; var myDate = new Date(); let year = myDate.getFullYear(); that.query.year_s = year; + try{ + var res = await this.$API.mtm.mgroup.list.req({ page: 0, search: "煤磨" }); + that.query.mgroup = res[0].id; + }catch(e){ + this.$message.error("获取工段失败"); + } //月目标 let paramsGoal = {}; paramsGoal.page = 0; paramsGoal.mgroup = that.query.mgroup; - that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { - if (ress.length > 0) { + paramsGoal.goal_cate__code = "elec_consume_unit"; + var ress = await that.$API.mtm.goal.list.req(paramsGoal); + 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; - } + 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; }); - } else { - this.getData(); } - }); - this.$API.mtm.mgroup.list - .req({ page: 0, search: "煤磨" }) - .then((res) => { - console.log("煤磨", res); - that.query.mgroup = res[0].id; - this.getData(); - }); + this.getData(); }, methods: { // 动态绑定Class