fix:修改凌源能管大屏 资源泄露问题
This commit is contained in:
parent
8ed0bd9d29
commit
2e54a33aaf
|
|
@ -1177,7 +1177,7 @@ const routes = [
|
||||||
path: "/enm_energy/carbon",
|
path: "/enm_energy/carbon",
|
||||||
meta: {
|
meta: {
|
||||||
title: "碳排放",
|
title: "碳排放",
|
||||||
// icon: "el-icon-grid",
|
icon: "el-icon-grid",
|
||||||
perms: ["carbon_base"],
|
perms: ["carbon_base"],
|
||||||
},
|
},
|
||||||
component: "enm_energy/carbon",
|
component: "enm_energy/carbon",
|
||||||
|
|
|
||||||
|
|
@ -379,6 +379,7 @@ export default {
|
||||||
KHData: [],
|
KHData: [],
|
||||||
SMData: [],
|
SMData: [],
|
||||||
IMData: [],
|
IMData: [],
|
||||||
|
echartLine1: null,
|
||||||
factoryName: "",
|
factoryName: "",
|
||||||
initialAlpha: -Math.PI / 4.5,
|
initialAlpha: -Math.PI / 4.5,
|
||||||
initialBeta: Math.PI / 2,
|
initialBeta: Math.PI / 2,
|
||||||
|
|
@ -743,7 +744,6 @@ export default {
|
||||||
this.$API.mtm.mgroup.list
|
this.$API.mtm.mgroup.list
|
||||||
.req({ page: 0, search: "回转窑" })
|
.req({ page: 0, search: "回转窑" })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// console.log("回转窑", res);
|
|
||||||
that.huihzuanyaoId = res[0].id;
|
that.huihzuanyaoId = res[0].id;
|
||||||
let query = {};
|
let query = {};
|
||||||
query.page = 0;
|
query.page = 0;
|
||||||
|
|
@ -865,7 +865,6 @@ export default {
|
||||||
this.$API.mtm.mgroup.list
|
this.$API.mtm.mgroup.list
|
||||||
.req({ page: 0, search: "余热发电" })
|
.req({ page: 0, search: "余热发电" })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// console.log("余热发电", res);
|
|
||||||
that.yurefadianId = res[0].id;
|
that.yurefadianId = res[0].id;
|
||||||
let params = {};
|
let params = {};
|
||||||
params.page = 0;
|
params.page = 0;
|
||||||
|
|
@ -929,7 +928,6 @@ export default {
|
||||||
};
|
};
|
||||||
that.$API.enm.enstat.req(params).then((res) => {
|
that.$API.enm.enstat.req(params).then((res) => {
|
||||||
let data = res.results;
|
let data = res.results;
|
||||||
console.log("工序电耗", data);
|
|
||||||
let seriesData = [0, 0, 0, 0, 0];
|
let seriesData = [0, 0, 0, 0, 0];
|
||||||
data.forEach((item, index) => {
|
data.forEach((item, index) => {
|
||||||
if (item.mgroup_name == "石灰石破碎") {
|
if (item.mgroup_name == "石灰石破碎") {
|
||||||
|
|
@ -939,7 +937,6 @@ export default {
|
||||||
} else if (item.mgroup_name == "回转窑") {
|
} else if (item.mgroup_name == "回转窑") {
|
||||||
seriesData[2] = item.elec_consume;
|
seriesData[2] = item.elec_consume;
|
||||||
} else if (item.mgroup_name == "余热发电") {
|
} else if (item.mgroup_name == "余热发电") {
|
||||||
console.log("余热发电工序电耗", item.elec_consume);
|
|
||||||
seriesData[3] = item.elec_consume;
|
seriesData[3] = item.elec_consume;
|
||||||
} else if (item.mgroup_name == "煤磨") {
|
} else if (item.mgroup_name == "煤磨") {
|
||||||
seriesData[4] = item.elec_consume;
|
seriesData[4] = item.elec_consume;
|
||||||
|
|
@ -969,7 +966,6 @@ export default {
|
||||||
return typeof variable;
|
return typeof variable;
|
||||||
}
|
}
|
||||||
that.$API.enm.mpoint.list.req(params).then((res) => {
|
that.$API.enm.mpoint.list.req(params).then((res) => {
|
||||||
console.log("数据采集", res);
|
|
||||||
let success_num = 0;
|
let success_num = 0;
|
||||||
let error_num = 0;
|
let error_num = 0;
|
||||||
res.forEach((item, index) => {
|
res.forEach((item, index) => {
|
||||||
|
|
@ -985,8 +981,6 @@ export default {
|
||||||
}
|
}
|
||||||
that.tableData.push(item);
|
that.tableData.push(item);
|
||||||
});
|
});
|
||||||
console.log("数据采集tableData", that.tableData);
|
|
||||||
|
|
||||||
let chartDom6 = document.getElementById("pieChart");
|
let chartDom6 = document.getElementById("pieChart");
|
||||||
let myChart6 = echarts.init(chartDom6);
|
let myChart6 = echarts.init(chartDom6);
|
||||||
let colors = [];
|
let colors = [];
|
||||||
|
|
@ -1079,16 +1073,14 @@ export default {
|
||||||
// right_block.style.display = "none";
|
// right_block.style.display = "none";
|
||||||
var itemHeight = Math.round((windowHeight - 150) / 3);
|
var itemHeight = Math.round((windowHeight - 150) / 3);
|
||||||
var itemBodyHeight = itemHeight - 40;
|
var itemBodyHeight = itemHeight - 40;
|
||||||
var flexItems = document.getElementsByClassName("flexItem");
|
const flexItems = document.querySelectorAll('.flexItem')
|
||||||
var itemBodys = document.getElementsByClassName("itemBody");
|
const itemBodys = document.querySelectorAll('.itemBody')
|
||||||
for (var i = 0; i < flexItems.length; i++) {
|
flexItems.forEach(el => {
|
||||||
var flexItem = flexItems[i];
|
el.style.height = `${itemHeight}px`
|
||||||
flexItem.style.height = itemHeight + "px";
|
})
|
||||||
}
|
itemBodys.forEach(el => {
|
||||||
for (var i = 0; i < itemBodys.length; i++) {
|
el.style.height = `${itemBodyHeight}px`
|
||||||
var itemBody = itemBodys[i];
|
})
|
||||||
itemBody.style.height = itemBodyHeight + "px";
|
|
||||||
}
|
|
||||||
elTable.style.height = itemBodyHeight - 20 + "px";
|
elTable.style.height = itemBodyHeight - 20 + "px";
|
||||||
let pieWidth = Math.round(windowWidth / 100) * 22 - 180;
|
let pieWidth = Math.round(windowWidth / 100) * 22 - 180;
|
||||||
let radarWidth = Math.round(windowWidth / 100) * 22 - 130;
|
let radarWidth = Math.round(windowWidth / 100) * 22 - 130;
|
||||||
|
|
@ -1114,7 +1106,6 @@ export default {
|
||||||
document.getElementById(name)
|
document.getElementById(name)
|
||||||
);
|
);
|
||||||
if (myChart != undefined) {
|
if (myChart != undefined) {
|
||||||
// console.log(name + ' :resize')
|
|
||||||
myChart.resize();
|
myChart.resize();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1417,7 +1408,6 @@ export default {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (camera.target != mesh.position) {
|
} else if (camera.target != mesh.position) {
|
||||||
console.log("fly to");
|
|
||||||
// 计算新的相机位置
|
// 计算新的相机位置
|
||||||
let position = mesh._parentNode._position;
|
let position = mesh._parentNode._position;
|
||||||
if (mesh._parentNode.id == "__root__") {
|
if (mesh._parentNode.id == "__root__") {
|
||||||
|
|
@ -1745,25 +1735,55 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
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;
|
this.scene = null;
|
||||||
clearInterval(that.timerTime);
|
this.echartLine1 = null;
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 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>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue