From 30e590afc749b719088fa938e35c35685eaef6c6 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 29 Aug 2019 11:26:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=E8=BD=A6=E6=AC=A1=E7=AA=97?= =?UTF-8?q?=E9=BC=A0=E6=A0=87=E4=BA=8B=E4=BB=B6=E4=BB=A5=E5=8F=8A=E8=BD=A6?= =?UTF-8?q?=E6=AC=A1=E7=AA=97=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/shape/Section/EMouse.js | 8 +- src/jmap/shape/Switch/EMouse.js | 8 +- src/jmap/shape/TrainWindow/EMouse.js | 37 +++ src/jmap/shape/TrainWindow/index.js | 44 +--- src/views/components/filterCity/index.vue | 1 - src/views/demonstration/deomonList/index.vue | 5 - src/views/demonstration/list/demonList.vue | 14 +- src/views/planMonitor/planmanage/planList.vue | 7 +- src/views/screenMonitor/list/demonList.vue | 245 ++++++++++-------- 9 files changed, 195 insertions(+), 174 deletions(-) create mode 100644 src/jmap/shape/TrainWindow/EMouse.js diff --git a/src/jmap/shape/Section/EMouse.js b/src/jmap/shape/Section/EMouse.js index d97f5eb11..40e2166ec 100644 --- a/src/jmap/shape/Section/EMouse.js +++ b/src/jmap/shape/Section/EMouse.js @@ -99,8 +99,8 @@ class EMouse extends Group { this.sectionTextBorder && this.sectionTextBorder.show(); this.lineBorder && this.lineBorder.show(); const instance = this.getInstanceByCode(this.device.model.trainWindowCode); - if (instance && instance.mouseEnter) { - instance.mouseEnter(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { + instance.mouseEvent.mouseEnter(e); } } } @@ -118,8 +118,8 @@ class EMouse extends Group { this.sectionTextBorder && this.sectionTextBorder.hide(); this.lineBorder && this.lineBorder.hide(); const instance = this.getInstanceByCode(this.device.model.trainWindowCode); - if (instance && instance.mouseLeave) { - instance.mouseLeave(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { + instance.mouseEvent.mouseLeave(e); } } } diff --git a/src/jmap/shape/Switch/EMouse.js b/src/jmap/shape/Switch/EMouse.js index 89b6e57fa..8d5c9ba76 100644 --- a/src/jmap/shape/Switch/EMouse.js +++ b/src/jmap/shape/Switch/EMouse.js @@ -83,8 +83,8 @@ class EMouse extends Group { const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; const instance = this.getInstanceByCode(parentSection.trainWindowCode); - if (instance && instance.mouseLeave) { - instance.mouseLeave(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { + instance.mouseEvent.mouseLeave(e); } } } @@ -101,8 +101,8 @@ class EMouse extends Group { const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; const instance = this.getInstanceByCode(parentSection.trainWindowCode); - if (instance && instance.mouseEnter) { - instance.mouseEnter(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { + instance.mouseEvent.mouseEnter(e); } } diff --git a/src/jmap/shape/TrainWindow/EMouse.js b/src/jmap/shape/TrainWindow/EMouse.js new file mode 100644 index 000000000..d059089c0 --- /dev/null +++ b/src/jmap/shape/TrainWindow/EMouse.js @@ -0,0 +1,37 @@ +export default class EMouse { + constructor(device) { + this.device = device; + } + + mouseover(e) { + if (this.device.prdType) { + this.device.setVisible(true); + const instance = this.device.getInstanceByCode(this.device.model.sectionCode); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { + instance.mouseEvent.mouseEnter(e); + } + } + } + + mouseout(e) { + if (this.device.prdType) { + this.device.setVisible(false || this.device.model.trainWindowShow); + const instance = this.device.getInstanceByCode(this.device.model.sectionCode); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) { + instance.mouseEvent.mouseLeave(e); + } + } + } + + mouseEnter(e) { + if (this.device.prdType) { + this.device.setVisible(true); + } + } + + mouseLeave(e) { + if (this.device.prdType ) { + this.device.setVisible(false); + } + } +} diff --git a/src/jmap/shape/TrainWindow/index.js b/src/jmap/shape/TrainWindow/index.js index 1315f9c9a..e0ec9d383 100644 --- a/src/jmap/shape/TrainWindow/index.js +++ b/src/jmap/shape/TrainWindow/index.js @@ -1,6 +1,7 @@ /* 车次窗*/ import Polygon from 'zrender/src/graphic/shape/Polygon'; import Group from 'zrender/src/container/Group'; +import EMouse from './EMouse'; import store from '@/store'; class TrainWindow extends Group { @@ -14,6 +15,7 @@ class TrainWindow extends Group { this.z = 9; this.prdType = store.state.training.prdType; this.create(model); + this.createMouseEvent(); this.setState(model); } create(model) { @@ -22,6 +24,12 @@ class TrainWindow extends Group { } } + createMouseEvent() { + this.mouseEvent = new EMouse(this); + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); + } + /** 创建车次窗*/ createTrainWindow() { const model = this.model; @@ -44,9 +52,7 @@ class TrainWindow extends Group { lineWidth: this.style.TrainWindow.lineWidth, stroke: this.style.TrainWindow.lineColor, fill: this.style.transparentColor - }, - onmouseover: (e) => { this.mouseover(e); }, - onmouseout: (e) => { this.mouseout(e); } + } }); this.add(this.trainRect); } @@ -72,38 +78,6 @@ class TrainWindow extends Group { getInstanceByCode(code) { return (store.getters['map/getDeviceByCode'](code) || {}).instance; } - - mouseout(e) { - if (this.prdType) { - this.setVisible(false); - const instance = this.getInstanceByCode(this.model.sectionCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) { - instance.mouseEvent.mouseLeave(e); - } - } - } - - mouseover(e) { - if (this.prdType) { - this.setVisible(true); - const instance = this.getInstanceByCode(this.model.sectionCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { - instance.mouseEvent.mouseEnter(e); - } - } - } - - mouseEnter(e) { - if (this.prdType) { - this.setVisible(true); - } - } - - mouseLeave(e) { - if (this.prdType ) { - this.setVisible(false); - } - } } export default TrainWindow; diff --git a/src/views/components/filterCity/index.vue b/src/views/components/filterCity/index.vue index 28abc0fc8..7272b10f5 100644 --- a/src/views/components/filterCity/index.vue +++ b/src/views/components/filterCity/index.vue @@ -175,7 +175,6 @@ export default { } }, filterSelectChange(filterSelect) { - this.$emit('changeFilter', filterSelect); if (this.isCascader) { // 设置二级联动组件 localStore.set('cityCode', filterSelect[0]); diff --git a/src/views/demonstration/deomonList/index.vue b/src/views/demonstration/deomonList/index.vue index b8b5fd3b7..a3b6d72ed 100644 --- a/src/views/demonstration/deomonList/index.vue +++ b/src/views/demonstration/deomonList/index.vue @@ -71,8 +71,6 @@ export default { return true; } }, - watch: { - }, methods: { filterNode(value, data) { if (!value) return true; @@ -99,9 +97,6 @@ export default { doClose() { this.loading = false; this.dialogShow = false; - }, - handleWatch() { - }, async handleJoin() { if (this.group) { diff --git a/src/views/demonstration/list/demonList.vue b/src/views/demonstration/list/demonList.vue index d554427b5..f12cda4b4 100644 --- a/src/views/demonstration/list/demonList.vue +++ b/src/views/demonstration/list/demonList.vue @@ -2,9 +2,8 @@
{{ $t('global.mapList') }} -
- + import { getPublishMapTree } from '@/api/management/mapprd'; import { UrlConfig } from '@/router/index'; -import FilterCity from '@/views/components/filterCity'; import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth'; +import FilterCity from '@/views/components/filterCity'; export default { name: 'ExamDetailList', @@ -77,12 +76,9 @@ export default { } }, beforeDestroy () { - this.clearMapSelect(); + removeSessionStorage('demonList'); }, methods: { - // backHome() { - // this.$router.push({ path: `/` }); - // }, filterNode(value, data) { if (!value) return true; return data.name.indexOf(value) !== -1; @@ -117,6 +113,7 @@ export default { } this.$nextTick(() => { const mapId = getSessionStorage('demonList') || null; + console.log(mapId); this.$refs.tree.setCurrentKey(mapId); this.loading = false; }); @@ -124,9 +121,6 @@ export default { this.loading = false; this.$messageBox(this.$t('error.refreshFailed')); } - }, - clearMapSelect() { - removeSessionStorage('demonList'); } } }; diff --git a/src/views/planMonitor/planmanage/planList.vue b/src/views/planMonitor/planmanage/planList.vue index 9aa7b8518..b5da07909 100644 --- a/src/views/planMonitor/planmanage/planList.vue +++ b/src/views/planMonitor/planmanage/planList.vue @@ -31,6 +31,7 @@ import FilterCity from '@/views/components/filterCity'; import { listPublishMap } from '@/api/jmap/map'; import { queryPermissionScreen } from '@/api/management/author'; +import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { UrlConfig } from '@/router/index'; export default { @@ -72,6 +73,9 @@ export default { created() { this.getScreenLists(); }, + beforeDestroy () { + removeSessionStorage('planMonitorList'); + }, methods: { async getScreenLists() { const list = await queryPermissionScreen(); @@ -88,6 +92,7 @@ export default { } }, clickEvent(obj) { + setSessionStorage('planMonitorList', obj.id); this.$router.push({ path: `${UrlConfig.plan.detail}/${obj.id}` }); }, refresh(filterSelect) { @@ -114,7 +119,7 @@ export default { this.$router.push({ path: `${UrlConfig.plan.prefix}/home` }); } else { this.$nextTick(() => { - const mapId = (this.treeList[0] || { id: 0 }).id; + const mapId = getSessionStorage('planMonitorList') || (this.treeList[0] || { id: 0 }).id; this.$router.push({ path: `${UrlConfig.plan.detail}/${mapId}` }); this.$refs.tree.setCurrentKey(mapId); // value 绑定的node-key }); diff --git a/src/views/screenMonitor/list/demonList.vue b/src/views/screenMonitor/list/demonList.vue index 3fa674aae..dde32f50b 100644 --- a/src/views/screenMonitor/list/demonList.vue +++ b/src/views/screenMonitor/list/demonList.vue @@ -1,124 +1,141 @@