fix:修改凌源能管大屏 资源泄露问题

This commit is contained in:
TianyangZhang 2025-12-04 15:29:40 +08:00
parent 8ed0bd9d29
commit 2e54a33aaf
2 changed files with 57 additions and 37 deletions

View File

@ -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",

View File

@ -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;
// }
// },
};
</script>
<style scoped>