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; - }, };