From 2e54a33aaf86eba9e5681351975351280d56463b Mon Sep 17 00:00:00 2001 From: TianyangZhang Date: Thu, 4 Dec 2025 15:29:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E5=87=8C=E6=BA=90?= =?UTF-8?q?=E8=83=BD=E7=AE=A1=E5=A4=A7=E5=B1=8F=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=B3=84=E9=9C=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/route.js | 2 +- src/views/bigScreen/index_enm_ly.vue | 92 +++++++++++++++++----------- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/src/config/route.js b/src/config/route.js index 8f84d9e7..d1826827 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -1177,7 +1177,7 @@ const routes = [ path: "/enm_energy/carbon", meta: { title: "碳排放", - // icon: "el-icon-grid", + icon: "el-icon-grid", perms: ["carbon_base"], }, component: "enm_energy/carbon", diff --git a/src/views/bigScreen/index_enm_ly.vue b/src/views/bigScreen/index_enm_ly.vue index 1d4b3d10..edd0102a 100644 --- a/src/views/bigScreen/index_enm_ly.vue +++ b/src/views/bigScreen/index_enm_ly.vue @@ -379,6 +379,7 @@ export default { KHData: [], SMData: [], IMData: [], + echartLine1: null, factoryName: "", initialAlpha: -Math.PI / 4.5, initialBeta: Math.PI / 2, @@ -743,7 +744,6 @@ export default { this.$API.mtm.mgroup.list .req({ page: 0, search: "回转窑" }) .then((res) => { - // console.log("回转窑", res); that.huihzuanyaoId = res[0].id; let query = {}; query.page = 0; @@ -865,7 +865,6 @@ export default { this.$API.mtm.mgroup.list .req({ page: 0, search: "余热发电" }) .then((res) => { - // console.log("余热发电", res); that.yurefadianId = res[0].id; let params = {}; params.page = 0; @@ -929,7 +928,6 @@ export default { }; that.$API.enm.enstat.req(params).then((res) => { let data = res.results; - console.log("工序电耗", data); let seriesData = [0, 0, 0, 0, 0]; data.forEach((item, index) => { if (item.mgroup_name == "石灰石破碎") { @@ -939,7 +937,6 @@ export default { } else if (item.mgroup_name == "回转窑") { seriesData[2] = item.elec_consume; } else if (item.mgroup_name == "余热发电") { - console.log("余热发电工序电耗", item.elec_consume); seriesData[3] = item.elec_consume; } else if (item.mgroup_name == "煤磨") { seriesData[4] = item.elec_consume; @@ -969,7 +966,6 @@ export default { return typeof variable; } that.$API.enm.mpoint.list.req(params).then((res) => { - console.log("数据采集", res); let success_num = 0; let error_num = 0; res.forEach((item, index) => { @@ -985,8 +981,6 @@ export default { } that.tableData.push(item); }); - console.log("数据采集tableData", that.tableData); - let chartDom6 = document.getElementById("pieChart"); let myChart6 = echarts.init(chartDom6); let colors = []; @@ -1079,16 +1073,14 @@ export default { // right_block.style.display = "none"; var itemHeight = Math.round((windowHeight - 150) / 3); var itemBodyHeight = itemHeight - 40; - var flexItems = document.getElementsByClassName("flexItem"); - var itemBodys = document.getElementsByClassName("itemBody"); - for (var i = 0; i < flexItems.length; i++) { - var flexItem = flexItems[i]; - flexItem.style.height = itemHeight + "px"; - } - for (var i = 0; i < itemBodys.length; i++) { - var itemBody = itemBodys[i]; - itemBody.style.height = itemBodyHeight + "px"; - } + const flexItems = document.querySelectorAll('.flexItem') + const itemBodys = document.querySelectorAll('.itemBody') + flexItems.forEach(el => { + el.style.height = `${itemHeight}px` + }) + itemBodys.forEach(el => { + el.style.height = `${itemBodyHeight}px` + }) elTable.style.height = itemBodyHeight - 20 + "px"; let pieWidth = Math.round(windowWidth / 100) * 22 - 180; let radarWidth = Math.round(windowWidth / 100) * 22 - 130; @@ -1114,7 +1106,6 @@ export default { document.getElementById(name) ); if (myChart != undefined) { - // console.log(name + ' :resize') myChart.resize(); } }, @@ -1417,7 +1408,6 @@ export default { ); } } else if (camera.target != mesh.position) { - console.log("fly to"); // 计算新的相机位置 let position = mesh._parentNode._position; if (mesh._parentNode.id == "__root__") { @@ -1745,25 +1735,55 @@ export default { }, }, beforeUnmount() { - let that = this; + // 1. 清理定时器 + clearInterval(this.timerTime); + clearInterval(this.qualityTimer); + clearInterval(this.heightTimer); + + // 3. 移除事件监听 + window.removeEventListener("resize", this.handleResize); + if (this.scene && this.pointerListener) { + this.scene.onPointerObservable.remove(this.pointerListener); + } + + // 4. 销毁 Babylon + if (this.engine) this.engine.dispose(); + if (this.scene) this.scene.dispose(); + + // 5. 清空引用避免内存持续占用 + this.engine = null; 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; + this.echartLine1 = null; }, + + // 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; + // if (this.engine) { + // this.engine.dispose(); // 释放 GPU 内容 + // this.engine = null; + // } + // if (this.scene) { + // this.scene.dispose(); + // this.scene = null; + // } + // }, };