From b6baa2e420b4389f4e839c93c4ad39e77dd29c71 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Tue, 6 Aug 2019 17:46:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=90=8D=E7=A7=B0=E7=9A=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/map.js | 6 +- src/jmap/shape/Section/EMouse.js | 1 - .../batong_01/menus/menuDialog/viewDevice.vue | 32 +++----- .../batong_01/menus/menuDialog/viewName.vue | 64 ++++++---------- .../menus/menuDialog/viewTrainId.vue | 10 +-- .../menus/menuDialog/viewDevice.vue | 33 +++----- .../beijing_01/menus/menuDialog/viewName.vue | 65 ++++++---------- .../menus/menuDialog/viewTrainId.vue | 10 +-- .../menus/menuDialog/viewDevice.vue | 37 ++++----- .../chengdou_03/menus/menuDialog/viewName.vue | 65 ++++++---------- .../menus/menuDialog/viewTrainId.vue | 8 +- .../fuzhou_01/menus/menuDialog/viewDevice.vue | 24 ++---- .../fuzhou_01/menus/menuDialog/viewName.vue | 76 ++++++++----------- .../menus/menuDialog/viewTrainId.vue | 9 +-- 14 files changed, 166 insertions(+), 274 deletions(-) diff --git a/src/jmap/map.js b/src/jmap/map.js index dd9447a85..cc929072f 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -234,16 +234,12 @@ class Jlmap { this.$painter.delete(oDevice); } else { const nDevice = Object.assign(oDevice, this.hookHandle(elem)); - if (nDevice.id == '5888') { - console.log(oDevice, nDevice); - debugger; - } this.$painter.update(nDevice); } }); // 状态后处理 - // this.postHandle(list); + this.postHandle(list); if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); } } diff --git a/src/jmap/shape/Section/EMouse.js b/src/jmap/shape/Section/EMouse.js index 8c29d0ce8..8825e30ef 100644 --- a/src/jmap/shape/Section/EMouse.js +++ b/src/jmap/shape/Section/EMouse.js @@ -89,7 +89,6 @@ class EMouse extends Group { } mouseover(e) { - debugger; if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { const instance = this.getInstanceByCode(this.device.model.relSwitchCode); if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { diff --git a/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue index 849c50c99..e11866265 100644 --- a/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue @@ -124,43 +124,33 @@ export default { }, setDeviceDisplay() { let show = false; - const deviceList = []; + let deviceList = []; // 区段边界设置 - const sectionList = this.$store.getters['map/sectionList']; + let borderBorderShow = this.deviceLevels.indexOf(2) !== -1; + let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { - // 区段边界 - show = this.deviceLevels.indexOf(2) !== -1; - elem.borderBorderShow = show; - elem.type = deviceType.Section; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { borderBorderShow })); // 区段边界 }); } // 车次窗设置 - const trainWindowList = this.$store.getters['map/trainWindowList']; + let trainWindowShow = this.deviceLevels.indexOf(1) !== -1; + let trainWindowList = this.$store.getters['map/trainWindowList']; if (trainWindowList && trainWindowList.length > 0) { trainWindowList.forEach(elem => { - // 车次窗 - show = this.deviceLevels.indexOf(1) !== -1; - elem.type = deviceType.Section; - elem.trainWindowShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { trainWindowShow })); // 车次窗 }); } // 联锁自动进路表示灯和ATS自动触发表示灯设置 - const signalList = this.$store.getters['map/signalList']; + let linkageAutoRouteShow = this.deviceLevels.indexOf(3) !== -1;// 联锁自动进路表示灯 + let atsAutoTriggerShow = this.deviceLevels.indexOf(4) !== -1;// ATS自动触发表示灯 + let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - // 联锁自动进路表示灯 - show = this.deviceLevels.indexOf(3) !== -1; - elem.linkageAutoRouteShow = show; - // ATS自动触发表示灯 - show = this.deviceLevels.indexOf(4) !== -1; - elem.atsAutoTriggerShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { linkageAutoRouteShow, atsAutoTriggerShow })); }); } diff --git a/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue b/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue index ee32f9dc6..d3b986db0 100644 --- a/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue @@ -147,111 +147,97 @@ }) }, setNameDisplay() { - let show = false; let deviceList = []; //信号机 - show = this.nameLevels.indexOf(1) !== -1 ? true : false; + let nameShow = this.nameLevels.indexOf(1) !== -1 ? true : false; let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem.nameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow })); }) } //按钮名称 - show = this.nameLevels.indexOf(3) !== -1 ? true : false; + nameShow = this.nameLevels.indexOf(3) !== -1 ? true : false; //道岔 + nameShow = this.nameLevels.indexOf(7) !== -1 ? true : false; //道岔名称 + let switchSectionNameShow = this.nameLevels.indexOf(9) !== -1 ? true : false; //道岔轨名称 let switchList = this.$store.getters['map/switchList']; if (switchList && switchList.length > 0) { switchList.forEach(elem => { - //道岔名称 - show = this.nameLevels.indexOf(7) !== -1 ? true : false; - elem.nameShow = show; - //道岔轨名称 - show = this.nameLevels.indexOf(9) !== -1 ? true : false; - elem.switchSectionNameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, switchSectionNameShow })); }) } //控制模式 - show = this.nameLevels.indexOf(8) !== -1 ? true : false; + let indicatorShow = this.nameLevels.indexOf(8) !== -1 ? true : false; let control = this.$store.getters['map/stationControlList']; if (control && control.length > 0) { control.forEach(elem => { - //标识灯名称 - elem.indicatorShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { indicatorShow })); //标识灯名称 }) } //区段 + nameShow = false; + let standTrackNameShow = false; + let reentryTrackNameShow = false; + let transferTrackNameShow = false; let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { if (elem.isSwitchSection && elem.parentCode) { //道岔轨的区段名称默认不显示 - elem.nameShow = false; + nameShow = false; } else { if (elem.type === '01') { - show = this.nameLevels.indexOf(11) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(11) !== -1 ? true : false; } else if (elem.type === '02') { //股道轨名称 - show = this.nameLevels.indexOf(5) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(5) !== -1 ? true : false; } else if (elem.type === '03') { //道岔区段名称 - show = this.nameLevels.indexOf(9) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(9) !== -1 ? true : false; } } //站台轨名称 if (elem.isStandTrack) { - show = this.nameLevels.indexOf(2) !== -1 ? true : false; - elem.standTrackNameShow = show; + standTrackNameShow = this.nameLevels.indexOf(2) !== -1 ? true : false; } //折返轨名称 if (elem.isReentryTrack) { - show = this.nameLevels.indexOf(4) !== -1 ? true : false; - elem.reentryTrackNameShow = show; + reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1 ? true : false; } //转换轨名称 if (elem.isTransferTrack) { - show = this.nameLevels.indexOf(6) !== -1 ? true : false; - elem.transferTrackNameShow = show; + transferTrackNameShow = this.nameLevels.indexOf(6) !== -1 ? true : false; } - - deviceList.push(elem); + + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); }) } //停车点 - show = this.nameLevels.indexOf(10) !== -1 ? true : false; + let destCodeShow = this.nameLevels.indexOf(10) !== -1 ? true : false; let stopPointList = this.$store.getters['map/stopPointList']; if (stopPointList && stopPointList.length > 0) { stopPointList.forEach(elem => { - //目的地名称 - elem.destCodeShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { destCodeShow })); }) } //车站 - show = this.nameLevels.indexOf(12) !== -1 ? true : false; + let kmPostShow = this.nameLevels.indexOf(12) !== -1 ? true : false; let stationList = this.$store.getters['map/stationList']; if (stationList && stationList.length > 0) { stationList.forEach(elem => { - //公里标 - elem.kmPostShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { kmPostShow })); //公里标 }) } diff --git a/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue index 40d56e47b..96fdd3fa4 100644 --- a/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue @@ -155,16 +155,16 @@ }) }, setTrainDispaly() { + let updatList = []; let trainList = this.$store.getters['training/viewTrainList']; if (trainList && trainList.length > 0) { - let planFormat = this.trainNameFormatBy(this.planMode); + let nameFormat = this.trainNameFormatBy(this.planMode); let nameFontSize = this.fontSize; - trainList.forEach(elem => { - elem.nameFormat = planFormat; - elem.nameFontSize = nameFontSize; + updatList.forEach(elem => { + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameFormat, nameFontSize })); // 车次窗 }); - this.$store.dispatch('map/updateMapDevices', trainList); + this.$store.dispatch('map/updateMapDevices', updatList); } }, trainNameFormatBy(mode) { diff --git a/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue index 8d70ab278..75084ae0f 100644 --- a/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue @@ -125,44 +125,33 @@ export default { }, setDeviceDisplay() { let show = false; - const deviceList = []; + let deviceList = []; // 区段边界设置 - const sectionList = this.$store.getters['map/sectionList']; + let borderBorderShow = this.deviceLevels.indexOf(2) !== -1; + let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { - // 区段边界 - show = this.deviceLevels.indexOf(2) !== -1; - elem._type = deviceType.Section; - elem.borderBorderShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { borderBorderShow })); // 区段边界 }); } // 车次窗设置 - const trainWindowList = this.$store.getters['map/trainWindowList']; + let trainWindowShow = this.deviceLevels.indexOf(1) !== -1; + let trainWindowList = this.$store.getters['map/trainWindowList']; if (trainWindowList && trainWindowList.length > 0) { trainWindowList.forEach(elem => { - // 车次窗 - show = this.deviceLevels.indexOf(1) !== -1; - elem._type = deviceType.TrainWindow; - elem.trainWindowShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { trainWindowShow })); // 车次窗 }); } // 联锁自动进路表示灯和ATS自动触发表示灯设置 - const signalList = this.$store.getters['map/signalList']; + let linkageAutoRouteShow = this.deviceLevels.indexOf(3) !== -1;// 联锁自动进路表示灯 + let atsAutoTriggerShow = this.deviceLevels.indexOf(4) !== -1;// ATS自动触发表示灯 + let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem._type = deviceType.Signal; - // 联锁自动进路表示灯 - show = this.deviceLevels.indexOf(3) !== -1; - elem.linkageAutoRouteShow = show; - // ATS自动触发表示灯 - show = this.deviceLevels.indexOf(4) !== -1; - elem.atsAutoTriggerShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { linkageAutoRouteShow, atsAutoTriggerShow })); }); } diff --git a/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue b/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue index 3d84f07ba..957ac7b13 100644 --- a/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue @@ -147,112 +147,97 @@ }) }, setNameDisplay() { - let show = false; let deviceList = []; //信号机 - show = this.nameLevels.indexOf(1) !== -1 ? true : false; + let nameShow = this.nameLevels.indexOf(1) !== -1 ? true : false; let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem.nameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow })); }) } //按钮名称 - show = this.nameLevels.indexOf(3) !== -1 ? true : false; + nameShow = this.nameLevels.indexOf(3) !== -1 ? true : false; //道岔 + nameShow = this.nameLevels.indexOf(7) !== -1 ? true : false; //道岔名称 + let switchSectionNameShow = this.nameLevels.indexOf(9) !== -1 ? true : false; //道岔轨名称 let switchList = this.$store.getters['map/switchList']; if (switchList && switchList.length > 0) { switchList.forEach(elem => { - //道岔名称 - show = this.nameLevels.indexOf(7) !== -1 ? true : false; - elem.nameShow = show; - //道岔轨名称 - show = this.nameLevels.indexOf(9) !== -1 ? true : false; - elem.switchSectionNameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, switchSectionNameShow })); }) } //控制模式 - show = this.nameLevels.indexOf(8) !== -1 ? true : false; + let indicatorShow = this.nameLevels.indexOf(8) !== -1 ? true : false; let control = this.$store.getters['map/stationControlList']; if (control && control.length > 0) { control.forEach(elem => { - //标识灯名称 - elem.indicatorShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { indicatorShow })); //标识灯名称 }) } //区段 + nameShow = false; + let standTrackNameShow = false; + let reentryTrackNameShow = false; + let transferTrackNameShow = false; let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { if (elem.isSwitchSection && elem.parentCode) { //道岔轨的区段名称默认不显示 - elem.nameShow = false; + nameShow = false; } else { if (elem.type === '01') { - show = this.nameLevels.indexOf(11) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(11) !== -1 ? true : false; } else if (elem.type === '02') { //股道轨名称 - show = this.nameLevels.indexOf(5) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(5) !== -1 ? true : false; } else if (elem.type === '03') { //道岔区段名称 - show = this.nameLevels.indexOf(9) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(9) !== -1 ? true : false; } } //站台轨名称 if (elem.isStandTrack) { - show = this.nameLevels.indexOf(2) !== -1 ? true : false; - elem.standTrackNameShow = show; + standTrackNameShow = this.nameLevels.indexOf(2) !== -1 ? true : false; } //折返轨名称 if (elem.isReentryTrack) { - show = this.nameLevels.indexOf(4) !== -1 ? true : false; - elem.reentryTrackNameShow = show; + reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1 ? true : false; } //转换轨名称 if (elem.isTransferTrack) { - show = this.nameLevels.indexOf(6) !== -1 ? true : false; - elem.transferTrackNameShow = show; + transferTrackNameShow = this.nameLevels.indexOf(6) !== -1 ? true : false; } - - deviceList.push(elem); + + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); }) } //停车点 - show = this.nameLevels.indexOf(10) !== -1 ? true : false; + let destCodeShow = this.nameLevels.indexOf(10) !== -1 ? true : false; let stopPointList = this.$store.getters['map/stopPointList']; if (stopPointList && stopPointList.length > 0) { stopPointList.forEach(elem => { - //目的地名称 - elem.destCodeShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { destCodeShow })); }) } //车站 - show = this.nameLevels.indexOf(12) !== -1 ? true : false; + let kmPostShow = this.nameLevels.indexOf(12) !== -1 ? true : false; let stationList = this.$store.getters['map/stationList']; if (stationList && stationList.length > 0) { stationList.forEach(elem => { - //公里标 - elem.kmPostShow = show; - deviceList.push(elem); - + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { kmPostShow })); //公里标 }) } diff --git a/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue index 935e1b017..b3318c33b 100644 --- a/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue @@ -155,16 +155,16 @@ }) }, setTrainDispaly() { + let updatList = []; let trainList = this.$store.getters['training/viewTrainList']; if (trainList && trainList.length > 0) { - let planFormat = this.trainNameFormatBy(this.planMode); + let nameFormat = this.trainNameFormatBy(this.planMode); let nameFontSize = this.fontSize; - trainList.forEach(elem => { - elem.nameFormat = planFormat; - elem.nameFontSize = nameFontSize; + updatList.forEach(elem => { + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameFormat, nameFontSize })); // 车次窗 }); - this.$store.dispatch('map/updateMapDevices', trainList); + this.$store.dispatch('map/updateMapDevices', updatList); } }, trainNameFormatBy(mode) { diff --git a/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue b/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue index e72052eaa..dd4fc2e38 100644 --- a/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue @@ -93,7 +93,7 @@ export default { this.$store.dispatch('training/emitTipFresh'); }, cancel() { - const operate = { + let operate = { type: this.operate.type, operation: OperationEvent.Command.cancel.menu.operation }; @@ -105,7 +105,7 @@ export default { }); }, commit() { - const operate = { + let operate = { over: true, type: this.operate.type, operation: OperationEvent.Command.close.confirm.operation, @@ -125,44 +125,33 @@ export default { }, setDeviceDisplay() { let show = false; - const deviceList = []; + let deviceList = []; // 区段边界设置 - const sectionList = this.$store.getters['map/sectionList']; + let borderBorderShow = this.deviceLevels.indexOf(2) !== -1; + let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { - // 区段边界 - show = this.deviceLevels.indexOf(2) !== -1; - elem._type = deviceType.Section; - elem.borderBorderShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { borderBorderShow })); // 区段边界 }); } // 车次窗设置 - const trainWindowList = this.$store.getters['map/trainWindowList']; + let trainWindowShow = this.deviceLevels.indexOf(1) !== -1; + let trainWindowList = this.$store.getters['map/trainWindowList']; if (trainWindowList && trainWindowList.length > 0) { trainWindowList.forEach(elem => { - // 车次窗 - show = this.deviceLevels.indexOf(1) !== -1; - elem._type = deviceType.TrainWindow; - elem.trainWindowShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { trainWindowShow })); // 车次窗 }); } // 联锁自动进路表示灯和ATS自动触发表示灯设置 - const signalList = this.$store.getters['map/signalList']; + let linkageAutoRouteShow = this.deviceLevels.indexOf(3) !== -1;// 联锁自动进路表示灯 + let atsAutoTriggerShow = this.deviceLevels.indexOf(4) !== -1;// ATS自动触发表示灯 + let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem._type = deviceType.Signal; - // 联锁自动进路表示灯 - show = this.deviceLevels.indexOf(3) !== -1; - elem.linkageAutoRouteShow = show; - // ATS自动触发表示灯 - show = this.deviceLevels.indexOf(4) !== -1; - elem.atsAutoTriggerShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { linkageAutoRouteShow, atsAutoTriggerShow })); }); } diff --git a/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue b/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue index e960f8c95..aa1ccd4f0 100644 --- a/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue @@ -147,112 +147,97 @@ }) }, setNameDisplay() { - let show = false; let deviceList = []; //信号机 - show = this.nameLevels.indexOf(1) !== -1 ? true : false; + let nameShow = this.nameLevels.indexOf(1) !== -1 ? true : false; let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem.nameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow })); }) } //按钮名称 - show = this.nameLevels.indexOf(3) !== -1 ? true : false; + nameShow = this.nameLevels.indexOf(3) !== -1 ? true : false; //道岔 + nameShow = this.nameLevels.indexOf(7) !== -1 ? true : false; //道岔名称 + let switchSectionNameShow = this.nameLevels.indexOf(9) !== -1 ? true : false; //道岔轨名称 let switchList = this.$store.getters['map/switchList']; if (switchList && switchList.length > 0) { switchList.forEach(elem => { - //道岔名称 - show = this.nameLevels.indexOf(7) !== -1 ? true : false; - elem.nameShow = show; - //道岔轨名称 - show = this.nameLevels.indexOf(9) !== -1 ? true : false; - elem.switchSectionNameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, switchSectionNameShow })); }) } //控制模式 - show = this.nameLevels.indexOf(8) !== -1 ? true : false; + let indicatorShow = this.nameLevels.indexOf(8) !== -1 ? true : false; let control = this.$store.getters['map/stationControlList']; if (control && control.length > 0) { control.forEach(elem => { - //标识灯名称 - elem.indicatorShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { indicatorShow })); //标识灯名称 }) } //区段 + nameShow = false; + let standTrackNameShow = false; + let reentryTrackNameShow = false; + let transferTrackNameShow = false; let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { if (elem.isSwitchSection && elem.parentCode) { //道岔轨的区段名称默认不显示 - elem.nameShow = false; + nameShow = false; } else { if (elem.type === '01') { - show = this.nameLevels.indexOf(11) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(11) !== -1 ? true : false; } else if (elem.type === '02') { //股道轨名称 - show = this.nameLevels.indexOf(5) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(5) !== -1 ? true : false; } else if (elem.type === '03') { //道岔区段名称 - show = this.nameLevels.indexOf(9) !== -1 ? true : false; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(9) !== -1 ? true : false; } } //站台轨名称 if (elem.isStandTrack) { - show = this.nameLevels.indexOf(2) !== -1 ? true : false; - elem.standTrackNameShow = show; + standTrackNameShow = this.nameLevels.indexOf(2) !== -1 ? true : false; } //折返轨名称 if (elem.isReentryTrack) { - show = this.nameLevels.indexOf(4) !== -1 ? true : false; - elem.reentryTrackNameShow = show; + reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1 ? true : false; } //转换轨名称 if (elem.isTransferTrack) { - show = this.nameLevels.indexOf(6) !== -1 ? true : false; - elem.transferTrackNameShow = show; + transferTrackNameShow = this.nameLevels.indexOf(6) !== -1 ? true : false; } - - deviceList.push(elem); + + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); }) } //停车点 - show = this.nameLevels.indexOf(10) !== -1 ? true : false; + let destCodeShow = this.nameLevels.indexOf(10) !== -1 ? true : false; let stopPointList = this.$store.getters['map/stopPointList']; if (stopPointList && stopPointList.length > 0) { stopPointList.forEach(elem => { - //目的地名称 - elem.destCodeShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { destCodeShow })); }) } //车站 - show = this.nameLevels.indexOf(12) !== -1 ? true : false; + let kmPostShow = this.nameLevels.indexOf(12) !== -1 ? true : false; let stationList = this.$store.getters['map/stationList']; if (stationList && stationList.length > 0) { stationList.forEach(elem => { - //公里标 - elem.kmPostShow = show; - deviceList.push(elem); - + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { kmPostShow })); //公里标 }) } diff --git a/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue index d1d4353bc..888ba8d38 100644 --- a/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue @@ -155,16 +155,16 @@ }) }, setTrainDispaly() { + let updatList = []; let trainList = this.$store.getters['training/viewTrainList']; if (trainList && trainList.length > 0) { - let planFormat = this.trainNameFormatBy(this.planMode); + let nameFormat = this.trainNameFormatBy(this.planMode); let nameFontSize = this.fontSize; trainList.forEach(elem => { - elem.nameFormat = planFormat; - elem.nameFontSize = nameFontSize; + updatList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameFormat, nameFontSize })); }); - this.$store.dispatch('map/updateMapDevices', trainList); + this.$store.dispatch('map/updateMapDevices', updatList); } }, trainNameFormatBy(mode) { diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue index cf5cad110..c27095ab7 100644 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue @@ -115,45 +115,35 @@ }) }, setDeviceDisplay() { - let show = false; let deviceList = []; //区段边界设置 + let borderBorderShow = this.deviceLevels.indexOf(2) !== -1 ? true : false; let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { - elem._type = deviceType.Section; //区段边界 - show = this.deviceLevels.indexOf(2) !== -1 ? true : false; - elem.borderBorderShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), {borderBorderShow })); }); } //车次窗设置 + let trainWindowShow = this.deviceLevels.indexOf(1) !== -1 ? true : false; let trainWindowList = this.$store.getters['map/trainWindowList']; if (trainWindowList && trainWindowList.length > 0) { trainWindowList.forEach(elem => { - elem._type = deviceType.TrainWindow; //车次窗 - show = this.deviceLevels.indexOf(1) !== -1 ? true : false; - elem.trainWindowShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), {trainWindowShow })); }); } //联锁自动进路表示灯和ATS自动触发表示灯设置 + let linkageAutoRouteShow = this.deviceLevels.indexOf(3) !== -1 ? true : false; //联锁自动进路表示灯 + let atsAutoTriggerShow = this.deviceLevels.indexOf(4) !== -1 ? true : false; //ATS自动触发表示灯 let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem._type = deviceType.Signal; - //联锁自动进路表示灯 - show = this.deviceLevels.indexOf(3) !== -1 ? true : false; - elem.linkageAutoRouteShow = show; - //ATS自动触发表示灯 - show = this.deviceLevels.indexOf(4) !== -1 ? true : false; - elem.atsAutoTriggerShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { linkageAutoRouteShow, atsAutoTriggerShow })); }) } diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue index dd98d0c98..3af45c402 100644 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue @@ -126,7 +126,7 @@ export default { this.$store.dispatch('training/emitTipFresh'); }, cancel() { - const operate = { + let operate = { type: this.operate.type, operation: OperationEvent.Command.cancel.menu.operation }; @@ -138,7 +138,7 @@ export default { }); }, commit() { - const operate = { + let operate = { over: true, type: this.operate.type, operation: OperationEvent.Command.close.confirm.operation, @@ -157,106 +157,90 @@ export default { }); }, setNameDisplay() { - let show = false; - const deviceList = []; + let deviceList = []; // 信号机 - show = this.nameLevels.indexOf(1) !== -1; - const signalList = this.$store.getters['map/signalList']; + let nameShow = this.nameLevels.indexOf(1) !== -1; + let signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { - elem._type = deviceType.Signal; - elem.nameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow })); }); } // 按钮名称 - show = this.nameLevels.indexOf(3) !== -1; + let show = this.nameLevels.indexOf(3) !== -1; // 道岔 - const switchList = this.$store.getters['map/switchList']; + nameShow = this.nameLevels.indexOf(7) !== -1; // 道岔名称 + let switchSectionNameShow = this.nameLevels.indexOf(9) !== -1; // 道岔轨名称 + let switchList = this.$store.getters['map/switchList']; if (switchList && switchList.length > 0) { switchList.forEach(elem => { - elem._type = deviceType.Switch; - // 道岔名称 - show = this.nameLevels.indexOf(7) !== -1; - elem.nameShow = show; - // 道岔轨名称 - show = this.nameLevels.indexOf(9) !== -1; - elem.switchSectionNameShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), {nameShow, switchSectionNameShow })); }); } // 控制模式 - show = this.nameLevels.indexOf(8) !== -1; - const control = this.$store.getters['map/stationControlList']; + let indicatorShow = this.nameLevels.indexOf(8) !== -1; + let control = this.$store.getters['map/stationControlList']; if (control && control.length > 0) { control.forEach(elem => { - elem._type = deviceType.StationControl; // 标识灯名称 - elem.indicatorShow = show; - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { indicatorShow })); }); } // 区段 - const sectionList = this.$store.getters['map/sectionList']; + nameShow = false; + let standTrackNameShow = false; + let reentryTrackNameShow = false; + let transferTrackNameShow = false; + let sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { elem._type = deviceType.Section; if (elem.isSwitchSection && elem.parentCode) { // 道岔轨的区段名称默认不显示 - elem.nameShow = false; + nameShow = false; } else { if (elem.type === '01') { // 计轴区段名称 - show = this.nameLevels.indexOf(11) !== -1; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(11) !== -1; } else if (elem.type === '02') { // 股道轨名称 - show = this.nameLevels.indexOf(5) !== -1; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(5) !== -1; } else if (elem.type === '03') { // 道岔区段名称 - show = this.nameLevels.indexOf(9) !== -1; - elem.nameShow = show; + nameShow = this.nameLevels.indexOf(9) !== -1; } } // 站台轨名称 if (elem.isStandTrack) { - show = this.nameLevels.indexOf(2) !== -1; - elem.standTrackNameShow = show; + standTrackNameShow = this.nameLevels.indexOf(2) !== -1; } // 折返轨名称 if (elem.isReentryTrack) { - show = this.nameLevels.indexOf(4) !== -1; - elem.reentryTrackNameShow = show; + reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1; } // 转换轨名称 if (elem.isTransferTrack) { - show = this.nameLevels.indexOf(6) !== -1; - elem.transferTrackNameShow = show; + transferTrackNameShow = this.nameLevels.indexOf(6) !== -1; } - deviceList.push(elem); + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); }); } // 车站 - show = this.nameLevels.indexOf(12) !== -1; - const stationList = this.$store.getters['map/stationList']; + let kmPostShow = this.nameLevels.indexOf(12) !== -1; + let stationList = this.$store.getters['map/stationList']; if (stationList && stationList.length > 0) { stationList.forEach(elem => { - elem._type = deviceType.Station; - // 公里标 - elem.kmPostShow = show; - deviceList.push(elem); - + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { kmPostShow })); // 公里标 }); } diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue index ab9c850ef..29a60083b 100644 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue @@ -156,17 +156,16 @@ }) }, setTrainDispaly() { + let updatlist = []; let trainList = this.$store.getters['training/viewTrainList']; if (trainList && trainList.length > 0) { - let planFormat = this.trainNameFormatBy(this.planMode); + let nameFormat = this.trainNameFormatBy(this.planMode); let nameFontSize = this.fontSize; trainList.forEach(elem => { - elem._type = deviceType.Train; - elem.nameFormat = planFormat; - elem.nameFontSize = nameFontSize; + updatlist.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), {nameFormat, nameFontSize })); }); - this.$store.dispatch('map/updateMapDevices', trainList); + this.$store.dispatch('map/updateMapDevices', updatlist); } }, trainNameFormatBy(mode) { From a02a948f17a2f3c0b3ab32c82700a2e8b07c3976 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Tue, 6 Aug 2019 18:42:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/config/skinStyle/bejing_01.js | 2 +- src/jmap/config/skinStyle/chengdu_03.js | 2 +- src/jmap/config/skinStyle/fuzhou_01.js | 2 +- src/jmap/map.js | 1 + src/jmap/shape/Section/ELimitLines.js | 4 ++-- src/jmap/shape/Switch/index.js | 29 ++++++++++++++++++++----- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/jmap/config/skinStyle/bejing_01.js b/src/jmap/config/skinStyle/bejing_01.js index ca6ccf40e..2d9456d28 100644 --- a/src/jmap/config/skinStyle/bejing_01.js +++ b/src/jmap/config/skinStyle/bejing_01.js @@ -308,7 +308,7 @@ class SkinStyle extends defaultStyle { monolockColor: '#870E10' // 道岔单锁颜色 }, core: { - legnth: 6 // 道岔单边长度 + length: 6 // 道岔单边长度 }, monolock: { // 道岔单锁配置 locationColor: '#870E10', // 道岔单锁定位颜色 (红色) diff --git a/src/jmap/config/skinStyle/chengdu_03.js b/src/jmap/config/skinStyle/chengdu_03.js index 948ee0cfc..3b2709cb0 100644 --- a/src/jmap/config/skinStyle/chengdu_03.js +++ b/src/jmap/config/skinStyle/chengdu_03.js @@ -302,7 +302,7 @@ class SkinStyle extends defaultStyle { monolockColor: '#FFFFFF' // 道岔单锁颜色 }, core: { - legnth: 6 // 道岔单边长度 + length: 6 // 道岔单边长度 }, monolock: { // 道岔单锁配置 locationColor: '#00FF00', // 道岔单锁'定位'颜色 (绿色) diff --git a/src/jmap/config/skinStyle/fuzhou_01.js b/src/jmap/config/skinStyle/fuzhou_01.js index f8feb794e..c89657be7 100644 --- a/src/jmap/config/skinStyle/fuzhou_01.js +++ b/src/jmap/config/skinStyle/fuzhou_01.js @@ -281,7 +281,7 @@ class SkinStyle extends defaultStyle { monolockColor: '#870E10' // 道岔单锁颜色 }, core: { - legnth: 6 // 道岔单边长度 + length: 6 // 道岔单边长度 }, block: { // 道岔封锁配置 nameBorderShow: true, // 道岔名称是否有包围框 显示 diff --git a/src/jmap/map.js b/src/jmap/map.js index cc929072f..4239aa7c6 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -213,6 +213,7 @@ class Jlmap { const sectionB = this.mapDevice[swch.sectionBCode]; const sectionC = this.mapDevice[swch.sectionCCode]; if (sectionA && sectionB && sectionC) { + swch['cutOff'] = sectionA.cutOff; swch['sectionAstatus'] = sectionA.status; swch['sectionBstatus'] = sectionB.status; swch['sectionCstatus'] = sectionC.status; diff --git a/src/jmap/shape/Section/ELimitLines.js b/src/jmap/shape/Section/ELimitLines.js index ef212fda4..6056db14d 100644 --- a/src/jmap/shape/Section/ELimitLines.js +++ b/src/jmap/shape/Section/ELimitLines.js @@ -32,7 +32,7 @@ import JTriangle from '../../utils/JTriangle'; // ctx.bezierCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`cpx2`], shape[`cpy2`], shape[`x2`], shape[`y2`]); // } // } else { -// const swPadding = model.style.Switch.core.legnth; // 定位和反位时区段距离岔芯的距离 +// const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 // var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 // const beg = Object.assign({}, model.points[0]); // const end = Object.assign({}, model.points[model.points.length - 1]); @@ -117,7 +117,7 @@ export default class ELimitLines extends Group { // const beg = Object.assign({}, model.points[0]); // const end = Object.assign({}, model.points[model.points.length - 1]); - const swPadding = model.style.Switch.core.legnth; // 定位和反位时区段距离岔芯的距离 + const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 const beg = Object.assign({}, model.points[0]); const end = Object.assign({}, model.points[model.points.length - 1]); diff --git a/src/jmap/shape/Switch/index.js b/src/jmap/shape/Switch/index.js index 497e0e7b8..c54510341 100644 --- a/src/jmap/shape/Switch/index.js +++ b/src/jmap/shape/Switch/index.js @@ -44,7 +44,7 @@ export default class Switch extends Group { let halfWidth = style.Section.line.width / 2; const switchWidth = style.Section.line.width + style.Section.line.beyondWidth*2 + 0.8; - const swPadding = style.Switch.core.legnth; + const swPadding = style.Switch.core.length; const directx = this.triangle.drictx; const directy = this.triangle.dricty; const direct = -this.triangle.drictx * this.triangle.dricty; @@ -213,8 +213,10 @@ export default class Switch extends Group { this.setSwitchCoreColor(this.style.backgroundColor); this.name.getNameText().stopAnimation(false); this.swCore.stopAnimation(false); - this.relocShelter.stopAnimation(false); - this.relocShelter.hide(); + if (!this.model.cutOff) { + this.relocShelter.stopAnimation(false); + this.relocShelter.hide(); + } this.releaseBackground.hide(); this.setHasTextBorder(0); } @@ -235,7 +237,7 @@ export default class Switch extends Group { this.locShelter.hide(); this.relocShelter.show(); this.setTextColor(this.style.Switch.text.inversionColor); - this.setSectionState(this.relocShelter.getSection(), 'fill', this.model.sectionAstatus); + this.setSectionState(this.relocShelter.getSection(), 'fill', this.model); } /** 失去*/ @@ -310,9 +312,20 @@ export default class Switch extends Group { } } - setSectionState(section, style, model) { + sectionCutOff(section) { + const lineWidth = this.style.Section.line.width + (this.model.sectionAstatus != '01' ? this.style.Section.line.beyondWidth : 0); if (section) { - switch (model) { + section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.style.backgroundColor } }, + { time: 2000, styles: { lineWidth: lineWidth } } + ]); + } + } + + setSectionState(section, style, state) { + if (section) { + switch (state.sectionAstatus) { case '00': break; case '01': /** 空闲*/ section.setStyle(style, this.style.Section.line.spareColor); @@ -347,6 +360,10 @@ export default class Switch extends Group { break; } } + + if (state.cutOff && !section.animators.length ) { + this.sectionCutOff(section); + } } setLocateType(model) { From 3751748979c077c124989af73b8602608e4e022b Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Wed, 7 Aug 2019 09:16:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9lz=20zc=20=E7=AD=89?= =?UTF-8?q?=E9=BC=A0=E6=A0=87=E4=BA=8B=E4=BB=B6=E7=BB=9F=E4=B8=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/shape/LcControl/EMouse.js | 42 +++++++++++-------------- src/jmap/shape/LcControl/index.js | 26 ++++----------- src/jmap/shape/LimitControl/EMouse.js | 41 +++++++++++------------- src/jmap/shape/LimitControl/index.js | 18 +++-------- src/jmap/shape/Signal/index.js | 8 ++--- src/jmap/shape/StationControl/EMouse.js | 30 +++++++++--------- src/jmap/shape/StationControl/index.js | 4 +-- src/jmap/shape/StationStand/index.js | 8 ++--- src/jmap/shape/ZcControl/EMouse.js | 41 +++++++++++------------- src/jmap/shape/ZcControl/index.js | 16 ++-------- 10 files changed, 89 insertions(+), 145 deletions(-) diff --git a/src/jmap/shape/LcControl/EMouse.js b/src/jmap/shape/LcControl/EMouse.js index 34ebf52ab..888078973 100644 --- a/src/jmap/shape/LcControl/EMouse.js +++ b/src/jmap/shape/LcControl/EMouse.js @@ -10,7 +10,6 @@ export default class EMouse extends Group { } create() { this.text = new Text({ - _subType: 'Text', zlevel: this.device.zlevel, z: this.device.z+1, position: [0, 0], @@ -29,32 +28,27 @@ export default class EMouse extends Group { this.add(this.text); this.text.hide(); } - mouseoverText(e) { - this.text.show(); - } - - mouseoutText(e) { - if (!this.down) { - this.text.hide(); + mouseover(e) { + if (e.target && e.target._subType == 'Text') { + this.text.show(); + } else { + this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); + this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); + this.device.control.setTextBorder(true); + this.device.control.setArcBorder(true); } } - mouseoverArc(e) { - this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - mouseoutArc(e) { - if (!this.down) { - this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } mouseout(e) { - this.mouseoutText(e); - this.mouseoutArc(e); + if (!this.down) { + if (e.target && e.target._subType == 'Text') { + this.text.hide(); + } else { + this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); + this.device.control.setTextColor('#FFFFFF'); + this.device.control.setTextBorder(false); + this.device.control.setArcBorder(false); + } + } } } diff --git a/src/jmap/shape/LcControl/index.js b/src/jmap/shape/LcControl/index.js index 1cf1dfddd..985bea40d 100644 --- a/src/jmap/shape/LcControl/index.js +++ b/src/jmap/shape/LcControl/index.js @@ -14,8 +14,9 @@ export default class LcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.createMouseEvent(); this.create(); + this.createMouseEvent(); + this.setState(model); } create() { @@ -30,9 +31,7 @@ export default class LcControl extends Group { r: this.style.LcControl.lamp.radiusR }, lineWidth: 0, - fill: this.style.LcControl.lamp.controlColor, - mouseover: this.mouseoverArc, - mouseout: this.mouseoutArc + fill: this.style.LcControl.lamp.controlColor }, text: { position: [0, 0], @@ -44,15 +43,12 @@ export default class LcControl extends Group { text: model.name, textFill: '#fff', textAlign: 'middle', - textVerticalAlign: 'top', - mouseover: this.mouseoverText, - mouseout: this.mouseoutText + textVerticalAlign: 'top' }, style: this.style }); this.add(this.control); - this.setState(model); } // 设置状态 @@ -63,18 +59,8 @@ export default class LcControl extends Group { if (this.style.LcControl.mouseOverStyle) { this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.mouseoverText = (e) => { - this.mouseEvent.mouseoverText(e); - }; - this.mouseoutText = (e) => { - this.mouseEvent.mouseoutText(e); - }; - this.mouseoverArc = (e) => { - this.mouseEvent.mouseoverArc(e); - }; - this.mouseoutArc = (e) => { - this.mouseEvent.mouseoutArc(e); - }; + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } diff --git a/src/jmap/shape/LimitControl/EMouse.js b/src/jmap/shape/LimitControl/EMouse.js index 1c69b4dae..c3059f84a 100644 --- a/src/jmap/shape/LimitControl/EMouse.js +++ b/src/jmap/shape/LimitControl/EMouse.js @@ -29,32 +29,27 @@ export default class EMouse extends Group { this.add(this.text); this.text.hide(); } - mouseoverText(e) { - this.text.show(); - } - - mouseoutText(e) { - if (!this.down) { - this.text.hide(); + mouseover(e) { + if (e.target && e.target._subType == 'Text') { + this.text.show(); + } else { + this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor); + this.device.control.setTextColor(this.device.style.LimitControl.mouseOverStyle.textColor); + this.device.control.setTextBorder(true); + this.device.control.setArcBorder(true); } } - mouseoverArc(e) { - this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.LimitControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - mouseoutArc(e) { - if (!this.down) { - this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } mouseout(e) { - this.mouseoutText(e); - this.mouseoutArc(e); + if (!this.down) { + if (e.target && e.target._subType == 'Text') { + this.text.hide(); + } else { + this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor); + this.device.control.setTextColor('#FFFFFF'); + this.device.control.setTextBorder(false); + this.device.control.setArcBorder(false); + } + } } } diff --git a/src/jmap/shape/LimitControl/index.js b/src/jmap/shape/LimitControl/index.js index 22ac626c4..cc2bf0d94 100644 --- a/src/jmap/shape/LimitControl/index.js +++ b/src/jmap/shape/LimitControl/index.js @@ -15,8 +15,9 @@ export default class LimitControl extends Group { this.model = model; this.style = style; this.z = 20; - this.createMouseEvent(); this.create(model); + this.createMouseEvent(); + this.setState(model); } create(model) { @@ -52,7 +53,6 @@ export default class LimitControl extends Group { }); this.add(this.control); - this.setState(this.model); } // 设置状态 @@ -63,18 +63,8 @@ export default class LimitControl extends Group { if (this.style.LimitControl.mouseOverStyle) { this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.mouseoverText = (e) => { - this.mouseEvent.mouseoverText(e); - }; - this.mouseoutText = (e) => { - this.mouseEvent.mouseoutText(e); - }; - this.mouseoverArc = (e) => { - this.mouseEvent.mouseoverArc(e); - }; - this.mouseoutArc = (e) => { - this.mouseEvent.mouseoutArc(e); - }; + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } diff --git a/src/jmap/shape/Signal/index.js b/src/jmap/shape/Signal/index.js index 250f1114f..aac0c0488 100644 --- a/src/jmap/shape/Signal/index.js +++ b/src/jmap/shape/Signal/index.js @@ -162,12 +162,8 @@ class Signal extends Group { if (this.style.Signal.mouseOverStyle) { this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.onmouseover = (e) => { - this.mouseEvent.mouseover(e); - }; - this.onmouseout = (e) => { - this.mouseEvent.mouseout(e); - }; + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } diff --git a/src/jmap/shape/StationControl/EMouse.js b/src/jmap/shape/StationControl/EMouse.js index 1c0905ca4..ba4d567b6 100644 --- a/src/jmap/shape/StationControl/EMouse.js +++ b/src/jmap/shape/StationControl/EMouse.js @@ -36,21 +36,23 @@ export default class EMouse extends Group { } } mouseover(e) { - let name = ''; - switch (e.target.parent._subType) { - case 'emergency': - name = '紧急站控'; - break; - case 'center': - name = '中控'; - break; - case 'substation': - name = '站控'; - break; + if (e.target) { + let name = ''; + switch (e.target.parent._subType) { + case 'emergency': + name = '紧急站控'; + break; + case 'center': + name = '中控'; + break; + case 'substation': + name = '站控'; + break; + } + // debugger; + this.setTextContext(name); + this.text.show(); } - // debugger; - this.setTextContext(name); - this.text.show(); } mouseout(e) { diff --git a/src/jmap/shape/StationControl/index.js b/src/jmap/shape/StationControl/index.js index c76c3a9cc..5ca2f669b 100644 --- a/src/jmap/shape/StationControl/index.js +++ b/src/jmap/shape/StationControl/index.js @@ -142,8 +142,8 @@ export default class StationControl extends Group { if (this.style.ZcControl.mouseOverStyle) { this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.onmouseover = (e) => { this.mouseEvent.mouseover(e); }; - this.onmouseout = (e) => { this.mouseEvent.mouseout(e); }; + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } getShapeTipPoint() { diff --git a/src/jmap/shape/StationStand/index.js b/src/jmap/shape/StationStand/index.js index ea827fb39..f8e15a6ed 100644 --- a/src/jmap/shape/StationStand/index.js +++ b/src/jmap/shape/StationStand/index.js @@ -169,12 +169,8 @@ class StationStand extends Group { if (this.style.StationStand.mouseOverStyle) { this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.onmouseover = (e) => { - this.mouseEvent.mouseover(e); - }; - this.onmouseout = (e) => { - this.mouseEvent.mouseout(e); - }; + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } diff --git a/src/jmap/shape/ZcControl/EMouse.js b/src/jmap/shape/ZcControl/EMouse.js index 17e5fdaf0..4326ec949 100644 --- a/src/jmap/shape/ZcControl/EMouse.js +++ b/src/jmap/shape/ZcControl/EMouse.js @@ -29,32 +29,27 @@ export default class EMouse extends Group { this.add(this.text); this.text.hide(); } - mouseoverText(e) { - this.text.show(); - } - - mouseoutText(e) { - if (!this.down) { - this.text.hide(); + mouseover(e) { + if (e.target && e.target._subType == 'Text') { + this.text.show(); + } else { + this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor); + this.device.control.setTextColor(this.device.style.ZcControl.mouseOverStyle.textColor); + this.device.control.setTextBorder(true); + this.device.control.setArcBorder(true); } } - mouseoverArc(e) { - this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.ZcControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - mouseoutArc(e) { - if (!this.down) { - this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } mouseout(e) { - this.mouseoutText(e); - this.mouseoutArc(e); + if (!this.down) { + if (e.target && e.target._subType == 'Text') { + this.text.hide(); + } else { + this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor); + this.device.control.setTextColor('#FFFFFF'); + this.device.control.setTextBorder(false); + this.device.control.setArcBorder(false); + } + } } } diff --git a/src/jmap/shape/ZcControl/index.js b/src/jmap/shape/ZcControl/index.js index 0c3d7f8ab..425016973 100644 --- a/src/jmap/shape/ZcControl/index.js +++ b/src/jmap/shape/ZcControl/index.js @@ -14,8 +14,8 @@ export default class ZcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.createMouseEvent(); this.create(model); + this.createMouseEvent(); this.setState(model); } @@ -62,18 +62,8 @@ export default class ZcControl extends Group { if (this.style.ZcControl.mouseOverStyle) { this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.mouseoverText = (e) => { - this.mouseEvent.mouseoverText(e); - }; - this.mouseoutText = (e) => { - this.mouseEvent.mouseoutText(e); - }; - this.mouseoverArc = (e) => { - this.mouseEvent.mouseoverArc(e); - }; - this.mouseoutArc = (e) => { - this.mouseEvent.mouseoutArc(e); - }; + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } getShapeTipPoint() { From e3a8d5c5258851a706c7b30a25d8be7d5bb53adb Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Wed, 7 Aug 2019 10:24:13 +0800 Subject: [PATCH 4/5] =?UTF-8?q?desc:=20=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/map.js | 6 +- src/jmap/mouseController.js | 32 ++++++--- src/jmap/shape/Section/EMouse.js | 4 +- src/jmap/shape/Signal/EMouse.js | 3 +- src/jmap/shape/Train/TrainBody/ArrowText.js | 36 ---------- src/jmap/shape/Train/TrainBody/EMouse.js | 49 ++++++++++++++ src/jmap/shape/Train/TrainBody/index.js | 65 +++++++------------ src/store/modules/map.js | 2 +- .../mapdraft/mapedit/mapoperate/lcControl.vue | 1 - .../mapedit/mapoperate/limitControl.vue | 1 - .../mapdraft/mapedit/mapoperate/zcControl.vue | 1 - 11 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 src/jmap/shape/Train/TrainBody/ArrowText.js create mode 100644 src/jmap/shape/Train/TrainBody/EMouse.js diff --git a/src/jmap/map.js b/src/jmap/map.js index dd9447a85..cc929072f 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -234,16 +234,12 @@ class Jlmap { this.$painter.delete(oDevice); } else { const nDevice = Object.assign(oDevice, this.hookHandle(elem)); - if (nDevice.id == '5888') { - console.log(oDevice, nDevice); - debugger; - } this.$painter.update(nDevice); } }); // 状态后处理 - // this.postHandle(list); + this.postHandle(list); if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); } } diff --git a/src/jmap/mouseController.js b/src/jmap/mouseController.js index e2cc9f869..c4c095ceb 100644 --- a/src/jmap/mouseController.js +++ b/src/jmap/mouseController.js @@ -1,6 +1,7 @@ import deviceType from './constant/deviceType'; import Eventful from 'zrender/src/mixin/Eventful'; import * as eventTool from 'zrender/src/core/event'; +import store from '@/store'; class EventModel { constructor(e) { @@ -149,7 +150,16 @@ class MouseController extends Eventful { } moveEvent(e) { - return new EventModel(e); + const newEm = new EventModel(e); + const trainDetails = store.state.map.trainDetails; + if (trainDetails && trainDetails.model) { + if (newEm.deviceType != deviceType.Train || trainDetails.model._code != newEm.deviceCode) { + var model = trainDetails.model; + var instances = (this._viewRepo.__getViewInstancesByDeviceType(deviceType.Train) || {})._instances || {}; + var device = instances[model._code] || {}; + device.removeTrainDetail && device.removeTrainDetail(); + } + } } checkEvent(e) { @@ -157,22 +167,24 @@ class MouseController extends Eventful { var newEm = new EventModel(e); if ([1, 3].includes(e.which)) { // 查找之前和当前鼠标选中的实例 - var oldDevice = (this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}).instance || {}; - var newDevice = (this.$jmap.getDeviceByCode(newEm.deviceCode) || {}).instance || {}; + var oldDevice = this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}; + var newDevice = this.$jmap.getDeviceByCode(newEm.deviceCode) || {}; + var oldInstance = (this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}).instance || {}; + var newInstance = (this.$jmap.getDeviceByCode(newEm.deviceCode) || {}).instance || {}; // 如果之前和当前选中的实例不一致 - if (oldDevice != newDevice) { + if (oldInstance != newInstance) { // 如果实例有取消选择函数并且被点击,则执行取消选中函数 - if (oldDevice.mouseEvent && oldDevice.mouseEvent.mouseout) { + if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) { // 视图数据设置点击标志,同步执行 - oldDevice.mouseEvent['down'] = false; - oldDevice.mouseEvent['mouseout'](e); + oldDevice['down'] = false; + oldInstance.mouseEvent['mouseout'](e); } // 如果实例有选中函数并且被点击,则执行选中函数 - if (e.which == 3 && newDevice.mouseEvent && newDevice.mouseEvent.mouseover) { - newDevice.mouseEvent['down'] = true; - newDevice.mouseEvent['mouseover'](e); + if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) { + newDevice['down'] = true; + newInstance.mouseEvent['mouseover'](e); } } diff --git a/src/jmap/shape/Section/EMouse.js b/src/jmap/shape/Section/EMouse.js index be2e5886d..d97f5eb11 100644 --- a/src/jmap/shape/Section/EMouse.js +++ b/src/jmap/shape/Section/EMouse.js @@ -6,7 +6,6 @@ import store from '@/store'; class EMouse extends Group { constructor(device, code) { super(); - this.down = false; this.device = device; this.code = code; this.create(); @@ -90,7 +89,6 @@ class EMouse extends Group { } mouseover(e) { - debugger; if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { const instance = this.getInstanceByCode(this.device.model.relSwitchCode); if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { @@ -108,7 +106,7 @@ class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { this.sectionTextShadow && this.sectionTextShadow.hide(); if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { const instance = this.getInstanceByCode(this.device.model.relSwitchCode); diff --git a/src/jmap/shape/Signal/EMouse.js b/src/jmap/shape/Signal/EMouse.js index 8f574980e..dbc9c924e 100644 --- a/src/jmap/shape/Signal/EMouse.js +++ b/src/jmap/shape/Signal/EMouse.js @@ -7,7 +7,6 @@ export default class EMouse extends Group { this.device = device; this.zlevel = device.zlevel; this.style = device.style; - this.down = false; this.create(); } @@ -52,7 +51,7 @@ export default class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { this.nameRect.hide(); this.lampRect.hide(); this.device.lamps.forEach(elem => { diff --git a/src/jmap/shape/Train/TrainBody/ArrowText.js b/src/jmap/shape/Train/TrainBody/ArrowText.js deleted file mode 100644 index 517bff0b1..000000000 --- a/src/jmap/shape/Train/TrainBody/ArrowText.js +++ /dev/null @@ -1,36 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; -/** 文字描述 */ -class ArrowText extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - create() { - this.arrowText = new Text({ - zlevel: this.model.zlevel, - z: this.model.z+1, - position: [0, 0], - style: { - x: this.model.x, - y: this.model.y, - text: this.model.text, - textFill: this.model.textFill, - textAlign: this.model.textAlign, - textFont: this.model.textFont, - textPadding: this.model.textPadding, - textBackgroundColor: '#FFFF00' - } - }); - this.add(this.arrowText); - this.arrowText.hide(); - } - setShapeStyle(key, style) { - this.arrowText.setStyle(key, style); - } - getArrowText() { - return this.arrowText; - } -} -export default ArrowText; diff --git a/src/jmap/shape/Train/TrainBody/EMouse.js b/src/jmap/shape/Train/TrainBody/EMouse.js new file mode 100644 index 000000000..194c95f06 --- /dev/null +++ b/src/jmap/shape/Train/TrainBody/EMouse.js @@ -0,0 +1,49 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +class EMouse extends Group { + constructor(device, style) { + super(); + this.down = false; + this.device = device; + this.create(); + } + create() { + let destinationText = ''; + switch (this.device.destinationStatus) { + case '01': destinationText = '准点'; break; + case '02': destinationText = '早点'; break; + case '03': destinationText = '严重早点'; break; + case '04': destinationText = '晚点'; break; + case '05': destinationText = '严重晚点'; break; + default: destinationText = '未知'; break; + } + // 文字描述 + this.arrowText = new Text({ + zlevel: this.device.zlevel, + z: this.device.z, + style: { + x: this.device.point.x + 50, + y: this.device.point.y + 25, + text: `列车类型: 计划车\n表\0\0\0\0号: ${this.device.serviceNumber}\n车\0次\0号: ${this.device.tripNumber}\n目的地号: ${this.device.targetCode ? this.device.targetCode : ''}\n车\0组\0号: ${this.device.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${this.device.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.sectionModel ? this.device.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.runControlStatus == '01' ? '正常' : this.device.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${this.device.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.speed || 0} km/h\n列车移动授权距离: ${this.device.maLen || 0} m`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: this.device.style.tipBackgroundColor + } + }); + this.add(this.arrowText); + this.arrowText.hide(); + } + + mouseover() { + this.arrowText.show(); + } + + mouseout() { + this.arrowText.hide(); + } + +} +export default EMouse; diff --git a/src/jmap/shape/Train/TrainBody/index.js b/src/jmap/shape/Train/TrainBody/index.js index bbcf7d216..7a7d2ccb8 100644 --- a/src/jmap/shape/Train/TrainBody/index.js +++ b/src/jmap/shape/Train/TrainBody/index.js @@ -1,5 +1,4 @@ import Group from 'zrender/src/container/Group'; -import ArrowText from './ArrowText'; import Train from './Train'; import '../../StationStand/EDetain'; import TextHSDA from './TextHSDA'; @@ -7,12 +6,30 @@ import TextTrainServer from './TextTrainServer'; import TextTrainTarget from './TextTrainTarget'; import TextTrainNumber from './TextTrainNumber'; import TextTrainTargetNumber from './TextTrainTargetNumber'; +import EMouse from './EMouse'; +import store from '@/store'; + /** 车身*/ export default class TrainBody extends Group { constructor(model) { super(); this.model = model; this.create(); + console.log(this.model); + this.createMouse(); // 鼠标事件 + } + + createMouse() { + this.mouseEvent = new EMouse(this.model); + this.add(this.mouseEvent); + this.on('mouseover', () => { + store.dispatch('map/setTrainDetails', true); + this.mouseEvent.mouseover(); + }); + this.on('mouseout', () => { + store.dispatch('map/setTrainDetails', null); + this.mouseEvent.mouseout(); + }); } create() { @@ -21,28 +38,6 @@ export default class TrainBody extends Group { const textFont = model.fontSize + 'px ' + style.Train.common.fontFamily; const TextFontHSDA = style.Train.hsda.trainHSDATextFontSize + 'px ' + style.Train.common.fontFamily; - let destinationText = ''; - switch (model.destinationStatus) { - case '01': destinationText = '准点'; break; - case '02': destinationText = '早点'; break; - case '03': destinationText = '严重早点'; break; - case '04': destinationText = '晚点'; break; - case '05': destinationText = '严重晚点'; break; - default: destinationText = '未知'; break; - } - const textContain = `列车类型: 计划车\n表\0\0\0\0号: ${model.serviceNumber}\n车\0次\0号: ${model.tripNumber}\n目的地号: ${model.targetCode ? model.targetCode : ''}\n车\0组\0号: ${model.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.sectionModel ? model.sectionModel.name : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.runControlStatus == '01' ? '正常' : model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.speed || 0} km/h\n列车移动授权距离: ${model.maLen || 0} m`; - this.arrowText = style.Train.common.haveArrowText ? new ArrowText({ - zlevel: model.zlevel, - z: model.z, - x: model.point.x+50, - y: model.point.y+25, - text: textContain, - textFill: '#000', - textAlign: 'left', - textFont: style.arrowFontSize + 'px consolas', - textPadding: 3, - textBackgroundColor: style.tipBackgroundColor - }) : ''; this.train = new Train({ zlevel: model.zlevel, z: model.z, @@ -57,10 +52,7 @@ export default class TrainBody extends Group { stroke: style.trainSidelineColor, fill: style.Train.trainBody.trainBodyFillColor }, - cursor: 'pointer', - arrowText: this.arrowText, - onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.train?this.arrowText.getArrowText().show():''; }, - onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.train?this.arrowText.getArrowText().hide():''; } + cursor: 'pointer' }); const beginX = (model.point.x + style.Train.trainBody.lrPadding); @@ -93,9 +85,7 @@ export default class TrainBody extends Group { style: style, serviceNumber: serviceNumber, trainBrownColor: style.trainTextColor, - textFont: textFont, - onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainServer?this.arrowText.getArrowText().show():''; }, - onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainServer?this.arrowText.getArrowText().hide():''; } + textFont: textFont }); this.textTrainTarget = new TextTrainTarget({ @@ -106,9 +96,7 @@ export default class TrainBody extends Group { style: style, tripNumber: tripNumber, trainYellowColor: style.trainTextColor, - textFont: textFont, - onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainTarget?this.arrowText.getArrowText().show():''; }, - onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainTarget?this.arrowText.getArrowText().hide():''; } + textFont: textFont }); this.textTrainNumber = new TextTrainNumber({ @@ -119,9 +107,7 @@ export default class TrainBody extends Group { upPadding: style.Train.trainBody.upPadding, targetCode: targetCode, trainTextColor: style.trainTextColor, - textFont: textFont, - onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainNumber?this.arrowText.getArrowText().show():''; }, - onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainNumber?this.arrowText.getArrowText().hide():''; } + textFont: textFont }); this.textTrainTargetNumber = new TextTrainTargetNumber({ @@ -132,9 +118,7 @@ export default class TrainBody extends Group { upPadding: style.Train.upPadding, groupNumber: groupNumber, trainTextColor: style.trainTextColor, - textFont: textFont, - onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainTargetNumber?this.arrowText.getArrowText().show():''; }, - onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainTargetNumber?this.arrowText.getArrowText().hide():''; } + textFont: textFont }); // 根据列车类型设置显示格式 if ( style.Train.trainBody.specialTrainType.length > 0) { @@ -153,7 +137,8 @@ export default class TrainBody extends Group { } removeTrainDetail() { - this.remove(this.arrowText); + this.mouseEvent.mouseout(); + store.dispatch('map/setTrainDetails', null); } setTrainColor(color) { this.train && this.train.setColor('fill', color); diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 485cd1460..2df70f5b4 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -193,7 +193,7 @@ const map = { mapList: {}, // 地图数据列表 mapViewLoadedCount: 0, // 地图视图加载完成标识 mapDataLoadedCount: 0, // 地图数据加载完成标识 - trainDetails: null // 列车详情显示 + trainDetails: null // 地图'列车详情'显示 }, getters: { diff --git a/src/views/map/mapdraft/mapedit/mapoperate/lcControl.vue b/src/views/map/mapdraft/mapedit/mapoperate/lcControl.vue index aef914ec4..b1ac0a83f 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/lcControl.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/lcControl.vue @@ -137,7 +137,6 @@ export default { computed: { ...mapGetters('map', [ 'sectionList', - 'trainList', 'trainModelList', 'lcList', 'skinStyle' diff --git a/src/views/map/mapdraft/mapedit/mapoperate/limitControl.vue b/src/views/map/mapdraft/mapedit/mapoperate/limitControl.vue index db7301e7a..3defff7f4 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/limitControl.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/limitControl.vue @@ -137,7 +137,6 @@ export default { computed: { ...mapGetters('map', [ 'sectionList', - 'trainList', 'trainModelList', 'tempSpeedLimitList', 'skinStyle' diff --git a/src/views/map/mapdraft/mapedit/mapoperate/zcControl.vue b/src/views/map/mapdraft/mapedit/mapoperate/zcControl.vue index 395009a3c..a372ed602 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/zcControl.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/zcControl.vue @@ -88,7 +88,6 @@ export default { computed: { ...mapGetters('map', [ 'sectionList', - 'trainList', 'trainModelList', 'zcList', 'skinStyle' From 83faa429fe1ba7d0a2ab4f5df75ef390cd16ebf1 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Wed, 7 Aug 2019 11:22:33 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=97=E8=BD=A6?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/map.js | 16 ++++++++++++---- src/jmap/mouseController.js | 10 ++++------ src/jmap/shape/LcControl/EMouse.js | 3 +-- src/jmap/shape/LimitControl/EMouse.js | 3 +-- src/jmap/shape/StationControl/EMouse.js | 3 +-- src/jmap/shape/StationStand/EMouse.js | 3 +-- src/jmap/shape/Switch/EMouse.js | 3 +-- src/jmap/shape/Train/TrainBody/EMouse.js | 23 +++++++++++++---------- src/jmap/shape/Train/TrainBody/index.js | 12 +++++++++--- src/jmap/shape/Train/index.js | 3 ++- src/jmap/shape/ZcControl/EMouse.js | 3 +-- 11 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/jmap/map.js b/src/jmap/map.js index 4239aa7c6..279952985 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -166,7 +166,7 @@ class Jlmap { } // 中间处理 - hookHandle(elem) { + hookHandle(oDevice, elem) { const code = elem.code; const type = elem._type; // 如果是延时计时,需要保存计数值到全局 @@ -179,7 +179,14 @@ class Jlmap { localStore(code, val); } - return elem; + for (var prop in elem) { + if (elem[prop] != oDevice[prop]) { + Object.assign(oDevice, elem); + return true; + } + } + + return false; } // 后处理 @@ -234,8 +241,9 @@ class Jlmap { if (elem.dispose) { this.$painter.delete(oDevice); } else { - const nDevice = Object.assign(oDevice, this.hookHandle(elem)); - this.$painter.update(nDevice); + if (this.hookHandle(oDevice, elem)) { + this.$painter.update(oDevice); + } } }); diff --git a/src/jmap/mouseController.js b/src/jmap/mouseController.js index c4c095ceb..e6e07b95d 100644 --- a/src/jmap/mouseController.js +++ b/src/jmap/mouseController.js @@ -152,12 +152,10 @@ class MouseController extends Eventful { moveEvent(e) { const newEm = new EventModel(e); const trainDetails = store.state.map.trainDetails; - if (trainDetails && trainDetails.model) { - if (newEm.deviceType != deviceType.Train || trainDetails.model._code != newEm.deviceCode) { - var model = trainDetails.model; - var instances = (this._viewRepo.__getViewInstancesByDeviceType(deviceType.Train) || {})._instances || {}; - var device = instances[model._code] || {}; - device.removeTrainDetail && device.removeTrainDetail(); + if (trainDetails) { + if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) { + var instance = (this.$jmap.getDeviceByCode(trainDetails.code) || {} ).instance; + instance && instance.removeTrainDetail && instance.removeTrainDetail(); } } } diff --git a/src/jmap/shape/LcControl/EMouse.js b/src/jmap/shape/LcControl/EMouse.js index 888078973..fdb639e95 100644 --- a/src/jmap/shape/LcControl/EMouse.js +++ b/src/jmap/shape/LcControl/EMouse.js @@ -5,7 +5,6 @@ export default class EMouse extends Group { constructor(device) { super(); this.device = device; - this.down = false; this.create(); } create() { @@ -40,7 +39,7 @@ export default class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { if (e.target && e.target._subType == 'Text') { this.text.hide(); } else { diff --git a/src/jmap/shape/LimitControl/EMouse.js b/src/jmap/shape/LimitControl/EMouse.js index c3059f84a..4abd12d5d 100644 --- a/src/jmap/shape/LimitControl/EMouse.js +++ b/src/jmap/shape/LimitControl/EMouse.js @@ -5,7 +5,6 @@ export default class EMouse extends Group { constructor(device) { super(); this.device = device; - this.down = false; this.create(); } create() { @@ -41,7 +40,7 @@ export default class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { if (e.target && e.target._subType == 'Text') { this.text.hide(); } else { diff --git a/src/jmap/shape/StationControl/EMouse.js b/src/jmap/shape/StationControl/EMouse.js index ba4d567b6..8850a1e30 100644 --- a/src/jmap/shape/StationControl/EMouse.js +++ b/src/jmap/shape/StationControl/EMouse.js @@ -5,7 +5,6 @@ export default class EMouse extends Group { constructor(device) { super(); this.device = device; - this.down = false; this.create(); } create() { @@ -56,7 +55,7 @@ export default class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { this.text.hide(); } } diff --git a/src/jmap/shape/StationStand/EMouse.js b/src/jmap/shape/StationStand/EMouse.js index 40e191f29..ecf66d1c9 100644 --- a/src/jmap/shape/StationStand/EMouse.js +++ b/src/jmap/shape/StationStand/EMouse.js @@ -7,7 +7,6 @@ export default class EMouse extends Group { this.device = device; this.zlevel = device.zlevel; this.style = device.style; - this.down = false; this.create(); } @@ -32,7 +31,7 @@ export default class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { this.border.hide(); } } diff --git a/src/jmap/shape/Switch/EMouse.js b/src/jmap/shape/Switch/EMouse.js index dcfb31d0a..89b6e57fa 100644 --- a/src/jmap/shape/Switch/EMouse.js +++ b/src/jmap/shape/Switch/EMouse.js @@ -4,7 +4,6 @@ import store from '@/store'; class EMouse extends Group { constructor(device) { super(); - this.down = false; this.device = device; this.create(); this.craeteSwitchBorder(); @@ -73,7 +72,7 @@ class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { this.switchBorder && this.switchBorder.hide(); this.device.setTextStyle({ textFill: this.device.style.backgroundColor diff --git a/src/jmap/shape/Train/TrainBody/EMouse.js b/src/jmap/shape/Train/TrainBody/EMouse.js index 194c95f06..1279457ad 100644 --- a/src/jmap/shape/Train/TrainBody/EMouse.js +++ b/src/jmap/shape/Train/TrainBody/EMouse.js @@ -2,15 +2,14 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; class EMouse extends Group { - constructor(device, style) { + constructor(device) { super(); - this.down = false; this.device = device; this.create(); } create() { let destinationText = ''; - switch (this.device.destinationStatus) { + switch (this.device.model.destinationStatus) { case '01': destinationText = '准点'; break; case '02': destinationText = '早点'; break; case '03': destinationText = '严重早点'; break; @@ -20,17 +19,17 @@ class EMouse extends Group { } // 文字描述 this.arrowText = new Text({ - zlevel: this.device.zlevel, - z: this.device.z, + zlevel: this.device.model.zlevel, + z: this.device.model.z, style: { - x: this.device.point.x + 50, - y: this.device.point.y + 25, - text: `列车类型: 计划车\n表\0\0\0\0号: ${this.device.serviceNumber}\n车\0次\0号: ${this.device.tripNumber}\n目的地号: ${this.device.targetCode ? this.device.targetCode : ''}\n车\0组\0号: ${this.device.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${this.device.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.sectionModel ? this.device.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.runControlStatus == '01' ? '正常' : this.device.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${this.device.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.speed || 0} km/h\n列车移动授权距离: ${this.device.maLen || 0} m`, + x: this.device.model.point.x + 50, + y: this.device.model.point.y + 25, + text: `列车类型: 计划车\n表\0\0\0\0号: ${this.device.model.serviceNumber}\n车\0次\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.targetCode ? this.device.model.targetCode : ''}\n车\0组\0号: ${this.device.model.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${this.device.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? this.device.model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.model.runControlStatus == '01' ? '正常' : this.device.model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${this.device.model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m`, textFill: '#000', textAlign: 'letf', textFont: 10 + 'px consolas', textPadding: 3, - textBackgroundColor: this.device.style.tipBackgroundColor + textBackgroundColor: this.device.model.style.tipBackgroundColor } }); this.add(this.arrowText); @@ -38,11 +37,15 @@ class EMouse extends Group { } mouseover() { + this.device.deviceModel.down = true; this.arrowText.show(); } mouseout() { - this.arrowText.hide(); + if (this.device.deviceModel.down) { + this.arrowText.hide(); + this.device.deviceModel.down = false; + } } } diff --git a/src/jmap/shape/Train/TrainBody/index.js b/src/jmap/shape/Train/TrainBody/index.js index 7a7d2ccb8..03c58f204 100644 --- a/src/jmap/shape/Train/TrainBody/index.js +++ b/src/jmap/shape/Train/TrainBody/index.js @@ -14,16 +14,21 @@ export default class TrainBody extends Group { constructor(model) { super(); this.model = model; + this.deviceModel = model.model; this.create(); - console.log(this.model); this.createMouse(); // 鼠标事件 } createMouse() { - this.mouseEvent = new EMouse(this.model); + this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); + if (this.deviceModel.down) { + store.dispatch('map/setTrainDetails', this.deviceModel); + this.mouseEvent.mouseover(); + } + this.on('mouseover', () => { - store.dispatch('map/setTrainDetails', true); + store.dispatch('map/setTrainDetails', this.deviceModel); this.mouseEvent.mouseover(); }); this.on('mouseout', () => { @@ -139,6 +144,7 @@ export default class TrainBody extends Group { removeTrainDetail() { this.mouseEvent.mouseout(); store.dispatch('map/setTrainDetails', null); + this.deviceModel.down = false; } setTrainColor(color) { this.train && this.train.setColor('fill', color); diff --git a/src/jmap/shape/Train/index.js b/src/jmap/shape/Train/index.js index 729343d18..85cf3af96 100644 --- a/src/jmap/shape/Train/index.js +++ b/src/jmap/shape/Train/index.js @@ -69,7 +69,8 @@ export default class Train extends Group { fontSize: this.fontSize, type: model.type, speed: model.speed, - maLen: model.maLen + maLen: model.maLen, + model: model }); this.trainL = new TrainHead({ style: style, diff --git a/src/jmap/shape/ZcControl/EMouse.js b/src/jmap/shape/ZcControl/EMouse.js index 4326ec949..0855053f9 100644 --- a/src/jmap/shape/ZcControl/EMouse.js +++ b/src/jmap/shape/ZcControl/EMouse.js @@ -5,7 +5,6 @@ export default class EMouse extends Group { constructor(device) { super(); this.device = device; - this.down = false; this.create(); } create() { @@ -41,7 +40,7 @@ export default class EMouse extends Group { } mouseout(e) { - if (!this.down) { + if (!this.device.model.down) { if (e.target && e.target._subType == 'Text') { this.text.hide(); } else {