diff --git a/src/iscs/iscs.js b/src/iscs/iscs.js index af5593417..a6e5cb1df 100644 --- a/src/iscs/iscs.js +++ b/src/iscs/iscs.js @@ -182,49 +182,49 @@ class Iscs { const code = elem.code; if (elem.deviceType === 'IBP') { if (this.iscsDevice['IscsCircle_20']) { - elem.upStatus.operate ? this.iscsDevice['IscsCircle_20'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_20'].model.fillColor = '#008DCE'; + elem.upStatus.operate ? this.iscsDevice['IscsCircle_20'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_20'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_20']); } if (this.iscsDevice['IscsCircle_17']) { - elem.upStatus.openCommand ? this.iscsDevice['IscsCircle_17'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_17'].model.fillColor = '#008DCE'; + elem.upStatus.openCommand ? this.iscsDevice['IscsCircle_17'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_17'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_17']); } if (this.iscsDevice['IscsCircle_18']) { - elem.upStatus.openSideCommand ? this.iscsDevice['IscsCircle_18'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_18'].model.fillColor = '#008DCE'; + elem.upStatus.openSideCommand ? this.iscsDevice['IscsCircle_18'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_18'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_18']); } if (this.iscsDevice['IscsCircle_19']) { - elem.upStatus.closeCommand ? this.iscsDevice['IscsCircle_19'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_19'].model.fillColor = '008DCE'; + elem.upStatus.closeCommand ? this.iscsDevice['IscsCircle_19'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_19'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_19']); } } else if (elem.deviceType === 'PSL') { if (this.iscsDevice['IscsCircle_12']) { - elem.upStatus.operate ? this.iscsDevice['IscsCircle_12'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_12'].model.fillColor = '#008DCE'; + elem.upStatus.operate ? this.iscsDevice['IscsCircle_12'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_12'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_12']); } if (this.iscsDevice['IscsCircle_9']) { - elem.upStatus.openCommand ? this.iscsDevice['IscsCircle_9'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_9'].model.fillColor = '#008DCE'; + elem.upStatus.openCommand ? this.iscsDevice['IscsCircle_9'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_9'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_9']); } if (this.iscsDevice['IscsCircle_35']) { - elem.upStatus.closeCommand ? this.iscsDevice['IscsCircle_35'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_35'].model.fillColor = '#008DCE'; + elem.upStatus.closeCommand ? this.iscsDevice['IscsCircle_35'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_35'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_35']); } if (this.iscsDevice['IscsCircle_37']) { - elem.upStatus.interlockRelease ? this.iscsDevice['IscsCircle_37'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_37'].model.fillColor = '#008DCE'; + elem.upStatus.interlockRelease ? this.iscsDevice['IscsCircle_37'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_37'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_37']); } } else if (elem.deviceType === 'SAFETY_CIRCLE') { if (this.iscsDevice['IscsCircle_26']) { - elem.upStatus.pfdcFault ? this.iscsDevice['IscsCircle_26'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_26'].model.fillColor = '#008DCE'; + elem.upStatus.pfdcFault ? this.iscsDevice['IscsCircle_26'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_26'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_26']); } if (this.iscsDevice['IscsCircle_25']) { - elem.upStatus.busFault ? this.iscsDevice['IscsCircle_25'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_25'].model.fillColor = '#008DCE'; + elem.upStatus.busFault ? this.iscsDevice['IscsCircle_25'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_25'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_25']); } if (this.iscsDevice['IscsCircle_27']) { - elem.upStatus.safetyCircle ? this.iscsDevice['IscsCircle_27'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_27'].model.fillColor = '#008DCE'; + elem.upStatus.safetyCircle ? this.iscsDevice['IscsCircle_27'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_27'].model.fillColor = '#FF0000'; this.$painter.update(this.iscsDevice['IscsCircle_27']); } } else { diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index ad9dba79e..ef7fcb0d0 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -309,10 +309,9 @@ class Jlmap { const prdType2ShowMode = { '01': '03', '02': '02'}; const showMode = prdType2ShowMode[this.showConfig.prdType]; - const stationCode = this.stationCode; this.updateShowMode(list, showMode); - this.updateShowStation(list, stationCode); + this.updateShowStation(list); if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); } } @@ -357,57 +356,14 @@ class Jlmap { getShowConfig() { return this.showConfig; } - // showStationHandlePsd(oDevice, stationCode) { - // if (store.getters['map/checkDeviceShow'](stationCode, oDevice.standCode) || !stationCode) { - // this.$painter.updateSpecialShowStation(oDevice, true); - // } else { - // this.$painter.updateSpecialShowStation(oDevice, false); - // } - // } - // showStationHandleSection(oDevice, stationCode) { - // const trainWinDevice = this.mapDevice[oDevice.trainWindowCode]; - // if (oDevice.stationCode === stationCode || !stationCode) { - // this.$painter.updateSpecialShowStation(trainWinDevice, true); - // } else { - // this.$painter.updateSpecialShowStation(trainWinDevice, false); - // } - // } - // showStationHandleStation (oDevice, stationCode) { - // if ((oDevice.centralized && oDevice.code === stationCode) || !stationCode) { - // this.$painter.updateSpecialShowStation(oDevice, true); - // oDevice.chargeStationCodeList.forEach(staCode => { - // const staDevice = this.mapDevice[staCode]; - // this.$painter.updateSpecialShowStation(staDevice, true); - // }); - // } else if (oDevice.centralized && oDevice.code !== stationCode) { - // this.$painter.updateSpecialShowStation(oDevice, false); - // oDevice.chargeStationCodeList.forEach(staCode => { - // const staDevice = this.mapDevice[staCode]; - // this.$painter.updateSpecialShowStation(staDevice, false); - // }); - // } - // } - updateShowStation(list = [], stationCode = '') { - this.stationCode = stationCode; + updateShowStation(list = [], stationCode = '') { store.dispatch('map/setShowCentralizedStationCode', stationCode); list.forEach(elem => { const code = elem.code; const type = elem._type; const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig); - // if (oDevice._type === deviceType.Station) { - // this.showStationHandleStation(oDevice, stationCode); - // } else if (oDevice._type === deviceType.Section) { - // this.$painter.updateShowStation(oDevice, stationCode); - // this.showStationHandleSection(oDevice, stationCode); - // } else if (oDevice._type === deviceType.TrainWindow) { - // // 不处理车次窗 勿删 - // } else if (oDevice._type === deviceType.Psd) { - // this.showStationHandlePsd(oDevice, stationCode); - // } else { - // this.$painter.updateShowStation(oDevice, stationCode); - // } - this.$painter.updateShowStation(oDevice, stationCode); + this.$painter.update(oDevice); }); this.$painter.$transformHandle.revisibleAll(); if (stationCode) { @@ -428,18 +384,6 @@ class Jlmap { }); this.$painter.$transformHandle.revisibleAll(); } - // updatePrdType(list = [], showMode = '03', val = '') { - // this.showConfig.prdType = val; - // this.showConfig.showMode = showMode; - // list.forEach(item => { - // const code = item.code; - // const type = item._type; - // const oDevice = this.mapDevice[code] || deviceFactory(type, item, this.showConfig); - // this.hookHandle(oDevice, this.showConfig); - // this.$painter.update(oDevice); - // this.$painter.updateShowMode(oDevice); - // }); - // } update(list = [], fetch = true) { this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index d8f8f4765..827747852 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -196,9 +196,9 @@ class Painter { /** * 更新现地显示单独集中站 * */ - updateShowStation(device, stationCode) { - if (device && device.instance) { - device.instance.setShowStation(stationCode); + updateShowStation(device) { + if (device && device.instance && device.model) { + device.instance.setState(device.model); } } // updateSpecialShowStation(device, flag) { diff --git a/src/jmapNew/shape/graph/Arrow/index.js b/src/jmapNew/shape/graph/Arrow/index.js index 407539661..0593e48ec 100644 --- a/src/jmapNew/shape/graph/Arrow/index.js +++ b/src/jmapNew/shape/graph/Arrow/index.js @@ -11,7 +11,7 @@ export default class Arrow extends Group { this.z = 0; this.model = model; // this.style = style; - this.isShowShape = true; + // this.isShowShape = true; this.create(); this.setState(model); this.setShowMode(); @@ -41,27 +41,24 @@ export default class Arrow extends Group { } setState(model) { - if (!this.isShowShape) return; + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.arrow && this.arrow.show(); + } + } + recover() { + this.arrow && this.arrow.hide(); } // 设置显示模式 setShowMode() { - const showMode = this.model.showMode; - const showConditions = this.model.showConditions; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.arrow.show(); - } else { - this.arrow.hide(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.hide(); - this.isShowShape = false; - } + // const showMode = this.model.showMode; + // const showConditions = this.model.showConditions; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.arrow.show(); + // } else { + // this.arrow.hide(); + // } } getAnchorPoint() { const rect = this.arrow.getBoundingRect(); diff --git a/src/jmapNew/shape/graph/AutoTurnBack/index.js b/src/jmapNew/shape/graph/AutoTurnBack/index.js index 864cc4252..03bb65621 100644 --- a/src/jmapNew/shape/graph/AutoTurnBack/index.js +++ b/src/jmapNew/shape/graph/AutoTurnBack/index.js @@ -18,7 +18,7 @@ export default class AutoTurnBack extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.isShowShape = true; + // this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -101,6 +101,10 @@ export default class AutoTurnBack extends Group { } recover() { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); + this.arcBorder && this.arcBorder.show(); this.control && this.control.setStyle({ fill: this.style.AutoTurnBack.lamp.controlColor }); } handleSignal() { @@ -109,14 +113,21 @@ export default class AutoTurnBack extends Group { // 设置状态 setState(model) { this.recover(); - model.setUp && this.handleSignal(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); + this.arcBorder && this.arcBorder.hide(); + } else { + model.setUp && this.handleSignal(); + } } createMouseEvent() { if (this.style.LcControl.mouseOverStyle) { - this.mouseEvent = new EMouse(this); + this.mouseEvent = new EMouse(this); this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } @@ -165,34 +176,12 @@ export default class AutoTurnBack extends Group { this.hideMode(); return; } - const showConditions = this.style.AutoTurnBack.visibleConditions; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.showMode(); - } else { - this.hideMode(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.isShowShape = true; - this.showMode(); - } else { - this.isShowShape = false; - this.hideMode(); - } - } - showMode() { - this.control && this.control.show(); - this.text && this.text.show(); - this.subtitleText && this.subtitleText.show(); - this.arcBorder && this.arcBorder.show(); - this.setState(this.model); - } - hideMode() { - this.control && this.control.hide(); - this.text && this.text.hide(); - this.subtitleText && this.subtitleText.hide(); - this.arcBorder && this.arcBorder.hide(); + // const showConditions = this.style.AutoTurnBack.visibleConditions; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.showMode(); + // } else { + // this.hideMode(); + // } } setControlColor(color) { diff --git a/src/jmapNew/shape/graph/AutomacticRoute/index.js b/src/jmapNew/shape/graph/AutomacticRoute/index.js index 9d36efa3d..6d042b2af 100644 --- a/src/jmapNew/shape/graph/AutomacticRoute/index.js +++ b/src/jmapNew/shape/graph/AutomacticRoute/index.js @@ -85,12 +85,20 @@ export default class AutomacticRoute extends Group { // 设置状态 setState(model) { - if (!this.isShowShape) return; - if (this.model.fleetMode) { - this.control && this.control.setStyle('fill', this.style.AutomaticRoute.lamp.lightColor); + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); } else { - this.control && this.control.setStyle('fill', this.style.AutomaticRoute.lamp.controlColor); + if (this.model.fleetMode) { + this.control && this.control.setStyle('fill', this.style.AutomaticRoute.lamp.lightColor); + } else { + this.control && this.control.setStyle('fill', this.style.AutomaticRoute.lamp.controlColor); + } } + } createMouseEvent() { @@ -129,33 +137,18 @@ export default class AutomacticRoute extends Group { } setShowMode() { - const showMode = this.model.showMode; - const showConditions = (this.style.AutomaticRoute || {}).displayCondition; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.showMode(); - } else { - this.hideMode(); - } + // const showMode = this.model.showMode; + // const showConditions = (this.style.AutomaticRoute || {}).displayCondition; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.showMode(); + // } else { + // this.hideMode(); + // } } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.isShowShape = true; - this.showMode(); - } else { - this.isShowShape = false; - this.hideMode(); - } - } - showMode() { + recover() { this.control && this.control.show(); this.text && this.text.show(); this.subtitleText && this.subtitleText.show(); - this.setState(this.model); - } - hideMode() { - this.control && this.control.hide(); - this.text && this.text.hide(); - this.subtitleText && this.subtitleText.hide(); } getAnchorPoint() { return this.model.position; diff --git a/src/jmapNew/shape/graph/AxleReset/index.js b/src/jmapNew/shape/graph/AxleReset/index.js index d8582e78b..f52258406 100644 --- a/src/jmapNew/shape/graph/AxleReset/index.js +++ b/src/jmapNew/shape/graph/AxleReset/index.js @@ -90,14 +90,23 @@ export default class AxleReset extends Group { // 设置状态 setState(model) { + this.recover(); // 只响应前端自定义类型的状态变化 - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); + } else if (model._free) { this.setAshShow(); - } else { - if (!this.isShowShape) return; } } + recover() { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); + } + createMouseEvent() { if (this.style.LcControl.mouseOverStyle) { this.mouseEvent = new EMouse(this); @@ -133,33 +142,13 @@ export default class AxleReset extends Group { } } setShowMode() { - const showMode = this.model.showMode; - const showConditions = (this.style.AxleReset || {}).displayCondition; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.showMode(); - } else { - this.hideMode(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.isShowShape = true; - this.showMode(); - } else { - this.isShowShape = false; - this.hideMode(); - } - } - showMode() { - this.control && this.control.show(); - this.text && this.text.show(); - this.subtitleText && this.subtitleText.show(); - this.setState(this.model); - } - hideMode() { - this.control && this.control.hide(); - this.text && this.text.hide(); - this.subtitleText && this.subtitleText.hide(); + // const showMode = this.model.showMode; + // const showConditions = (this.style.AxleReset || {}).displayCondition; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.showMode(); + // } else { + // this.hideMode(); + // } } getAnchorPoint() { return this.model.position; diff --git a/src/jmapNew/shape/graph/DirectionRod/index.js b/src/jmapNew/shape/graph/DirectionRod/index.js index e565710b0..98eb659c3 100644 --- a/src/jmapNew/shape/graph/DirectionRod/index.js +++ b/src/jmapNew/shape/graph/DirectionRod/index.js @@ -12,7 +12,7 @@ export default class DirectionRod extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.isShowShape = true; + // this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -59,61 +59,46 @@ export default class DirectionRod extends Group { }); this.add(this.rod); this.add(this.tipText); - // setTimeout(()=> { - // console.log('*************'); - // this.rod.attr('rotation', Math.PI); - // console.log(this.rod, '----'); - // }, 10000); } recover() { + this.rod && this.rod.show(); + this.tipText && this.tipText.show(); } // 设置状态 setState(model) { // if (!this.isShowShape) return; - // this.recover(); - if (model.reversed && this.model.right) { - this.rod.attr('rotation', 0); - } else if (!model.reversed && this.model.right) { - this.rod.attr('rotation', Math.PI); - } else if (model.reversed && !this.model.right) { - this.rod.attr('rotation', Math.PI); - } else if (!model.reversed && !this.model.right) { - this.rod.attr('rotation', 0); + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.rod && this.rod.hide(); + this.tipText && this.tipText.hide(); + } else { + if (model.reversed && this.model.right) { + this.rod.attr('rotation', 0); + } else if (!model.reversed && this.model.right) { + this.rod.attr('rotation', Math.PI); + } else if (model.reversed && !this.model.right) { + this.rod.attr('rotation', Math.PI); + } else if (!model.reversed && !this.model.right) { + this.rod.attr('rotation', 0); + } } + } createMouseEvent() { } setShowMode() { - const showMode = this.model.showMode; - const showConditions = (this.style.DirectionRod || {}).displayCondition; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.showMode(); - } else { - this.hideMode(); - } + // const showMode = this.model.showMode; + // const showConditions = (this.style.DirectionRod || {}).displayCondition; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.showMode(); + // } else { + // this.hideMode(); + // } } drawSelected() { - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.isShowShape = true; - this.showMode(); - } else { - this.isShowShape = false; - this.hideMode(); - } - } - showMode() { - this.rod && this.rod.show(); - this.tipText && this.tipText.show(); - this.setState(this.model); - } - hideMode() { - this.rod && this.rod.hide(); - this.tipText && this.tipText.hide(); } getAnchorPoint() { const rect = this.rod.getBoundingRect(); diff --git a/src/jmapNew/shape/graph/FloodGate/index.js b/src/jmapNew/shape/graph/FloodGate/index.js index 1b544c886..15eac20a7 100644 --- a/src/jmapNew/shape/graph/FloodGate/index.js +++ b/src/jmapNew/shape/graph/FloodGate/index.js @@ -41,41 +41,29 @@ export default class FloodGate extends Group { this.add(this.floodGate); } recover() { + this.floodGate && this.floodGate.show(); this.floodGate.setStyle({ stroke: this.style.FloodGate.spareStrokeColor, fill: this.style.FloodGate.spareFillColor }); } // 设置状态 setState(model) { - if (!this.isShowShape) return; + // if (!this.isShowShape) return; this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.floodGate && this.floodGate.hide(); + } } createMouseEvent() { } setShowMode() { - const showMode = this.model.showMode; - const showConditions = (this.style.FloodGate || {}).displayCondition; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.showMode(); - } else { - this.hideMode(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.isShowShape = true; - this.showMode(); - } else { - this.isShowShape = false; - this.hideMode(); - } - } - showMode() { - this.floodGate && this.floodGate.show(); - this.setState(this.model); - } - hideMode() { - this.floodGate && this.floodGate.hide(); + // const showMode = this.model.showMode; + // const showConditions = (this.style.FloodGate || {}).displayCondition; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.showMode(); + // } else { + // this.hideMode(); + // } } getAnchorPoint() { return this.model.position; diff --git a/src/jmapNew/shape/graph/GuideLock/index.js b/src/jmapNew/shape/graph/GuideLock/index.js index 04c46cbeb..89e433322 100644 --- a/src/jmapNew/shape/graph/GuideLock/index.js +++ b/src/jmapNew/shape/graph/GuideLock/index.js @@ -17,7 +17,7 @@ export default class GuideLock extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.isShowShape = true; + // this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -83,6 +83,9 @@ export default class GuideLock extends Group { this.add(this.text); } recover() { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); this.control && this.control.setStyle({ fill: this.style.GuideLock.lamp.controlColor }); } handleSignal() { @@ -96,13 +99,19 @@ export default class GuideLock extends Group { // 设置状态 setState(model) { // 只响应前端自定义类型的状态变化 - if (model._free) { - this.setAshShow(); + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); } else { - if (!this.isShowShape) return; - this.recover(); - model.totalGuideLock && this.handleSignal(); + if (model._free) { + this.setAshShow(); + } else { + model.totalGuideLock && this.handleSignal(); + } } + } createMouseEvent() { @@ -139,34 +148,14 @@ export default class GuideLock extends Group { } } setShowMode() { - const showMode = this.model.showMode; - const showConditions = (this.style.GuideLock || {}).displayCondition; - - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.showMode(); - } else { - this.hideMode(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.isShowShape = true; - this.showMode(); - } else { - this.isShowShape = false; - this.hideMode(); - } - } - showMode() { - this.control && this.control.show(); - this.text && this.text.show(); - this.subtitleText && this.subtitleText.show(); - this.setState(this.model); - } - hideMode() { - this.control && this.control.hide(); - this.text && this.text.hide(); - this.subtitleText && this.subtitleText.hide(); + // const showMode = this.model.showMode; + // const showConditions = (this.style.GuideLock || {}).displayCondition; + // + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.showMode(); + // } else { + // this.hideMode(); + // } } getAnchorPoint() { return this.model.position; diff --git a/src/jmapNew/shape/graph/LcControl/index.js b/src/jmapNew/shape/graph/LcControl/index.js index 468322f6d..037e82da3 100644 --- a/src/jmapNew/shape/graph/LcControl/index.js +++ b/src/jmapNew/shape/graph/LcControl/index.js @@ -61,12 +61,16 @@ export default class LcControl extends Group { // 设置状态 setState(model) { // 只响应前端自定义类型的状态变化 - if (model._free) { + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + } else if (model._free) { this.setAshShow(); - } else { - if (!this.isShowShape) return; } } + recover() { + this.control && this.control.show(); + } createMouseEvent() { if (this.style.LcControl.mouseOverStyle) { @@ -88,16 +92,6 @@ export default class LcControl extends Group { return null; } setShowMode() {} - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.control.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.control.hide(); - this.isShowShape = false; - } - } getAnchorPoint() { return this.model.position; } diff --git a/src/jmapNew/shape/graph/LimitControl/index.js b/src/jmapNew/shape/graph/LimitControl/index.js index d318cca2a..36dc7fa96 100644 --- a/src/jmapNew/shape/graph/LimitControl/index.js +++ b/src/jmapNew/shape/graph/LimitControl/index.js @@ -65,13 +65,16 @@ export default class LimitControl extends Group { // 设置状态 setState(model) { // 只响应前端自定义类型的状态变化 - if (model._free) { + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + } else if (model._free) { this.setAshShow(); - } else { - if (!this.isShowShape) return; } } - + recover() { + this.control && this.control.show(); + } createMouseEvent() { if (this.style.LimitControl.mouseOverStyle) { this.mouseEvent = new EMouse(this); @@ -93,16 +96,6 @@ export default class LimitControl extends Group { return null; } setShowMode() {} - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.control.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.control.hide(); - this.isShowShape = false; - } - } getAnchorPoint() { return this.model.position; } diff --git a/src/jmapNew/shape/graph/Line/index.js b/src/jmapNew/shape/graph/Line/index.js index ccb30003f..a13d3fe11 100644 --- a/src/jmapNew/shape/graph/Line/index.js +++ b/src/jmapNew/shape/graph/Line/index.js @@ -90,32 +90,33 @@ export default class Line2 extends Group { } setState(model) { - if (!this.isShowShape) return; - this.setLineType(model.type); + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.segment && this.segment.hide(); + this.viceSegment && this.viceSegment.hide(); + } else { + this.setLineType(model.type); + } + } + recover() { + this.segment && this.segment.show(); + this.viceSegment && this.viceSegment.show(); } // 设置显示模式 setShowMode() { - const showMode = this.model.showMode; - const showConditions = this.model.showConditions; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.segment && this.segment.show(); - this.viceSegment && this.viceSegment.show(); - } else { - this.segment && this.segment.hide(); - this.viceSegment && this.viceSegment.hide(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.segment && this.segment.show(); - this.viceSegment && this.viceSegment.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.segment && this.segment.hide(); - this.viceSegment && this.viceSegment.hide(); - this.isShowShape = false; - } + // const showMode = this.model.showMode; + // const showConditions = this.model.showConditions; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.segment && this.segment.show(); + // this.viceSegment && this.viceSegment.show(); + // } else { + // this.segment && this.segment.hide(); + // this.viceSegment && this.viceSegment.hide(); + // } + // if (store.state.training.prdType === '09') { + // this.text && this.text.hide(); + // } } getAnchorPoint() { if (this.segment) { diff --git a/src/jmapNew/shape/graph/OutFrame/index.js b/src/jmapNew/shape/graph/OutFrame/index.js index 3d17b19f2..752fa9749 100644 --- a/src/jmapNew/shape/graph/OutFrame/index.js +++ b/src/jmapNew/shape/graph/OutFrame/index.js @@ -40,32 +40,29 @@ export default class OutFrame extends Group { // 设置状态 setState(model) { - if (!this.isShowShape) return; + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.box && this.box.hide(); + } + } + recover() { + this.box && this.box.hide(); } // 设置显示模式 setShowMode() { - const showMode = this.model.showMode; - const showConditions = this.model.showConditions; - if (showMode == '04') { - this.box && this.box.hide(); - return; - } - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.box && this.box.show(); - this.setState(this.model); - } else { - this.box && this.box.hide(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.box && this.box.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.box && this.box.hide(); - this.isShowShape = false; - } + // const showMode = this.model.showMode; + // const showConditions = this.model.showConditions; + // if (showMode == '04') { + // this.box && this.box.hide(); + // return; + // } + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.box && this.box.show(); + // this.setState(this.model); + // } else { + // this.box && this.box.hide(); + // } } screenShow() { this.box && this.box.hide(); diff --git a/src/jmapNew/shape/graph/OverAp/index.js b/src/jmapNew/shape/graph/OverAp/index.js index 24c618ee1..c9e9e6092 100644 --- a/src/jmapNew/shape/graph/OverAp/index.js +++ b/src/jmapNew/shape/graph/OverAp/index.js @@ -1,6 +1,7 @@ import Group from 'zrender/src/container/Group'; import ETextName from '../element/ETextName'; // 名称文字 (共有) import BoundingRect from 'zrender/src/core/BoundingRect'; +import store from '@/store/index'; export default class OverAp extends Group { constructor(model, {style}) { @@ -42,23 +43,28 @@ export default class OverAp extends Group { this.add(this.text); } } - - setState(model) { + recover() { this.text && this.text.hide(); - if (model.remainTime && this.style.OverAp.show) { // 目前哈尔滨线路显示 - // console.log(model, model.remainTime, model.sectionName, '====='); - this.text && this.text.show(); - let offset = 40; - if (!model.offsetRight) { - offset = -40; - } - this.text && this.text.attr({ - style: { - text: model.remainTime, - x: model.points.x + offset, - y: model.points.y - this.style.Section.line.width * 2 + } + setState(model) { + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.text && this.text.hide(); + } else { + if (model.remainTime && this.style.OverAp.show) { // 目前哈尔滨线路显示 + this.text && this.text.show(); + let offset = 40; + if (!model.offsetRight) { + offset = -40; } - }); + this.text && this.text.attr({ + style: { + text: model.remainTime, + x: model.points.x + offset, + y: model.points.y - this.style.Section.line.width * 2 + } + }); + } } } getBoundingRect() { diff --git a/src/jmapNew/shape/graph/Power/index.js b/src/jmapNew/shape/graph/Power/index.js index 99563bc82..4235d13a9 100644 --- a/src/jmapNew/shape/graph/Power/index.js +++ b/src/jmapNew/shape/graph/Power/index.js @@ -111,43 +111,38 @@ export default class Line2 extends Group { } setState(model) { - if (!this.isShowShape) return; + // if (!this.isShowShape) return; this.recover(); - this.setLineType(model.type); - model.on && this.setCharged(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.line && this.line.hide(); + this.leftTerminal && this.leftTerminal.hide(); + this.rightTerminal && this.rightTerminal.hide(); + } else { + this.setLineType(model.type); + model.on && this.setCharged(); + } } recover() { - this.line.setStyle('stroke', this.style.Power.noElectricStrokeColor); + this.line && this.line.show(); + this.line && this.line.setStyle('stroke', this.style.Power.noElectricStrokeColor); + this.leftTerminal && this.leftTerminal.show(); + this.rightTerminal && this.rightTerminal.show(); } // 设置显示模式 setShowMode() { - const showMode = this.model.showMode; - const showConditions = this.model.showConditions; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.eachChild((child) => { - child.show(); - }); - } else { - this.eachChild((child) => { - child.hide(); - }); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild((child) => { - child.show(); - }); - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild((child) => { - child.hide(); - }); - this.isShowShape = false; - } + // const showMode = this.model.showMode; + // const showConditions = this.model.showConditions; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.eachChild((child) => { + // child.show(); + // }); + // } else { + // this.eachChild((child) => { + // child.hide(); + // }); + // } } screenShow() { this.eachChild((child) => { diff --git a/src/jmapNew/shape/graph/Psd/index.js b/src/jmapNew/shape/graph/Psd/index.js index e01796eac..1a28e56f3 100644 --- a/src/jmapNew/shape/graph/Psd/index.js +++ b/src/jmapNew/shape/graph/Psd/index.js @@ -52,9 +52,12 @@ export default class Line2 extends Group { setState(model) { this.recover(); - if (!this.isShowShape) return; - - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + const currentTypeList = this.style.Psd.elemnetType; + currentTypeList.forEach(element => { + this[element].hide(); + }); + } else if (model._free) { this.setAshShow(); } else { const currentTypeList = this.style.Psd.elemnetType; @@ -77,32 +80,14 @@ export default class Line2 extends Group { this.on('mouseover', () => { this.highlight.mouseover(); }); } } - setShowMode(flag) { + setShowMode() { const showMode = this.model.showMode; - if (!flag) { - this.eachChild(item => { - item.show(); - }); - this.setState(this.model); - } if (showMode == '05') { this.eachChild(item => { item.hide(); }); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - this.setState(this.model); } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; + this.setState(this.model); } } getAnchorPoint() { diff --git a/src/jmapNew/shape/graph/Resource/index.js b/src/jmapNew/shape/graph/Resource/index.js index f90a5c02f..b87688c89 100644 --- a/src/jmapNew/shape/graph/Resource/index.js +++ b/src/jmapNew/shape/graph/Resource/index.js @@ -44,7 +44,14 @@ export default class Resource extends Group { } setState(model) { - if (!this.isShowShape) return; + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.image && this.image.hide(); + } + } + recover() { + this.image && this.image.show(); } // 整体图片 @@ -70,16 +77,6 @@ export default class Resource extends Group { return null; } setShowMode() {} - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.image && this.image.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.image && this.image.hide(); - this.isShowShape = false; - } - } getAnchorPoint() { return this.model.position; } diff --git a/src/jmapNew/shape/graph/Responder/index.js b/src/jmapNew/shape/graph/Responder/index.js index 676a17802..6c8c81224 100644 --- a/src/jmapNew/shape/graph/Responder/index.js +++ b/src/jmapNew/shape/graph/Responder/index.js @@ -141,19 +141,27 @@ export default class Responder extends Group { } setState(model) { - if (!this.isShowShape) return; - const responderStyle = this.style.Responder || defaultStyle; - const style = responderStyle.block.mapStyle[model.type] || {fill: '#000'}; - this.block && this.block.setStyle(style); - if (this.delta1) { - model.type == 'IB' ? this.delta1.show() : this.delta1.hide(); + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.block && this.block.hide(); + this.text && this.text.hide(); + } else { + const responderStyle = this.style.Responder || defaultStyle; + const style = responderStyle.block.mapStyle[model.type] || {fill: '#000'}; + this.block && this.block.setStyle(style); + if (this.delta1) { + model.type == 'IB' ? this.delta1.show() : this.delta1.hide(); + } + if (this.delta2) { + model.type == 'IB' ? this.delta2.show() : this.delta2.hide(); + } } - if (this.delta2) { - model.type == 'IB' ? this.delta2.show() : this.delta2.hide(); - } - } - + recover() { + this.block && this.block.show(); + this.text && this.text.show(); + } // 整体图片 transformRotation(item, origin, rotation) { item.origin = origin; @@ -188,16 +196,6 @@ export default class Responder extends Group { return null; } setShowMode() {} - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.block && this.block.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.block && this.block.hide(); - this.isShowShape = false; - } - } getAnchorPoint() { return this.anchorPoint; } diff --git a/src/jmapNew/shape/graph/SaidLamp/index.js b/src/jmapNew/shape/graph/SaidLamp/index.js index b126ee18b..f5f2a269d 100644 --- a/src/jmapNew/shape/graph/SaidLamp/index.js +++ b/src/jmapNew/shape/graph/SaidLamp/index.js @@ -183,15 +183,22 @@ export default class SaidLamp extends Group { // 设置状态 setState(model) { - if (!this.isShowShape) return; - if (model._type === deviceType.PowerSupply && model.name.includes('2')) { - this.control && this.control.setControlColor(this.deviceStyle.lamp.offColor); - this.control && this.control.setControlStroke(this.deviceStyle.lamp.strokeColor, 1); - } else if ((model._type === deviceType.AtsControl || model._type === deviceType.LocalControl || model._type === deviceType.ChainControl) && model.name.includes('B')) { - this.control && this.control.setControlColor(this.deviceStyle.lamp.offColor); + // if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + } else { + if (model._type === deviceType.PowerSupply && model.name.includes('2')) { + this.control && this.control.setControlColor(this.deviceStyle.lamp.offColor); + this.control && this.control.setControlStroke(this.deviceStyle.lamp.strokeColor, 1); + } else if ((model._type === deviceType.AtsControl || model._type === deviceType.LocalControl || model._type === deviceType.ChainControl) && model.name.includes('B')) { + this.control && this.control.setControlColor(this.deviceStyle.lamp.offColor); + } } } - + recover() { + this.control && this.control.show(); + } createMouseEvent() { if (this.deviceStyle.mouseOverStyle) { this.mouseEvent = new EMouse(this); @@ -212,25 +219,15 @@ export default class SaidLamp extends Group { return null; } setShowMode() { - const showMode = this.model.showMode; - if (this.deviceStyle) { - const showConditions = (this.deviceStyle || {}).displayCondition; - if (showConditions === '01' || showMode === showConditions) { - this.control && this.control.show(); - } else { - this.control && this.control.hide(); - } - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.control && this.control.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.control && this.control.hide(); - this.isShowShape = false; - } + // const showMode = this.model.showMode; + // if (this.deviceStyle) { + // const showConditions = (this.deviceStyle || {}).displayCondition; + // if (showConditions === '01' || showMode === showConditions) { + // this.control && this.control.show(); + // } else { + // this.control && this.control.hide(); + // } + // } } setControlColor(color, flag = false) { this.control && this.control.getControl && this.control.getControl().stopAnimation(false); diff --git a/src/jmapNew/shape/graph/Section/ELines.js b/src/jmapNew/shape/graph/Section/ELines.js index 47ebd50ba..981b38fa6 100644 --- a/src/jmapNew/shape/graph/Section/ELines.js +++ b/src/jmapNew/shape/graph/Section/ELines.js @@ -581,7 +581,7 @@ export default class ELines extends Group { } recover() { - + this.section && this.section.show(); } setState() { diff --git a/src/jmapNew/shape/graph/Section/ETextName.js b/src/jmapNew/shape/graph/Section/ETextName.js index a7da42ff8..1931315bc 100644 --- a/src/jmapNew/shape/graph/Section/ETextName.js +++ b/src/jmapNew/shape/graph/Section/ETextName.js @@ -6,6 +6,7 @@ class ETextName extends Group { constructor(model) { super(); this.model = model; + this.isShow = false; this.create(); } @@ -16,7 +17,6 @@ class ETextName extends Group { let styleY = ''; let styleName = ''; let isCreate = false; - let isShow = false; // 计算区段坐标位置 const x = Math.min(model.points[0].x, model.points[model.points.length - 1].x) + Math.abs(model.points[model.points.length - 1].x - model.points[0].x) / 2; @@ -37,7 +37,7 @@ class ETextName extends Group { } styleName = model.name; if (model.nameShow) { - isShow = true; + this.isShow = true; } } // 逻辑区段 @@ -49,7 +49,7 @@ class ETextName extends Group { styleName = model.name; isCreate = true; if (model.nameShow) { - isShow = true; + this.isShow = true; } } // 站台轨名称 @@ -63,7 +63,7 @@ class ETextName extends Group { styleName = model.standTrackName; } if (model.standTrackNameShow) { - isShow = true; + this.isShow = true; } } // 折返轨名称 @@ -77,7 +77,7 @@ class ETextName extends Group { styleName = model.reentryTrackName; } if (model.reentryTrackNameShow) { - isShow = true; + this.isShow = true; } } // 转换轨名称 @@ -91,7 +91,7 @@ class ETextName extends Group { styleName = model.transferTrackName; } if (model.transferTrackNameShow) { - isShow = true; + this.isShow = true; } } // 目的码名称 @@ -109,7 +109,7 @@ class ETextName extends Group { styleName = model.destinationCode; } if (model.destinationNameShow) { - isShow = true; + this.isShow = true; } } @@ -133,7 +133,7 @@ class ETextName extends Group { } }); this.add(this.text); - isShow ? this.text.show() : this.text.hide(); + this.isShow ? this.text.show() : this.text.hide(); } } @@ -155,6 +155,9 @@ class ETextName extends Group { recover() { // 暂时不做状态初始化 + if (this.text) { + this.isShow ? this.text.show() : this.text.hide(); + } const styleModel = this.model.style.Section[this.model.type]; this.text && this.text.setStyle({textFill: this.model.approach && this.model.type === 'name' ? styleModel.approachColor : styleModel.fontColor }); } diff --git a/src/jmapNew/shape/graph/Section/index.js b/src/jmapNew/shape/graph/Section/index.js index a4625d898..7132e28e0 100644 --- a/src/jmapNew/shape/graph/Section/index.js +++ b/src/jmapNew/shape/graph/Section/index.js @@ -63,7 +63,7 @@ export default class Section extends Group { this.mapDevice = mapDevice; this.selected = false; // 绘图选中状态 this.selectedType = ''; // 绘图批量选中状态 - this.isShowShape = true; + // this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -142,6 +142,11 @@ export default class Section extends Group { // this.line.setRunLineDefault(); } this.name && this.name.recover(); + this.logicText && this.logicText.recover(); + this.transferTrackText && this.transferTrackText.recover(); + this.standTrackText && this.standTrackText.recover(); + this.destinationText && this.destinationText.recover(); + this.reentryTrackText && this.reentryTrackText.recover(); this.derailer && this.derailer.hide(); this.speedLimit && this.speedLimit.hide(); this.speedLimitName && this.speedLimitName.hide(); @@ -151,6 +156,7 @@ export default class Section extends Group { stroke: this.style.Section.line.spareColor, fill: this.style.Section.line.spareColor }); + this.line && this.line.recover(); this.line && this.line.recoverRoute(); this.lineBorder && this.lineBorder.setStyle({ lineWidth: 0 }); } @@ -428,10 +434,13 @@ export default class Section extends Group { } /** 设置状态*/ setState(model, flag = false) { - if (!this.isShowShape || model.showMode === '05') return; this.recover(); // 只响应前端自定义类型的状态变化 - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.eachChild(item => { + item.hide(); + }); + } else if (model._free) { // 先初始化为灰色 this.setAshShow(); model.preGreen && this.line.setStyle({stroke: '#00FF00'}); @@ -577,12 +586,6 @@ export default class Section extends Group { this.line && this.line.setStyle({ stroke: 'rgba(255,255,255,0.8)' }); } setShowMode(flag = false) { - if (!flag) { - this.eachChild(item => { - item.show(); - }); - this.setState(this.model); - } if (this.model.showMode === '05') { this.line.setStyle({stroke: this.style.Section.line.troColor, lineWidth: this.style.Section.line.troWidth}); this.separator && this.separator.hide(); @@ -595,39 +598,8 @@ export default class Section extends Group { if (this.model.type === '05') { this.line.hide(); } - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - if (this.name) { - this.model.nameShow ? this.name.show() : this.name.hide(); - } - if (this.logicText) { - this.model.nameShow ? this.logicText.show() : this.logicText.hide(); - } - if (this.transferTrackText) { - this.model.transferTrackNameShow ? this.transferTrackText.show() : this.transferTrackText.hide(); - } - if (this.standTrackText) { - this.model.standTrackNameShow ? this.standTrackText.show() : this.standTrackText.hide(); - } - if (this.destinationText) { - this.model.destinationNameShow ? this.destinationText.show() : this.destinationText.hide(); - } - if (this.reentryTrackText) { - this.model.reentryTrackNameShow ? this.reentryTrackText.show() : this.reentryTrackText.hide(); - } - - this.setState(this.model); } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; + this.setState(this.model); } } diff --git a/src/jmapNew/shape/graph/Signal/index.js b/src/jmapNew/shape/graph/Signal/index.js index 49ef3ae17..0e63e1a58 100644 --- a/src/jmapNew/shape/graph/Signal/index.js +++ b/src/jmapNew/shape/graph/Signal/index.js @@ -195,7 +195,6 @@ class Signal extends Group { this.count = parseInt(model.lampPositionType); this.lamps = new Array(this.count); this.zlevel = model.zlevel; - this.isShowShape = true; this.z = 7; if (!model.positionPoint) { model.positionPoint = { @@ -365,7 +364,7 @@ class Signal extends Group { }); const timeNameY = model.position.y + model.positionPoint.y - posit * 15; - this.remainTImeName = new ESigName({ + this.remainTimeName = new ESigName({ zlevel: this.zlevel, z: this.z, silent: false, @@ -460,7 +459,7 @@ class Signal extends Group { this.style.Signal.text.show && model.nameShow ? this.sigName.show() : this.sigName.hide(); this.add(this.sigRoute); this.add(this.sigDelay); - this.add(this.remainTImeName); + this.add(this.remainTimeName); if (this.model.virtual) { // 虚拟信号机显示 @@ -871,8 +870,8 @@ class Signal extends Group { } // 信号显示延迟解锁 showRemainTime(number) { - this.remainTImeName.show(); - this.remainTImeName && this.remainTImeName.setStyle({ text: number }); + this.remainTimeName.show(); + this.remainTimeName && this.remainTimeName.setStyle({ text: number }); this.model.signalButtonList && this.model.signalButtonList.length && this.model.signalButtonList.forEach(item => { const button = store.getters['map/getDeviceByCode'](item); if (button.type === 'PICK') { @@ -891,18 +890,20 @@ class Signal extends Group { } // 恢复状态 recover() { + this.sigName && this.sigName.show(); this.sigName && this.sigName.setAnimationEnd(); this.lamps && this.lamps.forEach(item=> { item.show(); item.setGuideSectorShowHide(false); }); this.sigName.setStyle({ textBorderWidth: 0 }); this.sigName.setColor(this.style.Signal.text.defaultColor); - this.remainTImeName && this.remainTImeName.hide(); + this.remainTimeName && this.remainTimeName.hide(); this.sigDelay && this.sigDelay.hide(); if (this.style.Signal.auto.autoTriggerType != 'text') { this.setAutoClose(); this.sigAuto && this.sigAuto.animationRecover(); } + this.sigAuto && this.sigAuto.show(); this.sigRoute && this.sigRoute.hide(); - this.sigBack && this.sigBack.hide(); + this.sigPost && this.sigPost.show(); this.sigPost && this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 if (this.style.Signal.lamp.guidName === 'singleRY') { @@ -932,8 +933,12 @@ class Signal extends Group { this.ciConfirm && this.ciConfirm.hide(); this.sigBack && this.sigBack.hide(); this.tText && this.tText.hide(); + this.transmission && this.transmission.show(); + this.lowButton && this.lowButton.hide(); + this.sigBack && this.sigBack.stopAnimation(false); this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd(); + this.virtualSignal && this.virtualSignal.show(); this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor); if (this.model.signalButtonList && this.model.signalButtonList.length) { this.model.signalButtonList.forEach(item => { @@ -944,18 +949,22 @@ class Signal extends Group { } setState(model) { - if (!this.isShowShape || this.model.type === 'TRANSMISSION' || model.showMode === '05') { - return; - } const path = window.location.href; this.recover(); // 只响应前端自定义类型的状态变化 - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.eachChild(item => { + item.hide(); + }); + } else if (model._free) { this.setAshShow(); } else { /** 信号机进路按钮显示 */ /** 终端信号机按钮 */ + if ( this.model.type === 'TRANSMISSION' ) { + return; + } if (model.isRouteActive) { this.setLowButtonActive(); } else { @@ -1090,6 +1099,9 @@ class Signal extends Group { if (this.style.Signal.text.conflictColor && model.checkConflict) { this.sigName.setColor(this.style.Signal.text.conflictColor); } + if (store.state.training.prdType === '01') { + this.lowButton && this.lowButton.show(); + } } } @@ -1191,40 +1203,31 @@ class Signal extends Group { }); } } - setShowMode(flag = false) { + setShowMode() { const showMode = this.model.showMode; - if (!flag) { - this.eachChild(item => { - item.show(); - }); - this.setState(this.model); - } - if (showMode == '03') { - this.lowButton && this.lowButton.show(); - this.model.prdType = '01'; - } else if (showMode == '02') { - this.lowButton && this.lowButton.hide(); - this.model.prdType = '02'; - } else if (showMode == '05') { - this.eachChild(item => { - item.hide(); - }); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.style.Signal.text.show && this.model.nameShow ? this.sigName.show() : this.sigName.hide(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } + // if (!flag) { + // this.eachChild(item => { + // item.show(); + // }); + // this.isShowShape = true; + // this.setState(this.model); + // } + // if (showMode == '03') { + // this.lowButton && this.lowButton.show(); + // this.model.prdType = '01'; + // } else if (showMode == '02') { + // this.lowButton && this.lowButton.hide(); + // this.model.prdType = '02'; + // } else if (showMode == '05') { + // this.eachChild(item => { + // item.hide(); + // }); + // } + if (showMode === '05') { + this.eachChild(item => { item.show(); }); + } else { + this.setState(this.model); + } } setLowButtonShow() { diff --git a/src/jmapNew/shape/graph/SignalButton/index.js b/src/jmapNew/shape/graph/SignalButton/index.js index 3ced63ed2..53161ce2f 100644 --- a/src/jmapNew/shape/graph/SignalButton/index.js +++ b/src/jmapNew/shape/graph/SignalButton/index.js @@ -13,7 +13,6 @@ export default class SignalButton extends Group { this.z = 0; this.model = model; this.style = style.Line; - this.isShowShape = true; this.create(); this.setState(model); this.setShowMode(); @@ -116,6 +115,8 @@ export default class SignalButton extends Group { this.rectButton && this.rectButton.setStyle({ fill:this.getTypeColor() }); this.rightLine && this.rightLine.hide(); this.leftLine && this.leftLine.hide(); + this.rectButton && this.rectButton.show(); + this.buttonText && this.buttonText.show(); } blockShow() { this.rightLine && this.rightLine.show(); @@ -123,28 +124,21 @@ export default class SignalButton extends Group { } setState(model) { this.recover(); - if (!this.isShowShape) return; - if (model.hasSelected) { - this.startAnimate(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.buttonText && this.buttonText.hide(); + this.rectButton && this.rectButton.hide(); + this.leftLine && this.leftLine.hide(); + this.rightLine && this.rightLine.hide(); + } else { + if (model.hasSelected) { + this.startAnimate(); + } } + } // 设置显示模式 setShowMode() { } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } - } getAnchorPoint() { } } diff --git a/src/jmapNew/shape/graph/SplitStation/index.js b/src/jmapNew/shape/graph/SplitStation/index.js index 0e075bc02..d5bc87a4e 100644 --- a/src/jmapNew/shape/graph/SplitStation/index.js +++ b/src/jmapNew/shape/graph/SplitStation/index.js @@ -124,29 +124,32 @@ export default class SplitStation extends Group { if (showMode == '04') { this.eachChild(item => item.hide() ); return; - } - const showConditions = this.model.showConditions; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.eachChild(item => item.show() ); } else { - this.eachChild(item => item.hide() ); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; + this.setState(this.model); } + // const showConditions = this.model.showConditions; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.eachChild(item => item.show() ); + // } else { + // this.eachChild(item => item.hide() ); + // } } setState(model) { - if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.verticalLine && this.verticalLine.hide(); + this.arrowLeft && this.arrowLeft.hide(); + this.arrowRight && this.arrowRight.hide(); + this.leftText && this.leftText.hide(); + this.rightText && this.rightText.hide(); + } + } + recover() { + this.verticalLine && this.verticalLine.show(); + this.arrowLeft && this.arrowLeft.show(); + this.arrowRight && this.arrowRight.show(); + this.leftText && this.leftText.show(); + this.rightText && this.rightText.show(); } screenShow() { this.eachChild((child) => { diff --git a/src/jmapNew/shape/graph/Station/index.js b/src/jmapNew/shape/graph/Station/index.js index 49ef9ae33..1fd45df33 100644 --- a/src/jmapNew/shape/graph/Station/index.js +++ b/src/jmapNew/shape/graph/Station/index.js @@ -28,7 +28,6 @@ export default class Station extends Group { this.model = model; this.style = style; this.noneBeforeMode = ''; - this.isShowShape = true; this.create(); this.createTurnBack(); // 创建按图折返 this.createControlMode(); @@ -570,6 +569,9 @@ export default class Station extends Group { } recover() { + this.eachChild(item => { + item.show(); + }); this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.text.fontColor); this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); @@ -579,15 +581,13 @@ export default class Station extends Group { this.interconnectedControl && this.interconnectedControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.interconnectedControl && this.interconnectedControl.setTextColor(this.style.Station.StationControl.text.fontColor); this.controlPreReset && this.controlPreReset.setColor(this.style.Station.StationControl.lamp.grayColor); - + this.troButton && this.troButton.hide(); this.substationArrowsControl && this.substationArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyArrowsControl && this.emergencyArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor); if (this.style.Station.stationText.isSpecialType) { - // if() this.stationText.setColor(this.style.Station.stationText.noneModeColor); this.stationText.setBackground(this.style.Station.stationText.defaultBackColor); this.stationText && this.stationText.stopAnimate(); - // sationEle.controller } else { this.stationText && this.stationText.stopAnimate(); } @@ -595,50 +595,55 @@ export default class Station extends Group { // 设置状态 setState(model) { - if (!this.isShowShape) return; this.recover(); - model.controlMode && this['handle' + model.controlMode](); - - // if (this.style.Station.syncCentralizeStation && model.controller && model.centralized) { - // debugger; - // model.chargeStationCodeList.forEach(item => { - // const device = store.getters['map/getDeviceByCode'](item); - // // device.controller = model.controller; - // device && device.instance && device.instance.recover(); - // device && device.instance && device.instance.handleComplexControl(model.controller); - // }); - // // - // } - // console.log(model.controller, model.centralized, '5555555555555'); - model.preResetValidDuration && this.handlePreResetLamp(); - model.controller && this.handleComplexControl(model.controller); - model.emergencyController != undefined && this.handleEmergencyChange(model.emergencyController); - // model.controlApplicant - model.controlApplicant && this.handleControlApplicant(model); - if (this.style.Station.syncCentralizeStation && (model.controlMode || model.controller || model.emergencyController != undefined) && model.centralized) { - model.chargeStationCodeList.forEach(item => { - const device = store.getters['map/getDeviceByCode'](item); - device && device.instance && device.instance.recover(); - if (model.emergencyController != undefined) { - device.emergencyController = model.emergencyController; - device && device.instance && device.instance.handleEmergencyChange(model.emergencyController); - } - if (model.controller) { - device.controller = model.controller; - device && device.instance && device.instance.handleComplexControl(model.controller); - } else { - device.controlMode = model.controlMode; - device && device.instance && device.instance['handle' + model.controlMode](); - } - }); - } - if (model.tbStrategyId) { - store.state.map.map.tbStrategyList.forEach(item => { - if (item.stationCode == model.code) { - const modelData = Vue.prototype.$jlmap.mapDevice[item.code]; - modelData && modelData.instance && modelData.instance.setState(modelData, model.tbStrategyId); - } - }); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.eachChild(item => { item.hide(); }); + } else { + model.controlMode && this['handle' + model.controlMode](); + // if (this.style.Station.syncCentralizeStation && model.controller && model.centralized) { + // debugger; + // model.chargeStationCodeList.forEach(item => { + // const device = store.getters['map/getDeviceByCode'](item); + // // device.controller = model.controller; + // device && device.instance && device.instance.recover(); + // device && device.instance && device.instance.handleComplexControl(model.controller); + // }); + // // + // } + // console.log(model.controller, model.centralized, '5555555555555'); + model.preResetValidDuration && this.handlePreResetLamp(); + model.controller && this.handleComplexControl(model.controller); + model.emergencyController != undefined && this.handleEmergencyChange(model.emergencyController); + // model.controlApplicant + model.controlApplicant && this.handleControlApplicant(model); + if (this.style.Station.syncCentralizeStation && (model.controlMode || model.controller || model.emergencyController != undefined) && model.centralized) { + model.chargeStationCodeList.forEach(item => { + const device = store.getters['map/getDeviceByCode'](item); + device && device.instance && device.instance.recover(); + if (model.emergencyController != undefined) { + device.emergencyController = model.emergencyController; + device && device.instance && device.instance.handleEmergencyChange(model.emergencyController); + } + if (model.controller) { + device.controller = model.controller; + device && device.instance && device.instance.handleComplexControl(model.controller); + } else { + device.controlMode = model.controlMode; + device && device.instance && device.instance['handle' + model.controlMode](); + } + }); + } + if (model.tbStrategyId) { + store.state.map.map.tbStrategyList.forEach(item => { + if (item.stationCode == model.code) { + const modelData = Vue.prototype.$jlmap.mapDevice[item.code]; + modelData && modelData.instance && modelData.instance.setState(modelData, model.tbStrategyId); + } + }); + } + if (this.mileageText) { + model.kmPostShow ? this.mileageText.show() : this.mileageText.hide(); + } } } handlePreResetLamp() { @@ -783,25 +788,6 @@ export default class Station extends Group { this.troButton && this.troButton.hide(); } } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - if (this.model.visible) { - this.eachChild(item => { - item.show(); - }); - if (this.mileageText) { - this.model.kmPostShow ? this.mileageText.show() : this.mileageText.hide(); - } - } - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } - } setVisible(visible) { if (visible) { diff --git a/src/jmapNew/shape/graph/StationCounter/index.js b/src/jmapNew/shape/graph/StationCounter/index.js index 7a74bbbf6..601f3e6b0 100644 --- a/src/jmapNew/shape/graph/StationCounter/index.js +++ b/src/jmapNew/shape/graph/StationCounter/index.js @@ -15,7 +15,6 @@ export default class StationCounter extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 30; - this.isShowShape = true; this.create(); this.setState(model); } @@ -83,27 +82,23 @@ export default class StationCounter extends Group { } setState(model) { - if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.counter && this.counter.hide(); + this.table && this.table.hide(); + this.counterName && this.counterName.hide(); + } + } + recover() { + this.counter && this.counter.show(); + this.table && this.table.show(); + this.counterName && this.counterName.show(); } getShapeTipPoint() { return null; } setShowMode() {} - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } - } getAnchorPoint() { return this.model.position; } diff --git a/src/jmapNew/shape/graph/StationDelayUnlock/index.js b/src/jmapNew/shape/graph/StationDelayUnlock/index.js index 3f061abf7..d0b13aa01 100644 --- a/src/jmapNew/shape/graph/StationDelayUnlock/index.js +++ b/src/jmapNew/shape/graph/StationDelayUnlock/index.js @@ -15,7 +15,6 @@ export default class StationDelayUnlock extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 1; - this.isShowShape = true; this.create(); this.setState(model); } @@ -92,35 +91,33 @@ export default class StationDelayUnlock extends Group { /** 延时解锁计数*/ delayUnlock() { - if (!this.isShowShape) return; this.table.setStyle('stroke', this.style.sidelineColor); this.time.setStyle('text', '' + this.model.remainTime); } setState(model) { - switch (model.status) { - case '01': this.delayClose(); break; // 关闭 - case '02': this.delayUnlock(); break; // 延迟解锁 + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.text && this.text.hide(); + this.table && this.table.hide(); + this.time && this.time.hide(); + } else { + switch (model.status) { + case '01': this.delayClose(); break; // 关闭 + case '02': this.delayUnlock(); break; // 延迟解锁 + } } + } getShapeTipPoint() { return null; } setShowMode() {} - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } + recover() { + this.text && this.text.show(); + this.table && this.table.show(); + this.time && this.time.show(); } getAnchorPoint() { return this.model.position; diff --git a/src/jmapNew/shape/graph/StationStand/EPatternFilter.js b/src/jmapNew/shape/graph/StationStand/EPatternFilter.js index bf980c0b6..584c171f8 100644 --- a/src/jmapNew/shape/graph/StationStand/EPatternFilter.js +++ b/src/jmapNew/shape/graph/StationStand/EPatternFilter.js @@ -59,7 +59,8 @@ class EPatternFilter extends Group { } recover() { - + this.patternFilter1 && this.patternFilter1.show(); + this.patternFilter2 && this.patternFilter2.show(); } setState(model) { diff --git a/src/jmapNew/shape/graph/StationStand/EStationPlatform.js b/src/jmapNew/shape/graph/StationStand/EStationPlatform.js index 468be4737..cd47703c1 100644 --- a/src/jmapNew/shape/graph/StationStand/EStationPlatform.js +++ b/src/jmapNew/shape/graph/StationStand/EStationPlatform.js @@ -51,6 +51,7 @@ class EStationPlatform extends Group { } recover() { const style = this.model.style; + this.showMode(); this.setColor(style.StationStand.stationPlatform.defaultColor); } diff --git a/src/jmapNew/shape/graph/StationStand/ETrainSetButton.js b/src/jmapNew/shape/graph/StationStand/ETrainSetButton.js index 017ef898d..86392a53d 100644 --- a/src/jmapNew/shape/graph/StationStand/ETrainSetButton.js +++ b/src/jmapNew/shape/graph/StationStand/ETrainSetButton.js @@ -47,6 +47,7 @@ class ETrainSetButton extends Group { this.trainSetButton && this.trainSetButton.setStyle({textFill: color}); } recover() { + this.trainSetButton && this.trainSetButton.show(); const style = this.model.style; this.setColor(style.StationStand.trainSetButton.textColor); } diff --git a/src/jmapNew/shape/graph/StationStand/detain/EDetainCircle.js b/src/jmapNew/shape/graph/StationStand/detain/EDetainCircle.js index 09b5bcba6..3fcc98846 100644 --- a/src/jmapNew/shape/graph/StationStand/detain/EDetainCircle.js +++ b/src/jmapNew/shape/graph/StationStand/detain/EDetainCircle.js @@ -73,6 +73,9 @@ class EDetainCircle extends Group { recover() { const style = this.model.style; + this.detainCircle && this.detainCircle.hide(); + this.line1 && this.line1.hide(); + this.line2 && this.line2.hide(); this.setColor(style.StationStand.detainCircle.defaultColor); } diff --git a/src/jmapNew/shape/graph/StationStand/index.js b/src/jmapNew/shape/graph/StationStand/index.js index 82d911d65..9cc77fbb7 100644 --- a/src/jmapNew/shape/graph/StationStand/index.js +++ b/src/jmapNew/shape/graph/StationStand/index.js @@ -50,7 +50,6 @@ class StationStand extends Group { this.zlevel = model.zlevel; this.z = 1; this.mapDevice = mapDevice; - this.isShowShape = true; this.create(); this.createMouseEvent(); this.setVisible(model.visible); @@ -148,17 +147,25 @@ class StationStand extends Group { currentTypeList.forEach(element => { this[element].recover(); }); + this.stopJumpLamp && this.stopJumpLamp.hide(); + this.cancelStopJumpLamp && this.cancelStopJumpLamp.hide(); + this.upDetainLamp && this.upDetainLamp.hide(); + this.downDetainLamp && this.downDetainLamp.hide(); } setScreenDoorOpenStatus(model) { this.gapStand && this.gapStand.setState(model); } setState(model) { - if (!this.isShowShape) return; // // 新版地图使用新版状态变更方式 this.recover(); // 只响应前端自定义类型的状态变化 - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + const currentTypeList = this.style.StationStand.elemnetType; + currentTypeList.forEach(element => { + this[element].hide(); + }); + } else if (model._free) { this.setAshShow(); } else { // 更新状态 @@ -166,6 +173,12 @@ class StationStand extends Group { currentTypeList.forEach(element => { this[element].setState(model); }); + if (store.state.training.prdType === '01') { + this.stopJumpLamp && this.stopJumpLamp.show(); + this.cancelStopJumpLamp && this.cancelStopJumpLamp.show(); + this.upDetainLamp && this.upDetainLamp.show(); + this.downDetainLamp && this.downDetainLamp.show(); + } } } @@ -230,37 +243,28 @@ class StationStand extends Group { // 设置显示模式 setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.StationStand.common.functionButtonShow; - this.setVisible(this.model.visible); - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.stopJumpLamp && this.stopJumpLamp.show(); - this.cancelStopJumpLamp && this.cancelStopJumpLamp.show(); - this.upDetainLamp && this.upDetainLamp.show(); - this.downDetainLamp && this.downDetainLamp.show(); - } else if (showMode === '05') { - this.eachChild(item => { - item.hide(); - }); + // const showConditions = this.style.StationStand.common.functionButtonShow; + // this.setVisible(this.model.visible); + if (showMode === '05') { + this.eachChild(item => { item.hide(); }); } else { - this.stopJumpLamp && this.stopJumpLamp.hide(); - this.cancelStopJumpLamp && this.cancelStopJumpLamp.hide(); - this.upDetainLamp && this.upDetainLamp.hide(); - this.downDetainLamp && this.downDetainLamp.hide(); - } - } - setShowStation(stationCode) { - if ((!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) && this.model.visible) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; } + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.stopJumpLamp && this.stopJumpLamp.show(); + // this.cancelStopJumpLamp && this.cancelStopJumpLamp.show(); + // this.upDetainLamp && this.upDetainLamp.show(); + // this.downDetainLamp && this.downDetainLamp.show(); + // } else if (showMode === '05') { + // this.eachChild(item => { + // item.hide(); + // }); + // } else { + // this.stopJumpLamp && this.stopJumpLamp.hide(); + // this.cancelStopJumpLamp && this.cancelStopJumpLamp.hide(); + // this.upDetainLamp && this.upDetainLamp.hide(); + // this.downDetainLamp && this.downDetainLamp.hide(); + // } } getAnchorPoint() { return this.model.position; diff --git a/src/jmapNew/shape/graph/StationStand/safeStand/EGapStand.js b/src/jmapNew/shape/graph/StationStand/safeStand/EGapStand.js index dcf1b128d..0bb914610 100644 --- a/src/jmapNew/shape/graph/StationStand/safeStand/EGapStand.js +++ b/src/jmapNew/shape/graph/StationStand/safeStand/EGapStand.js @@ -75,6 +75,9 @@ class EGapStand extends Group { recover() { const style = this.model.style; + this.stand1 && this.stand1.show(); + this.stand2 && this.stand2.show(); + this.standText && this.standText.show(); if (!style.Psd.horizontal2Door.special) { this.stand1 && this.stand1.setStyle({ fill:style.StationStand.gapStand.spareColor }); this.stand2 && this.stand2.setStyle({ fill:style.StationStand.gapStand.spareColor }); diff --git a/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js b/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js index c59733a18..0a918c5c4 100644 --- a/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js +++ b/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js @@ -38,6 +38,7 @@ class EHollowStand extends Group { recover() { const style = this.model.style; this.setColor(style.StationStand.hollowStand.spareColor); + this.stand && this.stand.show(); } setState(model) { diff --git a/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js b/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js index 30c5f7435..c5cabba12 100644 --- a/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js +++ b/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js @@ -60,6 +60,7 @@ class ESolidStand extends Group { } recover() { // const style = this.model.style; + this.stand && this.stand.show(); } setState(model) { diff --git a/src/jmapNew/shape/graph/StationTurnBack/index.js b/src/jmapNew/shape/graph/StationTurnBack/index.js index 5cb821923..eb17215f6 100644 --- a/src/jmapNew/shape/graph/StationTurnBack/index.js +++ b/src/jmapNew/shape/graph/StationTurnBack/index.js @@ -16,7 +16,6 @@ export default class StationTurnBack extends Group { this.model = model; this.style = style; this.lineCode = lineCode; - this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -129,6 +128,10 @@ export default class StationTurnBack extends Group { if (!path.includes('/map/draw')) { this.strategyText && this.strategyText.hide(); } + this.control && this.control.show(); + this.controlRect && this.controlRect.show(); + this.text && this.text.show(); + this.strategyText && this.strategyText.show(); if (this.style.ReturnModeGroup) { this.control && this.control.highlightType1(this.style.ReturnModeGroup.highlightColor); @@ -165,11 +168,15 @@ export default class StationTurnBack extends Group { // 设置状态 setState(model, tbStrategyId = null) { - if (!this.isShowShape) return; this.recover(); // 只响应前端自定义类型的状态变化 - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + this.controlRect && this.controlRect.hide(); + this.text && this.text.hide(); + this.strategyText && this.strategyText.hide(); + } else if (model._free) { this.setAshShow(); } else { if (tbStrategyId) { @@ -198,18 +205,6 @@ export default class StationTurnBack extends Group { this.eachChild(item => item.hide() ); } } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } - } getAnchorPoint() { return this.model.position; } diff --git a/src/jmapNew/shape/graph/Switch/index.js b/src/jmapNew/shape/graph/Switch/index.js index c95896377..ef6b22af2 100644 --- a/src/jmapNew/shape/graph/Switch/index.js +++ b/src/jmapNew/shape/graph/Switch/index.js @@ -23,7 +23,6 @@ export default class Switch extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 6; - this.isShowShape = true; this.switchPosition = ''; this.mapDevice = mapDevice; this.triangle = new JTriangle(model.intersection, model.skew); @@ -331,10 +330,10 @@ export default class Switch extends Group { this.lockCircle && this.lockCircle.hide(); // 圆形包围框 this.lockArc && this.lockArc.hide(); // 圆形单锁框 this.name.getNameText().stopAnimation(false); - this.shapeModelC.hide(); // 形状 C - this.shapeModelA.hide(); // 形状 A - this.shapeModelB.hide(); // 形状 B - this.shapeBlockCover.hide(); // 封锁覆盖 + this.shapeModelC && this.shapeModelC.hide(); // 形状 C + this.shapeModelA && this.shapeModelA.hide(); // 形状 A + this.shapeModelB && this.shapeModelB.hide(); // 形状 B + this.shapeBlockCover && this.shapeBlockCover.hide(); // 封锁覆盖 this.setHasTextBorder(0); this.shapeModelC.attr({ z: this.z + 3 @@ -343,6 +342,8 @@ export default class Switch extends Group { this.lossShow && this.lossShow.hide(); // 道岔失去矩形 this.lossShow && this.lossShow.stopAnimation(false); this.artificialArc && this.artificialArc.hide(); + this.name && this.name.show(); + this.limitName && this.limitName.show(); } /** 定位*/ @@ -355,7 +356,7 @@ export default class Switch extends Group { this.shapeModelB.setColor(this.style.Section.line.spareColor); this.shapeModelC.show(); this.shapeModelC.setColor(this.style.backgroundColor); - } + } if (this.style.Switch.core.graphShow) { // 佛山线路显示 this.shapeModelB.show(); this.shapeModelB.setColor(this.style.Switch.core.graphLocalColor); @@ -678,10 +679,11 @@ export default class Switch extends Group { } } setState(model) { - if (!this.isShowShape || model.showMode === '05') return; this.recover(); // 只响应前端自定义类型的状态变化 - if (model._free) { + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.eachChild(item => { item.hide(); }); + } else if (model._free) { if (model.pos == 'N') { this.switchPosition = 'normal'; this.setLocationAction(model); /** 定位*/ @@ -805,33 +807,17 @@ export default class Switch extends Group { } } setShowMode(flag = false) { - if (!flag) { - this.eachChild(item => { - item.show(); - }); - this.setState(this.model); - } + // if (!flag) { + // this.eachChild(item => { + // item.show(); + // }); + // this.isShowShape = true; + // this.setState(this.model); + // } if ( this.model.showMode === '05') { - this.eachChild(item => { - item.hide(); - }); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - if (this.name) { - this.style.Switch.text.show && this.model.nameShow ? this.name.show() : this.name.hide(); - } - this.isShowShape = true; - this.setState(this.model); + this.eachChild(item => { item.hide(); }); } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; + this.setState(this.model); } } getAnchorPoint() { diff --git a/src/jmapNew/shape/graph/Text/index.js b/src/jmapNew/shape/graph/Text/index.js index ee484fe2d..d7e639871 100644 --- a/src/jmapNew/shape/graph/Text/index.js +++ b/src/jmapNew/shape/graph/Text/index.js @@ -14,7 +14,6 @@ export default class Text2 extends Group { this.style = style; this.z = 6; this.lineCode = lineCode; - this.isShowShape = true; this.create(); this.setState(model); this.setShowMode(); @@ -46,7 +45,13 @@ export default class Text2 extends Group { } setState(model) { - if (!this.isShowShape) return; + this.recover(); + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.text && this.text.hide(); + } + } + recover() { + this.text && this.text.show(); } getBoundingRect() { if (this.text) { @@ -62,26 +67,15 @@ export default class Text2 extends Group { this.text && this.text.hide(); return; } - const showConditions = this.model.showConditions; - if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.text && this.text.show(); - } else { - this.text && this.text.hide(); - } - } - setShowStation(stationCode) { - if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) { - this.eachChild(item => { - item.show(); - }); - this.isShowShape = true; - this.setState(this.model); - } else { - this.eachChild(item => { - item.hide(); - }); - this.isShowShape = false; - } + // const showConditions = this.model.showConditions; + // if (!showConditions || showConditions === '01' || showMode === showConditions) { + // this.text && this.text.show(); + // } else { + // this.text && this.text.hide(); + // } + // if (store.state.training.prdType === '09') { + // this.text && this.text.hide(); + // } } screenShow() { if (this.lineCode == '06') { // 宁波线路隐藏 diff --git a/src/jmapNew/shape/graph/Train/index.js b/src/jmapNew/shape/graph/Train/index.js index a98851c87..f493e5dca 100644 --- a/src/jmapNew/shape/graph/Train/index.js +++ b/src/jmapNew/shape/graph/Train/index.js @@ -18,7 +18,6 @@ export default class Train extends Group { this.size = 0; this.z = 40; this.section = null; - this.isShowShape = true; this.fontSize = model.nameFontSize || style.Train.common.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize; this.nameFormat = model.nameFormat || style.Train.trainBody.trainNameFormat; @@ -344,9 +343,10 @@ export default class Train extends Group { } // 设置状态 setState(model, object) { - if (!this.isShowShape) return; - const flag = model.trainWindowModel ? model.trainWindowModel.reversal : false; - if (model) { + const flag = model && model.trainWindowModel ? model.trainWindowModel.reversal : false; + if (!this.model.sectionModel || !store.getters['map/checkDeviceShow'](this.model.sectionModel.code)) { + this.eachChild(item => { item.hide(); }); + } else if (model) { this.recover(); // if (this.style.Train.common.trainHeadColorChangeMode) { // this.setDriveMode(model.driveMode + model.runLevel); @@ -461,18 +461,6 @@ export default class Train extends Group { }); } } - setShowStation(stationCode) { - if ((this.model.sectionModel && store.getters['map/checkDeviceShow'](stationCode, this.model.sectionModel.code)) || !stationCode) { - this.eachChild(item => { - item.show(); - }); - this.setState(this.model, this); - } else { - this.eachChild(item => { - item.hide(); - }); - } - } // screenShow() { // // this.text && this.text.hide(); // this.setState(this.model); diff --git a/src/jmapNew/shape/graph/TrainWindow/index.js b/src/jmapNew/shape/graph/TrainWindow/index.js index 46bbcca54..033f25ad4 100644 --- a/src/jmapNew/shape/graph/TrainWindow/index.js +++ b/src/jmapNew/shape/graph/TrainWindow/index.js @@ -14,8 +14,6 @@ class TrainWindow extends Group { this.style = style; this.z = 9; this.prdType = store.state.training.prdType; - this.isShowShape = model.isShowShape; - this.stationCode = ''; this.create(); this.createMouseEvent(); this.setState(model); @@ -72,8 +70,14 @@ class TrainWindow extends Group { } setState(model) { - if (!this.isShowShape) return; - this.setVisible(model.trainWindowShow); + // if (!this.isShowShape) return; + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.trainRect && this.trainRect.hide(); + } else if (model._tro) { + this.trainRect && this.trainRect.hide(); + } else { + this.setVisible(model.trainWindowShow); + } } setVisible(show) { @@ -93,22 +97,6 @@ class TrainWindow extends Group { }); } } - setShowStation(stationCode) { - this.stationCode = stationCode; - // console.log(this.model); - // if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this.model.sectionModel)) { - // this.eachChild(item => { - // item.show(); - // }); - // this.isShowShape = true; - // this.setState(this.model); - // } else { - // this.eachChild(item => { - // item.hide(); - // }); - // this.isShowShape = false; - // } - } getAnchorPoint() { return this.model.point || this.model.position; } diff --git a/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewName.vue b/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewName.vue index b5136950f..7f07ea0e0 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewName.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewName.vue @@ -239,7 +239,6 @@ export default { deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { kmPostShow })); // 公里标 }); } - this.$store.dispatch('map/updateMapDevices', deviceList); } } diff --git a/src/scripts/ConstConfig.js b/src/scripts/ConstConfig.js index bdf4c6ba5..4abaabc07 100644 --- a/src/scripts/ConstConfig.js +++ b/src/scripts/ConstConfig.js @@ -159,7 +159,8 @@ export default { { enlabel: 'Comprehensive exercise cloud platform', label: '综合演练云平台', value: '03'}, { enlabel: 'Driver simulation driving system', label: '司机模拟驾驶系统', value: '04'}, { enlabel: 'Dispatch workstation', label: '派班工作站', value: '05'}, - { enlabel: 'ISCS workstation', label: 'ISCS工作站', value: '06'} + { enlabel: 'ISCS workstation', label: 'ISCS工作站', value: '06'}, + { enlabel: 'Interlocking station at depot', label: '车辆段联锁工作站', value: '09' } ], trainingDeviceType: { Switch: {enlabel: 'Switch training', label:'道岔实训'}, diff --git a/src/store/modules/map.js b/src/store/modules/map.js index d6984df37..470e50e46 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -1,9 +1,9 @@ -import deviceType from '@/jmapNew/constant/deviceType'; +import deviceType from '@/jmapNew/constant/deviceType' // import { parser, updateMapData } from '@/jmapNew/utils/parser'; -import { parserFactory, ParserType } from '@/jmapNew/parser'; -import Vue from 'vue'; -import { deepAssign } from '@/utils/index'; -import store from '@/store/index'; +import { parserFactory, ParserType } from '@/jmapNew/parser' +import Vue from 'vue' +import { deepAssign } from '@/utils/index' +import store from '@/store/index' /** * 查询受影响的Devices并删除 @@ -12,1225 +12,1274 @@ import store from '@/store/index'; * @param {Array} list */ function queryDeleteModels(state, device, dict) { - function setDisPose(model, dict) { - if (!dict[model.code] || !dict[model.code]._dispose) { - dict[model.code] = {...model, _dispose: true }; - } + function setDisPose(model, dict) { + if (!dict[model.code] || !dict[model.code]._dispose) { + dict[model.code] = { ...model, _dispose: true } } - const map = state.map; + } + const map = state.map - if (device && map) { - setDisPose(device, dict); + if (device && map) { + setDisPose(device, dict) - switch (device._type) { - // 移除区段关联项 - case deviceType.Section: - // 删除所属逻辑区段 - if (map.sectionList && map.sectionList.length && device.type == '01') { - map.sectionList.forEach(elem => { - if (elem.type != '01' && elem.parentCode == device.code) { - setDisPose(elem, dict); - } - }); + switch (device._type) { + // 移除区段关联项 + case deviceType.Section: + // 删除所属逻辑区段 + if (map.sectionList && map.sectionList.length && device.type == '01') { + map.sectionList.forEach(elem => { + if (elem.type != '01' && elem.parentCode == device.code) { + setDisPose(elem, dict) } - - // 查询区段关联的道岔 - if (map.switchList && map.switchList.length) { - map.switchList.forEach(elem => { - if (elem.sectionACode == device.code || elem.sectionBCode == device.code || elem.sectionCCode == device.code) { - queryDeleteModels(state, elem, dict); - } - }); - } - - break; - case deviceType.Switch: - map.sectionList.forEach(elem => { - if (elem.type == '03' && elem.relSwitchCode == device.code) { - if (!dict[elem.code] || !dict[elem.code]._dispose) { - const copyModel = deepAssign({}, elem); - if (copyModel.parentCode) { - const model = dict[copyModel.parentCode] || state.mapDevice[copyModel.parentCode] || {}; - if (model.code) { - const setionModel = deepAssign({}, model); - setionModel.relevanceSectionList.forEach((sectionCode, index) => { - if (sectionCode == copyModel.code) { - setionModel.relevanceSectionList.splice(index, 1); - dict[setionModel.code] = setionModel; - } - }); - } - } - copyModel.relSwitchCode = ''; - // 旧版地图 判断是否道岔区段为isSwitchSection,新版地图已经更换为switchSection - // 此处为了兼容旧版,暂时没有删除isSwitchSection,待旧版地图删除之后需要删除isSwitchSection - copyModel.isSwitchSection = false; - copyModel.switchSection = false; - copyModel.type = '01'; - copyModel.name = copyModel.name.split('-')[0]; - dict[elem.code] = copyModel; - } - } - if (elem.type == '04') { - if (dict[elem.code] && !dict[elem.code].relevanceSectionList.length) { - setDisPose(elem, dict); - } else if (elem.relevanceSectionList && !elem.relevanceSectionList.length) { - setDisPose(elem, dict); - } - } - }); - break; + }) } + + // 查询区段关联的道岔 + if (map.switchList && map.switchList.length) { + map.switchList.forEach(elem => { + if (elem.sectionACode == device.code || elem.sectionBCode == device.code || elem.sectionCCode == device.code) { + queryDeleteModels(state, elem, dict) + } + }) + } + + break + case deviceType.Switch: + map.sectionList.forEach(elem => { + if (elem.type == '03' && elem.relSwitchCode == device.code) { + if (!dict[elem.code] || !dict[elem.code]._dispose) { + const copyModel = deepAssign({}, elem) + if (copyModel.parentCode) { + const model = dict[copyModel.parentCode] || state.mapDevice[copyModel.parentCode] || {} + if (model.code) { + const setionModel = deepAssign({}, model) + setionModel.relevanceSectionList.forEach((sectionCode, index) => { + if (sectionCode == copyModel.code) { + setionModel.relevanceSectionList.splice(index, 1) + dict[setionModel.code] = setionModel + } + }) + } + } + copyModel.relSwitchCode = '' + // 旧版地图 判断是否道岔区段为isSwitchSection,新版地图已经更换为switchSection + // 此处为了兼容旧版,暂时没有删除isSwitchSection,待旧版地图删除之后需要删除isSwitchSection + copyModel.isSwitchSection = false + copyModel.switchSection = false + copyModel.type = '01' + copyModel.name = copyModel.name.split('-')[0] + dict[elem.code] = copyModel + } + } + if (elem.type == '04') { + if (dict[elem.code] && !dict[elem.code].relevanceSectionList.length) { + setDisPose(elem, dict) + } else if (elem.relevanceSectionList && !elem.relevanceSectionList.length) { + setDisPose(elem, dict) + } + } + }) + break } + } } // 保存草稿地图绘制关系检测 function saveMapDeviceDefaultRelations(state) { - if (state && state.map) { - const map = state.map; - // 设置图片图层 - if (map.resourceList && map.resourceList.length) { - map.resourceList.forEach(elem => { - if (!elem.zIndex) { - elem.zIndex = 1; - } - }); + if (state && state.map) { + const map = state.map + // 设置图片图层 + if (map.resourceList && map.resourceList.length) { + map.resourceList.forEach(elem => { + if (!elem.zIndex) { + elem.zIndex = 1 } + }) } + } } function handleOperation(state, models) { - const list = []; - models.forEach(item => { - if (item._dispose) { - list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.code]) }); - } else if (state.mapDevice[item.code]) { - list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.code]) }); - } else { - list.push({ operation: 'add', data: deepAssign({}, item) }); - } - }); - - if (list.length) { - if (state.stepData.length >= 15) { // 步骤数据最多储存15步 - state.stepData.pop(); - } - state.stepData.unshift(list); - state.recoverStepData = []; + const list = [] + models.forEach(item => { + if (item._dispose) { + list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.code]) }) + } else if (state.mapDevice[item.code]) { + list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.code]) }) + } else { + list.push({ operation: 'add', data: deepAssign({}, item) }) } + }) + + if (list.length) { + if (state.stepData.length >= 15) { + // 步骤数据最多储存15步 + state.stepData.pop() + } + state.stepData.unshift(list) + state.recoverStepData = [] + } } // 撤销 function revocation(state, models) { - if (models && models.length) { - const list = []; - const stepList = []; - models.forEach(item => { - switch (item.operation) { - case 'add': { - list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code])}); - stepList.push({...item.data, _dispose: true}); - break; - } - case 'del': { - list.push({ operation: 'add', data: deepAssign({}, item.data)}); - stepList.push({...item.data, _dispose: false}); - break; - } - case 'edit': { - list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)}); - stepList.push({...item.data, _dispose: false}); - break; - } - } - }); - state.recoverStepData.unshift(list); - return stepList; - } + if (models && models.length) { + const list = [] + const stepList = [] + models.forEach(item => { + switch (item.operation) { + case 'add': { + list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code]) }) + stepList.push({ ...item.data, _dispose: true }) + break + } + case 'del': { + list.push({ operation: 'add', data: deepAssign({}, item.data) }) + stepList.push({ ...item.data, _dispose: false }) + break + } + case 'edit': { + list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data) }) + stepList.push({ ...item.data, _dispose: false }) + break + } + } + }) + state.recoverStepData.unshift(list) + return stepList + } } // 恢复 function recover(state, models) { - if (models && models.length) { - const list = []; - const stepList = []; - models.forEach(item => { - switch (item.operation) { - case 'add': { - list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code])}); - stepList.push({...item.data, _dispose: true}); - break; - } - case 'del': { - list.push({ operation: 'add', data: deepAssign({}, item.data)}); - stepList.push({...item.data, _dispose: false}); - break; - } - case 'edit': { - list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)}); - stepList.push({...item.data, _dispose: false}); - break; - } - } - }); - state.stepData.unshift(list); - return stepList; - } + if (models && models.length) { + const list = [] + const stepList = [] + models.forEach(item => { + switch (item.operation) { + case 'add': { + list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code]) }) + stepList.push({ ...item.data, _dispose: true }) + break + } + case 'del': { + list.push({ operation: 'add', data: deepAssign({}, item.data) }) + stepList.push({ ...item.data, _dispose: false }) + break + } + case 'edit': { + list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data) }) + stepList.push({ ...item.data, _dispose: false }) + break + } + } + }) + state.stepData.unshift(list) + return stepList + } } // 过滤空值 删除 function filtrationModel(models) { - models.forEach(model => { - for (const key in model) { - if (typeof model[key] == 'string') { - if (!model[key]) { - delete model[key]; - } - } - if (model[key] == null || model[key] == undefined) { - delete model[key]; - } + models.forEach(model => { + for (const key in model) { + if (typeof model[key] == 'string') { + if (!model[key]) { + delete model[key] } - }); - return models; + } + if (model[key] == null || model[key] == undefined) { + delete model[key] + } + } + }) + return models } /** * 实训状态数据 */ const map = { - namespaced: true, + namespaced: true, - state: { - routeData: {}, // 进路数据 - routeList: [], // 进路list - routeStartSignalData: {}, // 进路始端信号机数据 - autoReentryData: {}, // 自动折返数据 - autoReentryList: [], // 自动折返list - signalApproachSectionData: {}, // 信号机接近区段数据 - signalApproachSectionList: [], // 信号机接近区段list - stepData: [], // 缓存数据 - mapName: '', // 地图名称 - mapConfig: [], // 地图所属线路配置 - recoverStepData: [], // 缓存恢复数据 - seclectDeviceList: [], // 包围框选中元素列表 - trainWindowSectionCode: '', // 选择车次窗所属区段code - flankProtectList: [], // 侧防列表 - map: null, // 地图数据 - dataZoom: {}, // 缩放位置 - mapDevice: {}, // 解析后的地图数据 - mapList: {}, // 地图数据列表 - mapViewLoadedCount: 0, // 地图视图加载完成标识 - mapDataLoadedCount: 0, // 地图数据加载完成标识 - mapStateLoadedCount: 0, // 地图状态变化完成标识 - mapDataLoadedScreenCount: 0, // 大屏加载完成 - mapStationStateUpdateCount: 0, // 车站状态刷新 - trainDetails: null, // 地图'列车详情'显示 - deleteCount: 0, // 绘图快捷删除标识 - updateCount: 0, // 绘图快捷修改标识 - mousemove: 0, // 实训战场图移动标识 - version: '', // 地图版本, - activeTrainListUpdate:0, // 当前按计划行车的列车列表更新标识 - runLineTrainUpdate:0, // 当前按计划行车列车运行线更新标识 - activeTrainListChange:0, // 当前按计划行车的列车列表变化标识(只对列车的groupNumber进行了检测) - activeTrainList:[], // 当前按计划行车的列车列表 - showCentralizedStationCode: '', // 现地分集中站显示(集中站code) - showCentralizedStationNum: 0, // 现地分集中站显示判断 - overlapList: [], // 延续保护list - overlapData: {}, // 延续保护数据 - holdStandList: [], // 扣车站台列表 - holdStatus: false, // 是否有扣车状态 - jumpStandList: [], // 跳停站台列表 - jumpStatus: false, // 是否有跳停状态 - // selectDeviceFlag: false, // 设备管理激活判断 - keyboardEnterCount: 0, // 键盘enter键触发 - controlTransfer:[], // 控制权转移消息 - mapDataParseCount: 0, - foldLineMap: {}, // 现地折行线map数据 - clearButtonCount: 0, // 清除操作按钮计数器 - stationControlMap: {} // 站控显示的map { 当前车站:显示车站列表 } + state: { + routeData: {}, // 进路数据 + routeList: [], // 进路list + routeStartSignalData: {}, // 进路始端信号机数据 + autoReentryData: {}, // 自动折返数据 + autoReentryList: [], // 自动折返list + signalApproachSectionData: {}, // 信号机接近区段数据 + signalApproachSectionList: [], // 信号机接近区段list + stepData: [], // 缓存数据 + mapName: '', // 地图名称 + mapConfig: [], // 地图所属线路配置 + recoverStepData: [], // 缓存恢复数据 + seclectDeviceList: [], // 包围框选中元素列表 + trainWindowSectionCode: '', // 选择车次窗所属区段code + flankProtectList: [], // 侧防列表 + map: null, // 地图数据 + dataZoom: {}, // 缩放位置 + mapDevice: {}, // 解析后的地图数据 + mapList: {}, // 地图数据列表 + mapViewLoadedCount: 0, // 地图视图加载完成标识 + mapDataLoadedCount: 0, // 地图数据加载完成标识 + mapStateLoadedCount: 0, // 地图状态变化完成标识 + mapDataLoadedScreenCount: 0, // 大屏加载完成 + mapStationStateUpdateCount: 0, // 车站状态刷新 + trainDetails: null, // 地图'列车详情'显示 + deleteCount: 0, // 绘图快捷删除标识 + updateCount: 0, // 绘图快捷修改标识 + mousemove: 0, // 实训战场图移动标识 + version: '', // 地图版本, + activeTrainListUpdate: 0, // 当前按计划行车的列车列表更新标识 + runLineTrainUpdate: 0, // 当前按计划行车列车运行线更新标识 + activeTrainListChange: 0, // 当前按计划行车的列车列表变化标识(只对列车的groupNumber进行了检测) + activeTrainList: [], // 当前按计划行车的列车列表 + showCentralizedStationCode: '', // 现地分集中站显示(集中站code) + showCentralizedStationNum: 0, // 现地分集中站显示判断 + overlapList: [], // 延续保护list + overlapData: {}, // 延续保护数据 + holdStandList: [], // 扣车站台列表 + holdStatus: false, // 是否有扣车状态 + jumpStandList: [], // 跳停站台列表 + jumpStatus: false, // 是否有跳停状态 + // selectDeviceFlag: false, // 设备管理激活判断 + keyboardEnterCount: 0, // 键盘enter键触发 + controlTransfer: [], // 控制权转移消息 + mapDataParseCount: 0, + foldLineMap: {}, // 现地折行线map数据 + clearButtonCount: 0, // 清除操作按钮计数器 + stationControlMap: {} // 站控显示的map { 当前车站:显示车站列表 } + }, + + getters: { + trainWindowSectionCode: state => { + return state.trainWindowSectionCode + }, + mapConfig: state => { + return state.mapConfig + }, + routeList: state => { + return state.routeList + }, + routeData: state => { + return state.routeData + }, + overlapList: state => { + return state.overlapList + }, + overlapData: state => { + return state.overlapData + }, + autoReentryData: state => { + return state.autoReentryData + }, + autoReentryList: state => { + return state.autoReentryList + }, + seclectDeviceList: state => { + return state.seclectDeviceList + }, + stepData: state => { + return state.stepData + }, + recoverStepData: state => { + return state.recoverStepData + }, + map: state => { + return state.map + }, + psdList: state => { + if (state.map) { + return state.map.psdList + } else { + return [] + } + }, + espList: state => { + if (state.map) { + return state.map.espList + } else { + return [] + } + }, + lineCode: state => { + if (state.map && state.map.skinVO) { + return state.map.skinVO.code + } + }, + name: state => { + if (state.map) { + return state.map.name + } else { + return null + } + }, + // version: (state) => { + // if (state.map) { + // return state.version; + // } else { + // return null; + // } + // }, + // linkList: (state) => { + // if (state.map) { + // return state.map.linkList; + // } else { + // return []; + // } + // }, + switchList: state => { + if (state.map) { + return state.map.switchList + } else { + return [] + } + }, + floodGateList: state => { + if (state.map) { + return state.map.floodGateList + } else { + return [] + } + }, + // buttonList: (state) => { + // if (state.map) { + // return state.map.buttonList; + // } else { + // return []; + // } + // }, + signalList: state => { + if (state.map) { + return state.map.signalList + } else { + return [] + } + }, + sectionList: state => { + if (state.map) { + return state.map.sectionList + } else { + return [] + } + }, + zcList: state => { + if (state.map) { + return state.map.zcList + } else { + return [] + } + }, + powerLineList: state => { + if (state.map) { + return state.map.powerLineList || [] + } else { + return [] + } + }, + tempSpeedLimitList: state => { + if (state.map) { + return state.map.tempSpeedLimitList + } else { + return [] + } + }, + lcList: state => { + if (state.map) { + return state.map.lcList + } else { + return [] + } + }, + tbStrategyList: state => { + if (state.map) { + return state.map.tbStrategyList || [] + } else { + return [] + } + }, + axleCounterResetButtonList: state => { + if (state.map) { + return state.map.axleCounterResetButtonList || [] + } else { + return [] + } + }, + totalGuideLockButtonVOList: state => { + if (state.map) { + return state.map.totalGuideLockButtonVOList || [] + } else { + return [] + } + }, + cycleButtonList: state => { + if (state.map) { + return state.map.cycleButtonList || [] + } else { + return [] + } + }, + outerFrameList: state => { + if (state.map) { + return state.map.outerFrameList || [] + } else { + return [] + } + }, + bigScreenConfig: state => { + if (state.map) { + return state.map.bigScreenConfig || {} + } else { + return {} + } + }, + indicatorLightList: state => { + if (state.map) { + return state.map.indicatorLightList || [] + } else { + return [] + } + }, + splitStationList: state => { + if (state.map) { + return state.map.splitStationList || [] + } else { + return [] + } + }, + automaticRouteButtonList: state => { + if (state.map) { + return state.map.automaticRouteButtonList || [] + } else { + return [] + } + }, + resourceList: state => { + if (state.map) { + return state.map.resourceList + } else { + return [] + } + }, + stationList: state => { + if (state.map) { + return state.map.stationList + } else { + return [] + } + }, + stationStandList: state => { + if (state.map) { + return state.map.stationStandList + } else { + return [] + } + }, + stationControlList: state => { + if (state.map) { + return state.map.stationControlList + } else { + return [] + } + }, + counterList: state => { + if (state.map) { + return state.map.counterList + } else { + return [] + } + }, + delayShowList: state => { + if (state.map) { + return state.map.delayShowList + } else { + return [] + } + }, + lineList: state => { + if (state.map) { + return state.map.lineList + } else { + return [] + } + }, + arrowList: state => { + if (state.map) { + return state.map.arrowList || [] + } else { + return [] + } + }, + textList: state => { + if (state.map) { + return state.map.textList + } else { + return [] + } + }, + rectList: state => { + if (state.map) { + return state.map.rectList || [] + } else { + return [] + } + }, + trainWindowList: state => { + if (state.map) { + return state.map.trainWindowList + } else { + return [] + } + }, + trainList: state => { + if (state.map) { + return state.map.trainList + } else { + return [] + } + }, + trainModelList: state => { + if (state.map) { + return state.map.trainModelList + } else { + return [] + } + }, + directionRodList: state => { + if (state.map) { + return state.map.directionRodList + } else { + return [] + } + }, + signalButtonList: state => { + if (state.map) { + return state.map.signalButtonList || [] + } else { + return [] + } + }, + responderList: state => { + if (state.map) { + return state.map.responderList || [] + } else { + return [] + } + }, + // trainDetails: (state) => { + // return state.trainDetails; + // }, + flankProtectList: state => { + return state.flankProtectList + }, + // mapDevice: (state) => { + // return state.mapDevice; + // }, + getDeviceByCode: state => code => { + return state.mapDevice[code] + }, + getApproachSectionByCode: state => code => { + return state.signalApproachSectionData[code] }, - getters: { - trainWindowSectionCode: (state) => { - return state.trainWindowSectionCode; - }, - mapConfig: (state) => { - return state.mapConfig; - }, - routeList: (state) => { - return state.routeList; - }, - routeData: (state) => { - return state.routeData; - }, - overlapList: (state) => { - return state.overlapList; - }, - overlapData: (state) => { - return state.overlapData; - }, - autoReentryData: (state) => { - return state.autoReentryData; - }, - autoReentryList: (state) => { - return state.autoReentryList; - }, - seclectDeviceList: (state) => { - return state.seclectDeviceList; - }, - stepData: (state) => { - return state.stepData; - }, - recoverStepData: (state) => { - return state.recoverStepData; - }, - map: (state) => { - return state.map; - }, - psdList: (state) => { - if (state.map) { - return state.map.psdList; - } else { - return []; - } - }, - espList: (state) => { - if (state.map) { - return state.map.espList; - } else { - return []; - } - }, - lineCode: (state) => { - if (state.map && state.map.skinVO) { - return state.map.skinVO.code; - } - }, - name: (state) => { - if (state.map) { - return state.map.name; - } else { - return null; - } - }, - // version: (state) => { - // if (state.map) { - // return state.version; - // } else { - // return null; - // } - // }, - // linkList: (state) => { - // if (state.map) { - // return state.map.linkList; - // } else { - // return []; - // } - // }, - switchList: (state) => { - if (state.map) { - return state.map.switchList; - } else { - return []; - } - }, - floodGateList: (state) => { - if (state.map) { - return state.map.floodGateList; - } else { - return []; - } - }, - // buttonList: (state) => { - // if (state.map) { - // return state.map.buttonList; - // } else { - // return []; - // } - // }, - signalList: (state) => { - if (state.map) { - return state.map.signalList; - } else { - return []; - } - }, - sectionList: (state) => { - if (state.map) { - return state.map.sectionList; - } else { - return []; - } - }, - zcList: (state) => { - if (state.map) { - return state.map.zcList; - } else { - return []; - } - }, - powerLineList: (state) => { - if (state.map) { - return state.map.powerLineList || []; - } else { - return []; - } - }, - tempSpeedLimitList: (state) => { - if (state.map) { - return state.map.tempSpeedLimitList; - } else { - return []; - } - }, - lcList: (state) => { - if (state.map) { - return state.map.lcList; - } else { - return []; - } - }, - tbStrategyList: (state) => { - if (state.map) { - return state.map.tbStrategyList || []; - } else { - return []; - } - }, - axleCounterResetButtonList: (state) => { - if (state.map) { - return state.map.axleCounterResetButtonList || []; - } else { - return []; - } - }, - totalGuideLockButtonVOList: (state) => { - if (state.map) { - return state.map.totalGuideLockButtonVOList || []; - } else { - return []; - } - }, - cycleButtonList: (state) => { - if (state.map) { - return state.map.cycleButtonList || []; - } else { - return []; - } - }, - outerFrameList: (state) => { - if (state.map) { - return state.map.outerFrameList || []; - } else { - return []; - } - }, - bigScreenConfig: (state) => { - if (state.map) { - return state.map.bigScreenConfig || {}; - } else { - return {}; - } - }, - indicatorLightList: (state) => { - if (state.map) { - return state.map.indicatorLightList || []; - } else { - return []; - } - }, - splitStationList: (state) => { - if (state.map) { - return state.map.splitStationList || []; - } else { - return []; - } - }, - automaticRouteButtonList: (state) => { - if (state.map) { - return state.map.automaticRouteButtonList || []; - } else { - return []; - } - }, - resourceList: (state) => { - if (state.map) { - return state.map.resourceList; - } else { - return []; - } - }, - stationList: (state) => { - if (state.map) { - return state.map.stationList; - } else { - return []; - } - }, - stationStandList: (state) => { - if (state.map) { - return state.map.stationStandList; - } else { - return []; - } - }, - stationControlList: (state) => { - if (state.map) { - return state.map.stationControlList; - } else { - return []; - } - }, - counterList: (state) => { - if (state.map) { - return state.map.counterList; - } else { - return []; - } - }, - delayShowList: (state) => { - if (state.map) { - return state.map.delayShowList; - } else { - return []; - } - }, - lineList: (state) => { - if (state.map) { - return state.map.lineList; - } else { - return []; - } - }, - arrowList: (state) => { - if (state.map) { - return state.map.arrowList || []; - } else { - return []; - } - }, - textList: (state) => { - if (state.map) { - return state.map.textList; - } else { - return []; - } - }, - rectList: (state) => { - if (state.map) { - return state.map.rectList || []; - } else { - return []; - } - }, - trainWindowList: (state) => { - if (state.map) { - return state.map.trainWindowList; - } else { - return []; - } - }, - trainList: (state) => { - if (state.map) { - return state.map.trainList; - } else { - return []; - } - }, - trainModelList: (state) => { - if (state.map) { - return state.map.trainModelList; - } else { - return []; - } - }, - directionRodList: (state) => { - if (state.map) { - return state.map.directionRodList; - } else { - return []; - } - }, - signalButtonList: (state) => { - if (state.map) { - return state.map.signalButtonList || []; - } else { - return []; - } - }, - responderList: (state) => { - if (state.map) { - return state.map.responderList || []; - } else { - return []; - } - }, - // trainDetails: (state) => { - // return state.trainDetails; - // }, - flankProtectList: (state) => { - return state.flankProtectList; - }, - // mapDevice: (state) => { - // return state.mapDevice; - // }, - getDeviceByCode: (state) => (code) => { - return state.mapDevice[code]; - }, - getApproachSectionByCode: (state) => (code) => { - return state.signalApproachSectionData[code]; - }, + // 查询区段关联的计数器 + getCounterBySectionCode: state => (code, type) => { + let device = null + var section = state.mapDevice[code] + if (section) { + state.map.counterList.forEach(counter => { + if (counter.stationCode === section.model.stationCode && type == counter.type) { + device = state.mapDevice[counter.code] + return + } + }) + } - // 查询区段关联的计数器 - getCounterBySectionCode: (state) => (code, type) => { - let device = null; - var section = state.mapDevice[code]; - if (section) { - state.map.counterList.forEach(counter => { - if (counter.stationCode === section.model.stationCode && type == counter.type) { - device = state.mapDevice[counter.code]; - return; - } - }); - } - - return device; - }, - - // 查询信号机关联的计数器 - getCounterBySingalCode: (state) => (code, type) => { - let device = null; - var signal = state.mapDevice[code]; - if (signal) { - state.map.counterList.forEach(counter => { - if (counter.stationCode === signal.model.stationCode && type == counter.type) { - device = state.mapDevice[counter.code]; - return; - } - }); - } - return device; - }, - - // // 查询所属车站关联的控制模式 - // getStationControlByStationCode: (state) => (code) => { - // let device = null; - // if (code && - // state.map && - // state.map.stationControlList && state.map.stationControlList.length) { - // state.map.stationControlList.forEach(elem => { - // if (elem.stationCode == code) { - // device = state.mapDevice[elem.code]; - // } - // }); - // } - - // return device; - // }, - - // 查询所属车站的控制模式 - getDeviceStationCodeByStationCode: (state) => (code) => { - let device = null; - if (code && - state.map && - state.map.stationList && state.map.stationList.length) { - state.map.stationList.forEach(elem => { - if (elem.code == code) { - device = state.mapDevice[elem.code]; - } - }); - } - - return device; - }, - getStationCodeByTrain: (state) => (train) => { - if (train && train.sectionCode) { - const section = state.mapDevice[train.sectionCode]; - if (section && section.stationCode) { - return state.mapDevice[section.stationCode]; - } - } - }, - // 通过循环区段来获取控制模式 - getDeviceTrainWindowCodeByStationCode: (state) => (code) => { - let device = null; - if (code && - state.map && - state.map.sectionList && state.map.sectionList.length) { - state.map.sectionList.forEach(elem => { - if (elem.trainWindowCode == code) { - state.trainWindowSectionCode = elem.code; - device = state.mapDevice[elem.stationCode]; - } - }); - } - - return device; - }, - checkDeviceShow: (state) => (stationCode, deviceCode) => { - if (state.map && state.map.displayList && state.map.displayList.length) { - let flag = false; - state.map.displayList.forEach(item => { - if (item.stationCodeList.includes(stationCode) && item.elementList.includes(deviceCode)) { - flag = true; - } - }); - return flag; - } else { - return true; - } - } + return device }, - mutations: { - // 改变地图数据索引 - flushMapRef: (state) => { - if (state.map) { - state.map.sectionList = [...state.map.sectionList || []]; - state.map.switchList = [...state.map.switchList || []]; - state.map.signalList = [...state.map.signalList || []]; - state.map.stationList = [...state.map.stationList || []]; - state.map.standList = [...state.map.standList || []]; - state.map.stationStandList = [...state.map.stationStandList || []]; - state.map.trainList = [...state.map.trainList || []]; - state.map.trainWindowList = [...state.map.trainWindowList || []]; - } - }, - // 设置地图名称 - setMapName: (state, name) => { - state.mapName = name; - }, - // 设置地图数据 - setMapData: (state, map) => { - if (map && map.skinVO) { - state.map = map; - let showConfig = {}; - if (Vue.prototype.$jlmap && (typeof (Vue.prototype.$jlmap.getShowConfig) === 'function')) { - showConfig = Vue.prototype.$jlmap.getShowConfig(); - } - const foldLineMap = {}; - (map.lineList || []).forEach(item => { - if (item.type === '03' && foldLineMap[item.stationCode]) { - foldLineMap[item.stationCode].push(item); - } else if (item.type === '03') { - foldLineMap[item.stationCode] = [item]; - } - }); - state.foldLineMap = foldLineMap; - const parser = parserFactory(ParserType.Graph.value); - state.mapDevice = parser.parser(map, map.skinVO.code, showConfig); - state.stationControlMap = {}; - map.stationList.forEach(station => { - if (station.ciStation) { - const centrailzedList = [station.code]; - state.stationControlMap[station.code] = centrailzedList; - station.relStationCodeList.forEach(relStationCode => { - state.stationControlMap[relStationCode] = centrailzedList; - if (state.mapDevice[relStationCode].centralized) { - centrailzedList.push(relStationCode); - } - }); - } - }); - Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice); - } else { - state.map = null; - state.mapDevice = {}; - } - }, - updateMapDevice: (state, list) => { - list.forEach(elem => { - state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem); - }); - }, - // 设置地图所属线路 - setMapConfig: (state, config) => { - state.mapConfig = config; - }, - // 获取包围框选中元素列表 - setSeclectDeviceList: (state, list) => { - state.seclectDeviceList = list; - }, - // 设置缩放位置 - setDataZoom: (state, dataZoom) => { - state.dataZoom = dataZoom; - }, - mapRender: (state, devices, type = ParserType.Graph.value) => { - if (devices && devices.length) { - if (state.map) { - const parser = parserFactory(type); - devices.forEach(elem => { parser.updateMapData(state, elem); }); - } - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.render(devices); - } - } - }, - setTrainDetails: (state, details) => { - state.trainDetails = details; - }, - mapViewLoadedCountIncrement: (state) => { - state.mapViewLoadedCount += 1; - }, - mapDataLoadedCountIncrement: (state) => { - state.mapDataLoadedCount += 1; - }, - mapStateLoadedCountIncrenment: (state) => { - state.mapStateLoadedCount += 1; - }, - mapViewLoadedScreenCountIncrement: (state) => { - state.mapDataLoadedScreenCount += 1; - }, - mapStationStateUpdate: (state) => { - state.mapStationStateUpdateCount += 1; - }, - operateTrainModel: (state, { model, type }) => { - if (state.map && model) { - const list = state.map.trainModelList || []; - if (type === 'ADD') { - const index = list.indexOf(list.find(elem => { return elem.code === model.code; })); - if (index < 0) { - list.push(Object.assign({}, model)); - } - } else if (type === 'UPT') { - const index = list.indexOf(list.find(elem => { return elem.code === model.code; })); - if (index >= 0) { - for (var prop in model) { - list[index][prop] = model[prop]; - } - } - } else if (type === 'DEL') { - const index = list.indexOf(list.find(elem => { return elem.code === model.code; })); - if (index >= 0) { - list.splice(index, 1); - } - - const trainList = state.map.trainList; - trainList.forEach(elem => { - if (elem.modelCode == model.code) { - elem['_dispose'] = true; - } - }); - - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.render(trainList); - } - } - } - }, - mapClear: (state) => { - state.map = null; - state.mapDevice = {}; - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clear(); - } - }, - updateMapStandData: (state, { models, type }) => { - models.forEach(item => { - if (!state.mapDevice[item.code]) { - state.mapDevice[item.code] = item; - state.map[type].push(item); - } - }); - }, - delMapStandData: (state, { models, type }) => { - models.forEach(item => { - if (state.mapDevice[item.code]) { - delete state.mapDevice[item.code]; - state.map[type].forEach((elem, index) => { - if (item.code == elem.code) { - state.map[type].splice(index, 1); - } - }); - } - }); - }, - setActiveTrainList:(state) => { - state.activeTrainListUpdate++; - }, - setRunLineTrain:(state) => { - state.runLineTrainUpdate++; - }, - resetActiveTrainList:(state, isBack) => { - state.activeTrainList = []; - if (!isBack) { - state.activeTrainListUpdate = 0; - state.activeTrainListChange = 0; - state.runLineTrainUpdate = 0; - } - }, - setDeleteCount: (state) => { - state.deleteCount++; - }, - setUpdateCount: (state) => { - state.updateCount++; - }, - setMousemove: (state) => { - state.mousemove++; - }, - // 设置进路数据 - setRouteData: (state, routeDataList) => { - state.routeData = {}; - state.routeStartSignalData = {}; - routeDataList.forEach(data => { - state.routeData[data.code] = data; - if (state.routeStartSignalData[data.startSignalCode] && state.routeStartSignalData[data.startSignalCode].length) { - state.routeStartSignalData[data.startSignalCode].push(data); - } else { - state.routeStartSignalData[data.startSignalCode] = [data]; - } - }); - state.map && state.map.automaticRouteButtonList && state.map.automaticRouteButtonList.forEach(item => { - state.routeData[item.automaticRouteCode].automaticRouteCode = item.code; - }); - state.routeList = routeDataList; - }, - setOverlapData: (state, overlapList) => { - state.overlapData = {}; - overlapList.forEach(data => { - state.overlapData[data.code] = data; - }); - state.overlapList = overlapList; - }, - setAutoReentryData: (state, autoReentryList) => { - state.autoReentryData = {}; - autoReentryList.forEach(data => { - state.autoReentryData[data.code] = data; - }); - state.map && state.map.cycleButtonList && state.map.cycleButtonList.forEach(item => { - state.autoReentryData[item.cycleCode].cycleButtonCode = item.code; - }); - state.autoReentryList = autoReentryList; - }, - setSignalApproachSectionData: (state, signalApproachSectionList) => { - state.signalApproachSectionData = {}; - signalApproachSectionList.forEach(data => { - state.signalApproachSectionData[data.signalCode] = data; - }); - state.signalApproachSectionList = signalApproachSectionList; - }, - updateRouteState: (state, status) => { - state.routeData[status.code] = deepAssign(state.routeData[status.code], status); - }, - updateAutoReentryState: (state, status) => { - state.autoReentryData[status.code] = deepAssign(state.autoReentryData[status.code], status); - }, - updateStationStand: (state, status) => { - const holdIndex = state.holdStandList.indexOf(status.code); - const jumpIndex = state.jumpStandList.indexOf(status.code); - const device = state.mapDevice[status.code]; - if ((device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex < 0) { - state.holdStandList.push(device.code); - } else if (!(device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex > -1) { - state.holdStandList.splice(holdIndex, 1); - } - state.holdStatus = state.holdStandList.length > 0; - if ((device.assignSkip || device.allSkip) && jumpIndex < 0) { - state.jumpStandList.push(device.code); - } else if (!(device.assignSkip || device.allSkip) && jumpIndex > -1) { - state.jumpStandList.splice(jumpIndex, 1); - } - state.jumpStatus = state.jumpStandList.length > 0; - }, - setMapVersion:(state, version) => { - state.version = version; - }, - setShowCentralizedStationCode: (state, stationCode) => { - state.showCentralizedStationCode = stationCode; - }, - setShowCentralizedStationNum: (state) => { - state.showCentralizedStationNum++; - }, - setFlankProtectList: (state, data) => { - state.flankProtectList.push(data); - }, - delFlankProtectList: (state, data) => { - state.flankProtectList.forEach((item, index) => { - if (item.code == data.code) { - state.flankProtectList.splice(index, 1); - } - }); - }, - // 更新激活的列车信息 - updateActiveTrainList: (state, data)=>{ - let isExist = false; - state.activeTrainList.forEach(elem => { - if (elem == data.code) { - isExist = true; - if (data.dispose) { - state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1); - state.activeTrainListChange += 1; - } - } - }); - if (!isExist) { state.activeTrainList.push(data.code); state.activeTrainListChange += 1; } - }, - selectDeviceCode: (state, data)=> { - state.selectDevice = { - flag: data.flag, - type: data.type - }; - }, - setKeyboardEnter: (state) => { - state.keyboardEnterCount++; - }, - setControlTransfer:(state, controlTransfer)=> { - state.controlTransfer = controlTransfer; - }, - mapDataParseCountIncrease: (state) => { - state.mapDataLoadedCount += 1; - }, - initSimulationButton: (state) => { - state.clearButtonCount += 1; - }, - clearStepData: (state) => { - state.stepData = []; - } + // 查询信号机关联的计数器 + getCounterBySingalCode: state => (code, type) => { + let device = null + var signal = state.mapDevice[code] + if (signal) { + state.map.counterList.forEach(counter => { + if (counter.stationCode === signal.model.stationCode && type == counter.type) { + device = state.mapDevice[counter.code] + return + } + }) + } + return device }, - actions: { - flushMapRef: ({ commit }) => { - commit('flushMapRef'); - }, - setMapData:({ commit }, mapData) => { - commit('setMapData', mapData); - }, - setReleaseMapData: ({ commit }, mapData) => { - mapData.graphDataNew && mapData.graphDataNew.trainList && mapData.graphDataNew.trainList.forEach(item => { - item.code = item.groupNumber; - }); - mapData.graphDataNew.signalApproachSectionList = mapData.logicDataNew.signalApproachSectionList; - const overlapData = mapData.logicDataNew.overlapList; - overlapData.forEach(item => { - item._type = 'OverAp'; - }); - mapData.graphDataNew.overlapList = overlapData; + // // 查询所属车站关联的控制模式 + // getStationControlByStationCode: (state) => (code) => { + // let device = null; + // if (code && + // state.map && + // state.map.stationControlList && state.map.stationControlList.length) { + // state.map.stationControlList.forEach(elem => { + // if (elem.stationCode == code) { + // device = state.mapDevice[elem.code]; + // } + // }); + // } - commit('setMapName', mapData.name); - commit('setMapData', mapData.graphDataNew); - commit('setRouteData', mapData.logicDataNew.routeList); - commit('setOverlapData', overlapData); - commit('setAutoReentryData', mapData.logicDataNew.autoReentryList); - commit('setSignalApproachSectionData', mapData.logicDataNew.signalApproachSectionList); - commit('setMapConfig', mapData.configVO); - commit('setMapVersion', mapData.version); - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clearTrainView(); - } - store.dispatch('training/setMapDefaultState'); - }, - setPreviewMapData: ({ commit }, mapData) => { - commit('setMapData', mapData.graphDataNew); - store.dispatch('training/over'); - store.dispatch('training/setMapDefaultState'); - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clearTrainView(); - } - }, - mapClear:({ commit }) => { - commit('mapClear'); - }, - setOverlapData: ({ commit }, overlapData) => { - commit('setOverlapData', overlapData); - commit('mapRender', overlapData); - }, - setAutoReentryData: ({ commit }, autoReentryData) => { - commit('setAutoReentryData', autoReentryData); - }, - setSignalApproachSectionData: ({ commit }, signalApproachSectionList) => { - commit('setSignalApproachSectionData', signalApproachSectionList); - }, - updateRouteState: ({ commit }, status) => { // 设置进路数据状态 - commit('updateRouteState', status); - }, - updateAutoReentryState: ({ commit }, status) => { - commit('updateAutoReentryState', status); - }, - updateStationStand: ({ commit }, status) => { - commit('updateStationStand', status); - }, - getRouteDataListByCode: ({ state, commit }, code) => { // 获取进路数据 - return new Promise((resolve) => { - const list = []; - const routeList = Object.values(state.routeData); - routeList.forEach(route => { - if (route.startSignalCode == code) { - list.push(route); - } - }); - resolve(list); - }); - }, + // return device; + // }, - setTrainDetails: ({ commit }, message) => { - commit('setTrainDetails', message); - }, + // 查询所属车站的控制模式 + getDeviceStationCodeByStationCode: state => code => { + let device = null + if (code && state.map && state.map.stationList && state.map.stationList.length) { + state.map.stationList.forEach(elem => { + if (elem.code == code) { + device = state.mapDevice[elem.code] + } + }) + } - updateMapDevices: ({ commit, state }, models) => { - return new Promise((resolve) => { - if (!(models instanceof Array)) { - models = [models]; - } - // 过滤 空/null/undefined value 值 - const dictList = filtrationModel(models); - - // 查找向上关联需要一起删除的设备 - const dict = {}; - dictList.forEach((model) => { - if (model['_dispose']) { - queryDeleteModels(state, model, dict); - } else { - dict[model.code] = model; - } - }); - const list = Object.values(dict); - if (window.location.href.includes('/design/usermap/map/draw')) { handleOperation(state, list); } - commit('mapRender', list); - resolve(list); - }); - }, - - updateSystemMapDevices: ({ commit, state }, models) => { - return new Promise((resolve) => { - if (!(models instanceof Array)) { - models = [models]; - } - // 过滤 空/null/undefined value 值 - const dictList = filtrationModel(models); - - // 查找向上关联需要一起删除的设备 - const dict = {}; - dictList.forEach((model) => { - if (model['_dispose']) { - dict[model.code] = {...model, _dispose: true }; - } else { - dict[model.code] = model; - } - }); - const list = Object.values(dict); - if (window.location.href.includes('/design/usermap/map/systemDraw')) { handleOperation(state, list); } - commit('mapRender', list, ParserType.systemGraph.value); - resolve(list); - }); - }, - - setRevocation({ state, commit }) { - commit('mapRender', revocation(state, state.stepData.shift() || [])); // 撤销 - }, - - setRecover({ state, commit }) { - commit('mapRender', recover(state, state.recoverStepData.shift() || [])); // 恢复 - }, - - saveMapDeviceDefaultRelations({ state }) { - saveMapDeviceDefaultRelations(state); - }, - - mapViewLoaded: ({ commit }) => { - commit('mapViewLoadedCountIncrement'); - }, - - mapViewScreenLoaded: ({ commit }) => { - commit('mapViewLoadedScreenCountIncrement'); - }, - - mapDataLoaded: ({ commit }) => { - commit('mapDataLoadedCountIncrement'); - }, - - mapStateLoaded:({ commit }) => { - commit('mapStateLoadedCountIncrenment'); - }, - - clearJlmapTrainView: () => { - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clearTrainView(); - } - }, - - setTrainWindowShow: ({commit, state}, show) => { - if (state.map) { - var deviceList = []; - var trainWindowList = state.map.trainWindowList; - - if (trainWindowList && trainWindowList.length) { - trainWindowList.forEach(elem => { - elem._type = deviceType.TrainWindow; - elem.trainWindowShow = show; - if (state.mapDevice[elem.code] && state.mapDevice[elem.code].instance) { - elem.isShowShape = state.mapDevice[elem.code].instance.isShowShape; - } else { - elem.isShowShape = true; - } - deviceList.push(elem); - }); - } - - commit('mapRender', deviceList); - } - }, - - operateTrainModel: ({ commit }, { model, type }) => { - commit('operateTrainModel', { model, type }); - }, - - updateMapStandData: ({ commit }, { models, type }) => { - commit('updateMapStandData', { models, type }); - }, - - delMapStandData: ({ commit }, { models, type }) => { - commit('delMapStandData', { models, type }); - }, - setDeleteCount: ({ commit }) => { - commit('setDeleteCount'); - }, - setActiveTrainList: ({ commit }) => { - commit('setActiveTrainList'); - }, - setRunLineTrain: ({ commit }) => { - commit('setRunLineTrain'); - }, - resetActiveTrainList: ({ commit }, isBack) => { - commit('resetActiveTrainList', isBack); - }, - setUpdateCount: ({ commit }) => { - commit('setUpdateCount'); - }, - - setMousemove: ({ commit }) => { - commit('setMousemove'); - }, - setMapVersion: ({commit}, version) => { - commit('setMapVersion', version); - }, - setShowCentralizedStationCode: ({commit}, stationCode) => { - commit('setShowCentralizedStationCode', stationCode); - }, - setShowCentralizedStationNum: ({commit}) => { - commit('setShowCentralizedStationNum'); - }, - setFlankProtectList: ({ commit }, data) => { - commit('setFlankProtectList', data); - }, - delFlankProtectList: ({ commit }, data) => { - commit('delFlankProtectList', data); - }, - selectDeviceCode: ({ commit }, data) => { - commit('selectDeviceCode', data); - }, - setKeyboardEnter: ({ commit }) => { - commit('setKeyboardEnter'); - }, - setControlTransfer:({ commit }, data) => { - commit('setControlTransfer', data); - }, - mapDataParseCountIncrease: ({ commit }) => { - commit('mapDataParseCountIncrease'); - }, - initSimulationButton: ({ commit }) => { - commit('initSimulationButton'); + return device + }, + getStationCodeByTrain: state => train => { + if (train && train.sectionCode) { + const section = state.mapDevice[train.sectionCode] + if (section && section.stationCode) { + return state.mapDevice[section.stationCode] } + } + }, + // 通过循环区段来获取控制模式 + getDeviceTrainWindowCodeByStationCode: state => code => { + let device = null + if (code && state.map && state.map.sectionList && state.map.sectionList.length) { + state.map.sectionList.forEach(elem => { + if (elem.trainWindowCode == code) { + state.trainWindowSectionCode = elem.code + device = state.mapDevice[elem.stationCode] + } + }) + } + + return device + }, + checkDeviceShow: state => (stationCode, deviceCode) => { + if (state.map && state.map.displayList && state.map.displayList.length) { + let flag = false + state.map.displayList.forEach(item => { + if ( + store.state.training.prdType === '01' && + item.type === 'LOCAL' && + item.stationCodeList.includes(stationCode) && + item.elementList.includes(deviceCode) + ) { + flag = true + } else if (store.state.training.prdType === '02' && item.type === 'CENTER' && item.elementList.includes(deviceCode)) { + flag = true + } else if (store.state.training.prdType === '09' && item.type === 'DEPOT_IL' && item.elementList.includes(deviceCode)) { + flag = true + } + }) + return flag + } else { + return true + } } -}; + }, -export default map; + mutations: { + // 改变地图数据索引 + flushMapRef: state => { + if (state.map) { + state.map.sectionList = [...(state.map.sectionList || [])] + state.map.switchList = [...(state.map.switchList || [])] + state.map.signalList = [...(state.map.signalList || [])] + state.map.stationList = [...(state.map.stationList || [])] + state.map.standList = [...(state.map.standList || [])] + state.map.stationStandList = [...(state.map.stationStandList || [])] + state.map.trainList = [...(state.map.trainList || [])] + state.map.trainWindowList = [...(state.map.trainWindowList || [])] + } + }, + // 设置地图名称 + setMapName: (state, name) => { + state.mapName = name + }, + // 设置地图数据 + setMapData: (state, map) => { + if (map && map.skinVO) { + state.map = map + let showConfig = {} + if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { + showConfig = Vue.prototype.$jlmap.getShowConfig() + } + const foldLineMap = {} + ;(map.lineList || []).forEach(item => { + if (item.type === '03' && foldLineMap[item.stationCode]) { + foldLineMap[item.stationCode].push(item) + } else if (item.type === '03') { + foldLineMap[item.stationCode] = [item] + } + }) + state.foldLineMap = foldLineMap + const parser = parserFactory(ParserType.Graph.value) + state.mapDevice = parser.parser(map, map.skinVO.code, showConfig) + state.stationControlMap = {} + map.stationList.forEach(station => { + if (station.ciStation) { + const centrailzedList = [station.code] + state.stationControlMap[station.code] = centrailzedList + station.relStationCodeList.forEach(relStationCode => { + state.stationControlMap[relStationCode] = centrailzedList + if (state.mapDevice[relStationCode].centralized) { + centrailzedList.push(relStationCode) + } + }) + } + }) + Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice) + } else { + state.map = null + state.mapDevice = {} + } + }, + importMapData: (state, data) => { + let showConfig = {} + if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { + showConfig = Vue.prototype.$jlmap.getShowConfig() + } + Object.keys(data).forEach(key => { + state.map[key] = deepAssign(state.map[key] || {}, data[key]) + }) + const parser = parserFactory(ParserType.Graph.value) + state.mapDevice = parser.parser(state.map, state.map.skinVO.code, showConfig) + Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice) + Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice) + console.log(state.mapDevice) + }, + updateMapDevice: (state, list) => { + list.forEach(elem => { + state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem) + }) + }, + // 设置地图所属线路 + setMapConfig: (state, config) => { + state.mapConfig = config + }, + // 获取包围框选中元素列表 + setSeclectDeviceList: (state, list) => { + state.seclectDeviceList = list + }, + // 设置缩放位置 + setDataZoom: (state, dataZoom) => { + state.dataZoom = dataZoom + }, + mapRender: (state, devices, type = ParserType.Graph.value) => { + if (devices && devices.length) { + if (state.map) { + const parser = parserFactory(type) + devices.forEach(elem => { + parser.updateMapData(state, elem) + }) + } + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.render(devices) + } + } + }, + setTrainDetails: (state, details) => { + state.trainDetails = details + }, + mapViewLoadedCountIncrement: state => { + state.mapViewLoadedCount += 1 + }, + mapDataLoadedCountIncrement: state => { + state.mapDataLoadedCount += 1 + }, + mapStateLoadedCountIncrenment: state => { + state.mapStateLoadedCount += 1 + }, + mapViewLoadedScreenCountIncrement: state => { + state.mapDataLoadedScreenCount += 1 + }, + mapStationStateUpdate: state => { + state.mapStationStateUpdateCount += 1 + }, + operateTrainModel: (state, { model, type }) => { + if (state.map && model) { + const list = state.map.trainModelList || [] + if (type === 'ADD') { + const index = list.indexOf( + list.find(elem => { + return elem.code === model.code + }) + ) + if (index < 0) { + list.push(Object.assign({}, model)) + } + } else if (type === 'UPT') { + const index = list.indexOf( + list.find(elem => { + return elem.code === model.code + }) + ) + if (index >= 0) { + for (var prop in model) { + list[index][prop] = model[prop] + } + } + } else if (type === 'DEL') { + const index = list.indexOf( + list.find(elem => { + return elem.code === model.code + }) + ) + if (index >= 0) { + list.splice(index, 1) + } + + const trainList = state.map.trainList + trainList.forEach(elem => { + if (elem.modelCode == model.code) { + elem['_dispose'] = true + } + }) + + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.render(trainList) + } + } + } + }, + mapClear: state => { + state.map = null + state.mapDevice = {} + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clear() + } + }, + updateMapStandData: (state, { models, type }) => { + models.forEach(item => { + if (!state.mapDevice[item.code]) { + state.mapDevice[item.code] = item + state.map[type].push(item) + } + }) + }, + delMapStandData: (state, { models, type }) => { + models.forEach(item => { + if (state.mapDevice[item.code]) { + delete state.mapDevice[item.code] + state.map[type].forEach((elem, index) => { + if (item.code == elem.code) { + state.map[type].splice(index, 1) + } + }) + } + }) + }, + setActiveTrainList: state => { + state.activeTrainListUpdate++ + }, + setRunLineTrain: state => { + state.runLineTrainUpdate++ + }, + resetActiveTrainList: (state, isBack) => { + state.activeTrainList = [] + if (!isBack) { + state.activeTrainListUpdate = 0 + state.activeTrainListChange = 0 + state.runLineTrainUpdate = 0 + } + }, + setDeleteCount: state => { + state.deleteCount++ + }, + setUpdateCount: state => { + state.updateCount++ + }, + setMousemove: state => { + state.mousemove++ + }, + // 设置进路数据 + setRouteData: (state, routeDataList) => { + state.routeData = {} + state.routeStartSignalData = {} + routeDataList.forEach(data => { + state.routeData[data.code] = data + if (state.routeStartSignalData[data.startSignalCode] && state.routeStartSignalData[data.startSignalCode].length) { + state.routeStartSignalData[data.startSignalCode].push(data) + } else { + state.routeStartSignalData[data.startSignalCode] = [data] + } + }) + state.map && + state.map.automaticRouteButtonList && + state.map.automaticRouteButtonList.forEach(item => { + state.routeData[item.automaticRouteCode].automaticRouteCode = item.code + }) + state.routeList = routeDataList + }, + setOverlapData: (state, overlapList) => { + state.overlapData = {} + overlapList.forEach(data => { + state.overlapData[data.code] = data + }) + state.overlapList = overlapList + }, + setAutoReentryData: (state, autoReentryList) => { + state.autoReentryData = {} + autoReentryList.forEach(data => { + state.autoReentryData[data.code] = data + }) + state.map && + state.map.cycleButtonList && + state.map.cycleButtonList.forEach(item => { + state.autoReentryData[item.cycleCode].cycleButtonCode = item.code + }) + state.autoReentryList = autoReentryList + }, + setSignalApproachSectionData: (state, signalApproachSectionList) => { + state.signalApproachSectionData = {} + signalApproachSectionList.forEach(data => { + state.signalApproachSectionData[data.signalCode] = data + }) + state.signalApproachSectionList = signalApproachSectionList + }, + updateRouteState: (state, status) => { + state.routeData[status.code] = deepAssign(state.routeData[status.code], status) + }, + updateAutoReentryState: (state, status) => { + state.autoReentryData[status.code] = deepAssign(state.autoReentryData[status.code], status) + }, + updateStationStand: (state, status) => { + const holdIndex = state.holdStandList.indexOf(status.code) + const jumpIndex = state.jumpStandList.indexOf(status.code) + const device = state.mapDevice[status.code] + if ((device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex < 0) { + state.holdStandList.push(device.code) + } else if (!(device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex > -1) { + state.holdStandList.splice(holdIndex, 1) + } + state.holdStatus = state.holdStandList.length > 0 + if ((device.assignSkip || device.allSkip) && jumpIndex < 0) { + state.jumpStandList.push(device.code) + } else if (!(device.assignSkip || device.allSkip) && jumpIndex > -1) { + state.jumpStandList.splice(jumpIndex, 1) + } + state.jumpStatus = state.jumpStandList.length > 0 + }, + setMapVersion: (state, version) => { + state.version = version + }, + setShowCentralizedStationCode: (state, stationCode) => { + state.showCentralizedStationCode = stationCode + }, + setShowCentralizedStationNum: state => { + state.showCentralizedStationNum++ + }, + setFlankProtectList: (state, data) => { + state.flankProtectList.push(data) + }, + delFlankProtectList: (state, data) => { + state.flankProtectList.forEach((item, index) => { + if (item.code == data.code) { + state.flankProtectList.splice(index, 1) + } + }) + }, + // 更新激活的列车信息 + updateActiveTrainList: (state, data) => { + let isExist = false + state.activeTrainList.forEach(elem => { + if (elem == data.code) { + isExist = true + if (data.dispose) { + state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1) + state.activeTrainListChange += 1 + } + } + }) + if (!isExist) { + state.activeTrainList.push(data.code) + state.activeTrainListChange += 1 + } + }, + selectDeviceCode: (state, data) => { + state.selectDevice = { + flag: data.flag, + type: data.type + } + }, + setKeyboardEnter: state => { + state.keyboardEnterCount++ + }, + setControlTransfer: (state, controlTransfer) => { + state.controlTransfer = controlTransfer + }, + mapDataParseCountIncrease: state => { + state.mapDataLoadedCount += 1 + }, + initSimulationButton: state => { + state.clearButtonCount += 1 + }, + clearStepData: state => { + state.stepData = [] + } + }, + + actions: { + flushMapRef: ({ commit }) => { + commit('flushMapRef') + }, + setMapData: ({ commit }, mapData) => { + commit('setMapData', mapData) + }, + setReleaseMapData: ({ commit }, mapData) => { + mapData.graphDataNew && + mapData.graphDataNew.trainList && + mapData.graphDataNew.trainList.forEach(item => { + item.code = item.groupNumber + }) + mapData.graphDataNew.signalApproachSectionList = mapData.logicDataNew.signalApproachSectionList + const overlapData = mapData.logicDataNew.overlapList + overlapData.forEach(item => { + item._type = 'OverAp' + }) + mapData.graphDataNew.overlapList = overlapData + + commit('setMapName', mapData.name) + commit('setMapData', mapData.graphDataNew) + commit('setRouteData', mapData.logicDataNew.routeList) + commit('setOverlapData', overlapData) + commit('setAutoReentryData', mapData.logicDataNew.autoReentryList) + commit('setSignalApproachSectionData', mapData.logicDataNew.signalApproachSectionList) + commit('setMapConfig', mapData.configVO) + commit('setMapVersion', mapData.version) + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clearTrainView() + } + store.dispatch('training/setMapDefaultState') + }, + setPreviewMapData: ({ commit }, mapData) => { + commit('setMapData', mapData.graphDataNew) + store.dispatch('training/over') + store.dispatch('training/setMapDefaultState') + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clearTrainView() + } + }, + mapClear: ({ commit }) => { + commit('mapClear') + }, + setOverlapData: ({ commit }, overlapData) => { + commit('setOverlapData', overlapData) + commit('mapRender', overlapData) + }, + setAutoReentryData: ({ commit }, autoReentryData) => { + commit('setAutoReentryData', autoReentryData) + }, + setSignalApproachSectionData: ({ commit }, signalApproachSectionList) => { + commit('setSignalApproachSectionData', signalApproachSectionList) + }, + updateRouteState: ({ commit }, status) => { + // 设置进路数据状态 + commit('updateRouteState', status) + }, + updateAutoReentryState: ({ commit }, status) => { + commit('updateAutoReentryState', status) + }, + updateStationStand: ({ commit }, status) => { + commit('updateStationStand', status) + }, + getRouteDataListByCode: ({ state, commit }, code) => { + // 获取进路数据 + return new Promise(resolve => { + const list = [] + const routeList = Object.values(state.routeData) + routeList.forEach(route => { + if (route.startSignalCode == code) { + list.push(route) + } + }) + resolve(list) + }) + }, + + setTrainDetails: ({ commit }, message) => { + commit('setTrainDetails', message) + }, + + updateMapDevices: ({ commit, state }, models) => { + return new Promise(resolve => { + if (!(models instanceof Array)) { + models = [models] + } + // 过滤 空/null/undefined value 值 + const dictList = filtrationModel(models) + + // 查找向上关联需要一起删除的设备 + const dict = {} + dictList.forEach(model => { + if (model['_dispose']) { + queryDeleteModels(state, model, dict) + } else { + dict[model.code] = model + } + }) + const list = Object.values(dict) + if (window.location.href.includes('/design/usermap/map/draw')) { + handleOperation(state, list) + } + commit('mapRender', list) + resolve(list) + }) + }, + + updateSystemMapDevices: ({ commit, state }, models) => { + return new Promise(resolve => { + if (!(models instanceof Array)) { + models = [models] + } + // 过滤 空/null/undefined value 值 + const dictList = filtrationModel(models) + + // 查找向上关联需要一起删除的设备 + const dict = {} + dictList.forEach(model => { + if (model['_dispose']) { + dict[model.code] = { ...model, _dispose: true } + } else { + dict[model.code] = model + } + }) + const list = Object.values(dict) + if (window.location.href.includes('/design/usermap/map/systemDraw')) { + handleOperation(state, list) + } + commit('mapRender', list, ParserType.systemGraph.value) + resolve(list) + }) + }, + + setRevocation({ state, commit }) { + commit('mapRender', revocation(state, state.stepData.shift() || [])) // 撤销 + }, + + setRecover({ state, commit }) { + commit('mapRender', recover(state, state.recoverStepData.shift() || [])) // 恢复 + }, + + saveMapDeviceDefaultRelations({ state }) { + saveMapDeviceDefaultRelations(state) + }, + + mapViewLoaded: ({ commit }) => { + commit('mapViewLoadedCountIncrement') + }, + + mapViewScreenLoaded: ({ commit }) => { + commit('mapViewLoadedScreenCountIncrement') + }, + + mapDataLoaded: ({ commit }) => { + commit('mapDataLoadedCountIncrement') + }, + + mapStateLoaded: ({ commit }) => { + commit('mapStateLoadedCountIncrenment') + }, + + clearJlmapTrainView: () => { + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clearTrainView() + } + }, + + setTrainWindowShow: ({ commit, state }, show) => { + if (state.map) { + var deviceList = [] + var trainWindowList = state.map.trainWindowList + + if (trainWindowList && trainWindowList.length) { + trainWindowList.forEach(elem => { + elem._type = deviceType.TrainWindow + elem.trainWindowShow = show + if (state.mapDevice[elem.code] && state.mapDevice[elem.code].instance) { + elem.isShowShape = state.mapDevice[elem.code].instance.isShowShape + } else { + elem.isShowShape = true + } + deviceList.push(elem) + }) + } + + commit('mapRender', deviceList) + } + }, + + operateTrainModel: ({ commit }, { model, type }) => { + commit('operateTrainModel', { model, type }) + }, + + updateMapStandData: ({ commit }, { models, type }) => { + commit('updateMapStandData', { models, type }) + }, + + delMapStandData: ({ commit }, { models, type }) => { + commit('delMapStandData', { models, type }) + }, + setDeleteCount: ({ commit }) => { + commit('setDeleteCount') + }, + setActiveTrainList: ({ commit }) => { + commit('setActiveTrainList') + }, + setRunLineTrain: ({ commit }) => { + commit('setRunLineTrain') + }, + resetActiveTrainList: ({ commit }, isBack) => { + commit('resetActiveTrainList', isBack) + }, + setUpdateCount: ({ commit }) => { + commit('setUpdateCount') + }, + + setMousemove: ({ commit }) => { + commit('setMousemove') + }, + setMapVersion: ({ commit }, version) => { + commit('setMapVersion', version) + }, + setShowCentralizedStationCode: ({ commit }, stationCode) => { + commit('setShowCentralizedStationCode', stationCode) + }, + setShowCentralizedStationNum: ({ commit }) => { + commit('setShowCentralizedStationNum') + }, + setFlankProtectList: ({ commit }, data) => { + commit('setFlankProtectList', data) + }, + delFlankProtectList: ({ commit }, data) => { + commit('delFlankProtectList', data) + }, + selectDeviceCode: ({ commit }, data) => { + commit('selectDeviceCode', data) + }, + setKeyboardEnter: ({ commit }) => { + commit('setKeyboardEnter') + }, + setControlTransfer: ({ commit }, data) => { + commit('setControlTransfer', data) + }, + mapDataParseCountIncrease: ({ commit }) => { + commit('mapDataParseCountIncrease') + }, + initSimulationButton: ({ commit }) => { + commit('initSimulationButton') + } + } +} + +export default map diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index a919aec35..7cda5ac1d 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,15 +2,14 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - // BASE_API = 'https://test.joylink.club/jlcloud'; + BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.8.107:9000'; // 袁琪 - // BASE_API = 'http://192.168.2.175:9000'; // 旭强 有线 - // BASE_API = 'http://192.168.8.167:9000'; // 旭强 无线 + BASE_API = 'http://192.168.8.177:9000'; // 旭强 // BASE_API = 'http://192.168.2.183:9000'; // 张赛 // BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 - BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 + // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 } else { BASE_API = process.env.VUE_APP_BASE_API; } diff --git a/src/views/jlmap3d/passflow/jl3dpassflow.vue b/src/views/jlmap3d/passflow/jl3dpassflow.vue index db454f009..ecbaea8aa 100644 --- a/src/views/jlmap3d/passflow/jl3dpassflow.vue +++ b/src/views/jlmap3d/passflow/jl3dpassflow.vue @@ -1,38 +1,32 @@ diff --git a/src/views/newMap/displayCity/index.vue b/src/views/newMap/displayCity/index.vue index 7d0ae062f..7b82699f2 100644 --- a/src/views/newMap/displayCity/index.vue +++ b/src/views/newMap/displayCity/index.vue @@ -208,12 +208,12 @@ export default { }, // 通过showMode切换显示效果 switchModeInner(swch) { - let showMode = '03'; - if (swch == '01') { - showMode = '03'; - } else if (swch == '02') { - showMode = '02'; - } + // let showMode = '03'; + // if (swch == '01') { + // showMode = '03'; + // } else if (swch == '02') { + // showMode = '02'; + // } const list = []; const mapDevice = this.$store.state.map.mapDevice; @@ -227,7 +227,7 @@ export default { this.$jlmap.updateShowStation(list, ''); // 显示全部元素 } - this.$jlmap.updateShowMode(list, showMode); // 二次过滤 + // this.$jlmap.updateShowMode(list, showMode); // 二次过滤 }, // 加载地图数据 loadMapData() { diff --git a/src/views/newMap/jlmapNew/index.vue b/src/views/newMap/jlmapNew/index.vue index 8894b7e1f..37098fd22 100644 --- a/src/views/newMap/jlmapNew/index.vue +++ b/src/views/newMap/jlmapNew/index.vue @@ -513,7 +513,6 @@ export default { this.$jlmap.updateShowStation(list, stationCode); !setCenter && this.setCenter(stationCode); - // } }, setOffset(data, num, sum, obj) { this.$jlmap.switchScreen(data, num, sum, obj); diff --git a/src/views/newMap/jointTrainingNew/index.vue b/src/views/newMap/jointTrainingNew/index.vue index 1fa5a659a..12c7d1052 100644 --- a/src/views/newMap/jointTrainingNew/index.vue +++ b/src/views/newMap/jointTrainingNew/index.vue @@ -563,7 +563,6 @@ export default { } this.$jlmap.updateShowStation(list, showStation); this.$jlmap.setCenter(showStation); - // } }, setCentralizedstationList(map) { this.centralizedstationList = []; diff --git a/src/views/newMap/newMapdraft/elementImport.vue b/src/views/newMap/newMapdraft/elementImport.vue new file mode 100644 index 000000000..43f131a96 --- /dev/null +++ b/src/views/newMap/newMapdraft/elementImport.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/views/newMap/newMapdraft/index.vue b/src/views/newMap/newMapdraft/index.vue index 2156ca7ca..59ecded3c 100644 --- a/src/views/newMap/newMapdraft/index.vue +++ b/src/views/newMap/newMapdraft/index.vue @@ -3,7 +3,7 @@
-
+
撤销 恢复 @@ -11,12 +11,15 @@
返回 - 更新坐标 + 更新坐标 + 导入元素
-
-
+
+
+ +
+
diff --git a/src/views/newMap/newMapdraft/mapoperate/checkboxDraft.vue b/src/views/newMap/newMapdraft/mapoperate/checkboxDraft.vue index de3414451..18fb78e0a 100644 --- a/src/views/newMap/newMapdraft/mapoperate/checkboxDraft.vue +++ b/src/views/newMap/newMapdraft/mapoperate/checkboxDraft.vue @@ -21,12 +21,7 @@
- +
@@ -34,11 +29,23 @@ 清空
+ +
+ 批量导出 + 清空 +
+
-
+
{{ item.name }}
-
+
{{ nor.name }}
@@ -49,248 +56,282 @@ diff --git a/src/views/newMap/newMapdraft/mapoperate/displayConfig/centerConfig.vue b/src/views/newMap/newMapdraft/mapoperate/displayConfig/centerConfig.vue new file mode 100644 index 000000000..12a892c63 --- /dev/null +++ b/src/views/newMap/newMapdraft/mapoperate/displayConfig/centerConfig.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/src/views/newMap/newMapdraft/mapoperate/displayConfig/depotConfig.vue b/src/views/newMap/newMapdraft/mapoperate/displayConfig/depotConfig.vue new file mode 100644 index 000000000..dc0ab224a --- /dev/null +++ b/src/views/newMap/newMapdraft/mapoperate/displayConfig/depotConfig.vue @@ -0,0 +1,221 @@ + + + + + diff --git a/src/views/newMap/newMapdraft/mapoperate/localConfig.vue b/src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue similarity index 78% rename from src/views/newMap/newMapdraft/mapoperate/localConfig.vue rename to src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue index a6d58382c..8010d9981 100644 --- a/src/views/newMap/newMapdraft/mapoperate/localConfig.vue +++ b/src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue @@ -65,7 +65,8 @@
- 按集中站生成并保存 + 按集中站生成 + 全显生成 保存 返回
@@ -91,7 +92,9 @@ export default { data() { return { tableData: [], + otherData: [], addModel: { + type: 'LOCAL', stationCodeList: [], switchStationCodeList:[], elementList: [] @@ -125,7 +128,6 @@ export default { 'tempSpeedLimitList', 'textList', 'totalGuideLockButtonVOList', - 'localStationConfig', 'seclectDeviceList' ]), cardTitle() { @@ -158,7 +160,14 @@ export default { // } // }, initData() { - this.tableData = this.$store.state.map.map.displayList || []; + // this.tableData = (this.$store.state.map.map.displayList || []).filter(item => item.type === 'LOCAL'); + this.$store.state.map.map.displayList.forEach( item => { + if (item.type === 'LOCAL') { + this.tableData.push(item); + } else { + this.otherData.push(item); + } + }); }, deviceSelect(selected) { if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) { @@ -222,7 +231,7 @@ export default { save() { const map = this.$store.state.map.map; const param = { - displayList: this.tableData, + displayList: [...this.tableData, ...this.otherData], mapId: this.$route.params.mapId }; this.dataLoading = true; @@ -251,20 +260,63 @@ export default { this.clearData(); }, clear() { - this.addModel = { stationCodeList: [], elementList: [], switchStationCodeList:[] }; + this.addModel = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] }; }, clearData() { - this.addModel = { stationCodeList: [], elementList: [], switchStationCodeList:[] }; + this.addModel = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] }; this.index = ''; this.cardMode = 'generate'; }, + generateAllData() { + this.loading = true; + this.tableData = []; + const tempData = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] }; + const stationCodeList = []; + this.stationList.forEach(item => { + if (!item.depot) { + tempData.stationCodeList.push(item.code); + } else { stationCodeList.push(item.code); } + }); + [...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList, + ...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList, + ...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList].forEach(item => { + if (!stationCodeList.includes(item.stationCode)) { + tempData.elementList.push(item.code); + } + }); + [...this.directionRodList].forEach(item => { + if (!stationCodeList.includes(item.deviceStationCode)) { + tempData.elementList.push(item.code); + } + }); + this.psdList.forEach(item => { + const stand = this.$store.getters['map/getDeviceByCode'](item.standCode); + if (!stationCodeList.includes(stand.stationCode)) { + tempData.elementList.push(item.code); + } + }); + this.tableData.push(tempData); + const map = this.$store.state.map.map; + const param = { + displayList: [...this.tableData, ...this.otherData], + mapId: this.$route.params.mapId + }; + saveMap(Object.assign(map, param)).then(response => { + this.loading = false; + this.$message.success('保存现地配置成功'); + this.cancelOverlab(); + }).catch(() => { + this.loading = false; + this.$messageBox('保存现地配置失败'); + }); + }, generateData() { this.loading = true; this.tableData = []; // switchStationCodeList:[...item.switchStationCodeList, item.code] this.stationList.forEach(item => { if (item.centralized) { - this.tableData.push({stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code], switchStationCodeList:[...item.chargeStationCodeList, item.code]}); + this.tableData.push({type: 'LOCAL', stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code], switchStationCodeList:[...item.chargeStationCodeList, item.code]}); } }); @@ -285,7 +337,7 @@ export default { }); const map = this.$store.state.map.map; const param = { - displayList: this.tableData, + displayList: [...this.tableData, ...this.otherData], mapId: this.$route.params.mapId }; saveMap(Object.assign(map, param)).then(response => { diff --git a/src/views/newMap/newMapdraft/mapoperate/splitScreen.vue b/src/views/newMap/newMapdraft/mapoperate/displayConfig/splitScreen.vue similarity index 100% rename from src/views/newMap/newMapdraft/mapoperate/splitScreen.vue rename to src/views/newMap/newMapdraft/mapoperate/displayConfig/splitScreen.vue diff --git a/src/views/newMap/newMapdraft/mapoperate/index.vue b/src/views/newMap/newMapdraft/mapoperate/index.vue index 9eea48018..a9360e250 100644 --- a/src/views/newMap/newMapdraft/mapoperate/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/index.vue @@ -13,8 +13,10 @@ 配置 + 行调配置 现地配置 大屏配置 + 车辆段配置 @@ -38,16 +40,10 @@ /> - - + + + +
@@ -75,11 +71,13 @@ import ResponderDraft from './responder/index'; import ControlLamp from './controlLamp'; import SplitStation from './splitStation'; import Arrow from './arrow'; -import SplitScreen from './splitScreen'; +import SplitScreen from './displayConfig/splitScreen'; import FloodGate from './floodGate'; import DirectionRod from './directionRod'; import SignalButton from './signalButton'; -import LocalConfig from './localConfig'; +import LocalConfig from './displayConfig/localConfig'; +import CenterConfig from './displayConfig/centerConfig'; +import DepotConfig from './displayConfig/depotConfig'; export default { name: 'MapOperate', @@ -111,7 +109,9 @@ export default { FloodGate, DirectionRod, SignalButton, - LocalConfig + LocalConfig, + CenterConfig, + DepotConfig }, props: { selected: { @@ -188,12 +188,18 @@ export default { dataRelation() { this.$emit('selectView', 'path'); }, + showCenterConfig() { + this.configShow = 'center'; + }, showLocalConfig() { this.configShow = 'local'; }, showScreenConfig() { this.configShow = 'screen'; }, + showDepotConfig() { + this.configShow = 'depot'; + }, goDraw() { this.configShow = 'none'; }, @@ -237,13 +243,13 @@ export default { };