From a0b1659f10222ca80b326ab4176c3820543446dd Mon Sep 17 00:00:00 2001 From: zty Date: Wed, 25 Dec 2024 16:55:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=B8=BB=E8=A6=81?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bigScreen/index_enm.vue | 71 +++++------ src/views/enm_coal/report.vue | 46 +++++--- src/views/enm_energy/hour_base.vue | 23 ++-- src/views/enm_energy/water.vue | 40 +++++-- src/views/enm_kiln/report.vue | 45 ++++--- src/views/enm_mill/report.vue | 76 ++++++------ src/views/enm_pack/report.vue | 181 +++++++++-------------------- src/views/enm_rm/report.vue | 48 ++++---- src/views/enm_slag/report.vue | 8 +- 9 files changed, 257 insertions(+), 281 deletions(-) diff --git a/src/views/bigScreen/index_enm.vue b/src/views/bigScreen/index_enm.vue index 4c423b7f..7395aa4e 100644 --- a/src/views/bigScreen/index_enm.vue +++ b/src/views/bigScreen/index_enm.vue @@ -700,29 +700,42 @@ export default { that.option.xAxis.data = datelist; that.xAxisDate = datelist; that.$nextTick(() => { - //获取熟料产量 - that.productNum(); - that.waterAirData(); - that.getMonthData(); - //获取设备运转率 - that.eqRate(); - //余热发电 - that.generation(); - //工序电耗 - that.proceElec(); - //质量分析 - that.qualAnalys(); - //数据采集 - that.dataCollect(); - that.initDomStyle(); that.initFactory(); + this.productNum(); + this.waterAirData(); + this.getMonthData(); + this.eqRate(); + this.generation(); + this.proceElec(); + this.qualAnalys(); + this.dataCollect(); that.timerTime = setInterval(() => { that.showTime(); }, 1000); + that.timerOther = setInterval(() => { + that.initializeData(); + }, 180000); // 3分钟更新一次 }); }, + beforeUnmount() { + // 清除所有定时器,避免内存泄漏 + if (this.timerTime) { + clearInterval(this.timerTime);} + if (this.timerOther) { + clearInterval(this.timerOther);} + }, methods: { + initializeData() { + this.productNum(); + this.waterAirData(); + this.getMonthData(); + this.eqRate(); + this.generation(); + this.proceElec(); + this.qualAnalys(); + this.dataCollect(); + }, productNum() { let that = this; // 初始化option1和图表 @@ -945,6 +958,7 @@ export default { return this.$API.mtm.mgroup.list.req({ page: 0, search: "水泥包装" }); }).then((res) => { that.out_cement = res[0]?.id; //水泥包装id + let query = { page: 0, year_s: that.currentYear, @@ -952,11 +966,11 @@ export default { type: "month_s", mgroup: that.out_cement, }; - return that.$API.enm.enstat.req(query); + return that.$API.enm.mpointstat.list.req(query); }).then((response) => { response.forEach((item) => { - if (item.month_s == that.currentMonth) { - that.totalData.out_cement = item.total_production; //出厂水泥 + if (item.mpoint_name == '出厂水泥') { + that.totalData.out_cement = item.val || 0; //出厂水泥 } }) }) @@ -1281,7 +1295,6 @@ export default { let query2 = generateQueryMpoint("3631880992400515072"); return this.$API.enm.mpointstat.list.req(query2); }).then((response) => { - console.log(response,'query2'); let maxId; response.forEach((item) => { let ind = item.month - 1; @@ -2027,26 +2040,6 @@ export default { return JSON.parse(JSON.stringify(obj)); }, }, - beforeUnmount() { - let that = this; - this.scene = null; - // clearInterval(that.timerTime); - // clearInterval(that.timerData); - // clearInterval(that.qualityTimer); - that.timerTime = null; - that.timerData = null; - that.qualityTimer = null; - }, - beforeDestoryed() { - let that = this; - this.scene = null; - // clearInterval(that.timerTime); - // clearInterval(that.timerData); - // clearInterval(that.qualityTimer); - that.timerTime = null; - that.timerData = null; - that.qualityTimer = null; - }, };