diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index d4a5f908c..2678f6402 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -46,6 +46,7 @@ class Jlmap { this.stationCode = ''; this.isUpdateShowTrainList = false; this.isUpdateRunLineTrain = false; + this._disposeFlag = false; } // 初始化属性有鼠标事件 缩放等 @@ -668,6 +669,7 @@ class Jlmap { this.$keyboardController.dispose(); this.$zr && zrender.dispose(this.$zr); this.$painter.dispose(); + this._disposeFlag = true; } on(eventname, cb, context) { diff --git a/src/views/newMap/displayBaSiDi/rps.vue b/src/views/newMap/displayBaSiDi/rps.vue index fef17b75e..aaea4ebff 100644 --- a/src/views/newMap/displayBaSiDi/rps.vue +++ b/src/views/newMap/displayBaSiDi/rps.vue @@ -63,7 +63,7 @@ export default { } }, beforeDestroy() { - if (!this.dialogShow) { + if (this.selfJmap && this.selfJmap._disposeFlag) { this.destroy(); } }, @@ -85,9 +85,7 @@ export default { }); }, destroy() { - if (this.selfJmap) { - this.selfJmap.dispose(); - } + this.selfJmap.dispose(); }, handleUpdateScreen() { this.maskOpen = false; diff --git a/src/views/newMap/displayBaSiDi/tro.vue b/src/views/newMap/displayBaSiDi/tro.vue index c1ab365d7..36bf19a16 100644 --- a/src/views/newMap/displayBaSiDi/tro.vue +++ b/src/views/newMap/displayBaSiDi/tro.vue @@ -76,7 +76,7 @@ export default { } }, beforeDestroy() { - if (!this.dialogShow) { + if (this.selfJmap && this.selfJmap._disposeFlag) { this.destroy(); } }, @@ -98,25 +98,9 @@ export default { }); }, destroy() { - if (this.selfJmap) { - this.selfJmap.dispose(); - } + this.selfJmap.dispose(); }, showTroMode() { - // const nameList = Object.keys(this.$store.state.map.map || {}); - // let list = []; - // nameList.forEach(item => { - // if (item !== 'skinVO') { - // const data = this.$store.state.map.map[item]; - // if (data && data.constructor === Array) { - // list = [...list, ...data]; - // } - // } - // }); - // const trainList = []; - // this.trainList.forEach(item => { - // trainList.push({ code: item.groupNumber, deviceType:'TRAIN' }); - // }); const mapDevice = this.$store.state.map.mapDevice; const list = []; for (const key in mapDevice) { @@ -124,7 +108,6 @@ export default { } this.handleUpdateScreen(); this.$jlmap.updateShowMode(list, '05'); // 二次过滤 - // this.$store.dispatch('training/updateMapState', trainList); }, handleUpdateScreen() { this.maskOpen = false; diff --git a/src/views/newMap/displayBaSiDi/troDetail.vue b/src/views/newMap/displayBaSiDi/troDetail.vue index 210baf9a5..cfa931fd9 100644 --- a/src/views/newMap/displayBaSiDi/troDetail.vue +++ b/src/views/newMap/displayBaSiDi/troDetail.vue @@ -84,7 +84,7 @@ export default { } }, beforeDestroy() { - if (!this.dialogShow) { + if (this.selfJmap && !this.selfJmap._disposeFlag) { this.destroy(); } }, @@ -112,9 +112,7 @@ export default { this.selfJmap = Vue.prototype.$jlmap; }, destroy() { - if (this.selfJmap) { - this.selfJmap.dispose(); - } + this.selfJmap.dispose(); }, goTroDialog() { this.doClose();