diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 5e8f30c4c..b08e20933 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -133,9 +133,9 @@ class SkinCode extends defaultStyle { endColor: '#FFFFFF', // 尽头分隔符颜色 color: '#FFFFFF' // 区段边界符颜色 }, - shuttleBack: { // 折返进路 (存在此对象 显示折返箭头) - distance: 5 // 限速线距离区段距离 - }, + // shuttleBack: { // 折返进路 (存在此对象 显示折返箭头) + // distance: 5 // 限速线距离区段距离 + // }, block: { special: false // 区段特殊显示 }, diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index f8c48a7c5..53fdb20a2 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -36,6 +36,9 @@ class Jlmap { this.defaultStateDict = this.loadDefaultState(); this.initMapInstance(opts); + + // 显示集中站 + this.stationCode = ''; } // 初始化属性有鼠标事件 缩放等 @@ -173,6 +176,8 @@ class Jlmap { }); if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); } + this.updateShowMode(list, this.showConfig.showMode); + this.updateShowStation(list, this.stationCode); } // 中间处理 @@ -266,6 +271,57 @@ class Jlmap { getShowConfig() { return this.showConfig; } + updateShowStation(list, stationCode) { + this.stationCode = 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.$transformHandle.revisibleAll(); + } + showStationHandlePsd(oDevice, stationCode) { + const standDevice = this.mapDevice[oDevice.standCode]; + if (standDevice.deviceStationCode === stationCode || !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); + }); + } + } update(list) { this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 (list || []).forEach(elem => { diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index 4ecb76566..4ebd5ebb1 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -169,6 +169,19 @@ class Painter { device.instance.setShowMode(); } } + /** + * 更新现地显示单独集中站 + * */ + updateShowStation(device, stationCode) { + if (device && device.instance) { + device.instance.setShowStation(stationCode); + } + } + updateSpecialShowStation(device, flag) { + if (device && device.instance) { + device.instance.setShowStation(flag); + } + } /** * 更新transform变化 * @param {*} opt diff --git a/src/jmapNew/shape/Automactic/index.js b/src/jmapNew/shape/Automactic/index.js index 38778b06e..1606a7e05 100644 --- a/src/jmapNew/shape/Automactic/index.js +++ b/src/jmapNew/shape/Automactic/index.js @@ -17,6 +17,7 @@ export default class Automactic extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; + this.isShowShape = true; if (isShowThePrdType(model.prdType, style.MapCycleButtonVO.visibleConditions) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); @@ -104,6 +105,7 @@ export default class Automactic extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; } createMouseEvent() { @@ -114,7 +116,6 @@ export default class Automactic extends Group { this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } - getArcBoundingRect() { const rect = this.control.getBoundingRect().clone(); const scale = this.control.scale[0]; @@ -142,15 +143,31 @@ export default class Automactic extends Group { const showMode = this.model.showMode; const showConditions = this.style.MapCycleButtonVO.visibleConditions; if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.control.show(); - this.text.show(); - this.subtitleText && this.subtitleText.show(); - this.arcBorder && this.arcBorder.show(); + this.show(); } else { - this.control.hide(); - this.text.hide(); - this.subtitleText && this.subtitleText.hide(); - this.arcBorder && this.arcBorder.hide(); + this.hide(); } } + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.isShowShape = true; + this.show(); + } else { + this.isShowShape = false; + this.hide(); + } + } + show() { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); + this.arcBorder && this.arcBorder.show(); + this.setState(this.model); + } + hide() { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); + this.arcBorder && this.arcBorder.hide(); + } } diff --git a/src/jmapNew/shape/AutomacticRoute/EMouse.js b/src/jmapNew/shape/AutomacticRoute/EMouse.js index fdb639e95..96e179317 100644 --- a/src/jmapNew/shape/AutomacticRoute/EMouse.js +++ b/src/jmapNew/shape/AutomacticRoute/EMouse.js @@ -2,52 +2,52 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - this.text = new Text({ - zlevel: this.device.zlevel, - z: this.device.z+1, - position: [0, 0], - style: { - x: this.device.model.position.x, - y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance-30, - fontWeight: 'normal', - fontSize: this.device.style.LcControl.mouseOverStyle.fontSize, - fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily, - text: this.device.model.name, - textFill: this.device.style.LcControl.mouseOverStyle.fontColor, - textAlign: this.device.style.LcControl.mouseOverStyle.textAlign, - textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign - } - }); - this.add(this.text); - this.text.hide(); - } - mouseover(e) { - if (e.target && e.target._subType == 'Text') { - this.text.show(); - } else { - this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - } + constructor(device) { + super(); + this.device = device; + this.create(); + } + create() { + this.text = new Text({ + zlevel: this.device.zlevel, + z: this.device.z + 1, + position: [0, 0], + style: { + x: this.device.model.position.x, + y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30, + fontWeight: 'normal', + fontSize: this.device.style.LcControl.mouseOverStyle.fontSize, + fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily, + text: this.device.model.name, + textFill: this.device.style.LcControl.mouseOverStyle.fontColor, + textAlign: this.device.style.LcControl.mouseOverStyle.textAlign, + textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign + } + }); + this.add(this.text); + this.text.hide(); + } + mouseover(e) { + if (e.target && e.target._subType == 'Text') { + this.text.show(); + } else { + this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); + this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); + this.device.control.setTextBorder(true); + this.device.control.setArcBorder(true); + } + } - mouseout(e) { - if (!this.device.model.down) { - if (e.target && e.target._subType == 'Text') { - this.text.hide(); - } else { - this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } - } + mouseout(e) { + if (!this.device.model.down) { + if (e.target && e.target._subType == 'Text') { + this.text.hide(); + } else { + this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); + this.device.control.setTextColor('#FFFFFF'); + this.device.control.setTextBorder(false); + this.device.control.setArcBorder(false); + } + } + } } diff --git a/src/jmapNew/shape/AutomacticRoute/index.js b/src/jmapNew/shape/AutomacticRoute/index.js index dfa8499a5..baae62795 100644 --- a/src/jmapNew/shape/AutomacticRoute/index.js +++ b/src/jmapNew/shape/AutomacticRoute/index.js @@ -7,7 +7,7 @@ import Text from 'zrender/src/graphic/Text'; import EMouse from './EMouse'; import {isShowThePrdType} from '../../utils/handlePath'; -export default class LcControl extends Group { +export default class AutomacticRoute extends Group { constructor(model, style) { super(); this.z = 20; @@ -16,6 +16,7 @@ export default class LcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; + this.isShowShape = true; if (isShowThePrdType(model.prdType, style.AutomaticRoute.displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); @@ -87,6 +88,7 @@ export default class LcControl extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; } createMouseEvent() { @@ -112,13 +114,29 @@ export default class LcControl extends Group { const showMode = this.model.showMode; const showConditions = this.style.AutomaticRoute.displayCondition; if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.control.show(); - this.text.show(); - this.subtitleText && this.subtitleText.show(); + this.show(); } else { - this.control.hide(); - this.text.hide(); - this.subtitleText && this.subtitleText.hide(); + this.hide(); } } + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.isShowShape = true; + this.show(); + } else { + this.isShowShape = false; + this.hide(); + } + } + show() { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); + this.setState(this.model); + } + hide() { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); + } } diff --git a/src/jmapNew/shape/LcControl/index.js b/src/jmapNew/shape/LcControl/index.js index d160a39c7..130afab8e 100644 --- a/src/jmapNew/shape/LcControl/index.js +++ b/src/jmapNew/shape/LcControl/index.js @@ -14,6 +14,7 @@ export default class LcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; + this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -54,6 +55,7 @@ export default class LcControl extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; } createMouseEvent() { @@ -64,7 +66,6 @@ export default class LcControl extends Group { this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); } } - getShapeTipPoint() { if (this.control) { var distance = 2; @@ -77,4 +78,14 @@ export default class LcControl extends Group { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.control.show(); + this.isShowShape = true; + this.setState(this.model); + } else { + this.control.hide(); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/LimitControl/index.js b/src/jmapNew/shape/LimitControl/index.js index e93aa7760..a5577c44d 100644 --- a/src/jmapNew/shape/LimitControl/index.js +++ b/src/jmapNew/shape/LimitControl/index.js @@ -14,6 +14,7 @@ export default class LimitControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; + this.isShowShape = true; this.z = 20; this.create(model); this.createMouseEvent(); @@ -58,6 +59,7 @@ export default class LimitControl extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; } createMouseEvent() { @@ -81,4 +83,14 @@ export default class LimitControl extends Group { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.control.show(); + this.isShowShape = true; + this.setState(this.model); + } else { + this.control.hide(); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Line/index.js b/src/jmapNew/shape/Line/index.js index 87601d9ef..963ba4ef1 100644 --- a/src/jmapNew/shape/Line/index.js +++ b/src/jmapNew/shape/Line/index.js @@ -11,6 +11,7 @@ export default class Line2 extends Group { this.z = 0; this.model = model; this.style = style; + this.isShowShape = true; if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) { this.create(); this.setState(model); @@ -55,6 +56,7 @@ export default class Line2 extends Group { } setState(model) { + if (!this.isShowShape) return; this.setLineType(model.type); } // 设置显示模式 @@ -71,4 +73,18 @@ export default class Line2 extends Group { }); } } + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild((child) => { + child.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild((child) => { + child.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/OutFrame/index.js b/src/jmapNew/shape/OutFrame/index.js index 6a8dd70b8..07e405b37 100644 --- a/src/jmapNew/shape/OutFrame/index.js +++ b/src/jmapNew/shape/OutFrame/index.js @@ -10,6 +10,7 @@ export default class OutFrame extends Group { this._code = model.code; this.style = style; this.zlevel = model.zlevel; + this.isShowShape = true; this.z = 0; if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) { this.create(); @@ -43,6 +44,7 @@ export default class OutFrame extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; } // 设置显示模式 setShowMode() { @@ -50,8 +52,19 @@ export default class OutFrame extends Group { const showConditions = this.model.showConditions; 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 || this.model.stationCode === stationCode) { + this.box && this.box.show(); + this.isShowShape = true; + this.setState(this.model); + } else { + this.box && this.box.hide(); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Psd/ESafeDoor.js b/src/jmapNew/shape/Psd/ESafeDoor.js index 76869d33f..74ad26be0 100644 --- a/src/jmapNew/shape/Psd/ESafeDoor.js +++ b/src/jmapNew/shape/Psd/ESafeDoor.js @@ -119,6 +119,20 @@ class ESafeDoor extends Group { this.safeC && this.safeC.setStyle('fill', color); this.safeR && this.safeR.setStyle('fill', color); } + hide() { + this.stand1 && this.stand1.hide(); + this.stand2 && this.stand2.hide(); + this.safeL && this.safeL.hide(); + this.safeC && this.safeC.hide(); + this.safeR && this.safeR.hide(); + } + show() { + this.stand1 && this.stand1.show(); + this.stand2 && this.stand2.show(); + this.safeL && this.safeL.show(); + this.safeC && this.safeC.show(); + this.safeR && this.safeR.show(); + } } export default ESafeDoor; diff --git a/src/jmapNew/shape/Psd/index.js b/src/jmapNew/shape/Psd/index.js index 71f5d1e2d..72353cb14 100644 --- a/src/jmapNew/shape/Psd/index.js +++ b/src/jmapNew/shape/Psd/index.js @@ -11,6 +11,7 @@ export default class Line2 extends Group { this.z = 1; this.model = model; this.style = style; + this.isShowShape = true; this.create(); this.setState(model); this.checkIsDrawMap(); @@ -64,6 +65,7 @@ export default class Line2 extends Group { } setState(model) { + if (!this.isShowShape) return; /** 设置屏蔽门开关*/ // if (model.name == 'Psd44') { // console.log(model, model.screenDoorOpenStatus, '1 为关门 0 为开门'); @@ -96,6 +98,15 @@ export default class Line2 extends Group { this.on('mouseover', () => { this.highlight.mouseover(); }); } } - setShowMode() {} + setShowStation(flag) { + if (flag) { + this.safeDoor && this.safeDoor.show(); + this.isShowShape = true; + this.setState(this.model); + } else { + this.safeDoor && this.safeDoor.hide(); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Resource/index.js b/src/jmapNew/shape/Resource/index.js index 650eb1f49..c4887e6e0 100644 --- a/src/jmapNew/shape/Resource/index.js +++ b/src/jmapNew/shape/Resource/index.js @@ -12,6 +12,7 @@ export default class Resource extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; + this.isShowShape = true; this.z = model.zIndex || 1; this.create(); } @@ -42,6 +43,7 @@ export default class Resource extends Group { } setState(model) { + if (!this.isShowShape) return; } // 整体图片 @@ -67,4 +69,14 @@ export default class Resource extends Group { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.image && this.image.show(); + this.isShowShape = true; + this.setState(this.model); + } else { + this.image && this.image.hide(); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Section/EAxle.js b/src/jmapNew/shape/Section/EAxle.js index 17e404671..ff299b4c9 100644 --- a/src/jmapNew/shape/Section/EAxle.js +++ b/src/jmapNew/shape/Section/EAxle.js @@ -5,31 +5,31 @@ import Path from 'zrender/src/graphic/Path'; // 计轴 export const EAxle = Path.extend({ - type: 'EAxle', - shape: { - point: null - }, - buildPath: function (ctx, model) { - if (model && model.style && model.traingle) { - const axleLength = 2 * model.style.Section.axle.radius; - const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); - const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); - // 圆弧 - const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); - const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); - const arcR = model.style.Section.axle.radius; - ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); - ctx.closePath(); + type: 'EAxle', + shape: { + point: null + }, + buildPath: function (ctx, model) { + if (model && model.style && model.traingle) { + const axleLength = 2 * model.style.Section.axle.radius; + const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); + const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); + // 圆弧 + const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); + const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); + const arcR = model.style.Section.axle.radius; + ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); + ctx.closePath(); - const x1 = positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); - const y1 = positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength); - const x2 = positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); - const y2 = positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength); - ctx.moveTo(x1, y1); - ctx.lineTo(x2, y2); - ctx.closePath(); - } - } + const x1 = positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); + const y1 = positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength); + const x2 = positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); + const y2 = positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength); + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + ctx.closePath(); + } + } }); // export default class EAxle extends Group { diff --git a/src/jmapNew/shape/Section/EBackArrow.js b/src/jmapNew/shape/Section/EBackArrow.js index 5c3506271..abac1f491 100644 --- a/src/jmapNew/shape/Section/EBackArrow.js +++ b/src/jmapNew/shape/Section/EBackArrow.js @@ -2,41 +2,41 @@ import Path from 'zrender/src/graphic/Path'; // 成都三号线 折返进路 export const EBackArrow = Path.extend({ - type: 'EBackArrow', - shape: { - points: null - }, - buildPath: function (ctx, shape) { - const points = shape.points; - var r = shape.height; - var x = points.x + shape.drict * shape.width / 2; - var y = points.y; - ctx.moveTo(points.x - shape.drict * shape.width, points.y + shape.height); - ctx.lineTo(points.x + shape.drict * shape.width / 2, points.y + shape.height); - if (shape.drict) { - ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, true); - } else { - ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); - } - ctx.moveTo(points.x + shape.drict * shape.width / 2, points.y - shape.height); - ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height); - } + type: 'EBackArrow', + shape: { + points: null + }, + buildPath: function (ctx, shape) { + const points = shape.points; + var r = shape.height; + var x = points.x + shape.drict * shape.width / 2; + var y = points.y; + ctx.moveTo(points.x - shape.drict * shape.width, points.y + shape.height); + ctx.lineTo(points.x + shape.drict * shape.width / 2, points.y + shape.height); + if (shape.drict) { + ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, true); + } else { + ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); + } + ctx.moveTo(points.x + shape.drict * shape.width / 2, points.y - shape.height); + ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height); + } }); // 箭头 export const EBackArrowTriangle = Path.extend({ - type: 'EBackArrowTriangle', - shape: { - points: null - }, - buildPath: function (ctx, shape) { - const points = shape.points; - ctx.moveTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height - 3); - if (shape.drict) { - ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); - } else { - ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); - } - ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height + 3); - } + type: 'EBackArrowTriangle', + shape: { + points: null + }, + buildPath: function (ctx, shape) { + const points = shape.points; + ctx.moveTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height - 3); + if (shape.drict) { + ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); + } else { + ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); + } + ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height + 3); + } }); diff --git a/src/jmapNew/shape/Section/ELimitLines.js b/src/jmapNew/shape/Section/ELimitLines.js index 1d1d35f39..9db8ba1b3 100644 --- a/src/jmapNew/shape/Section/ELimitLines.js +++ b/src/jmapNew/shape/Section/ELimitLines.js @@ -77,141 +77,141 @@ import Vue from 'vue'; // }); export default class ELimitLines extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this.create(model); - } + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.z; + this.create(model); + } - create(model) { - /** 创建区段*/ - if (model && model.points.length > 1) { - if (model.isCurve) { - const shape = {}; - for (let i = 1; i < (model.points.length - 1); i++) { - shape[`cpx${i}`] = model.points[i].x; - shape[`cpy${i}`] = model.points[i].y; - } + create(model) { + /** 创建区段*/ + if (model && model.points.length > 1) { + if (model.isCurve) { + const shape = {}; + for (let i = 1; i < (model.points.length - 1); i++) { + shape[`cpx${i}`] = model.points[i].x; + shape[`cpy${i}`] = model.points[i].y; + } - shape[`x1`] = model.points[0].x; - shape[`y1`] = model.points[0].y; - shape[`x2`] = model.points[model.points.length - 1].x; - shape[`y2`] = model.points[model.points.length - 1].y; + shape[`x1`] = model.points[0].x; + shape[`y1`] = model.points[0].y; + shape[`x2`] = model.points[model.points.length - 1].x; + shape[`y2`] = model.points[model.points.length - 1].y; - this.add(new BezierCurve({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - culling: true, - shape: shape, - position: model.position, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor, - fillOpacity: 0 - } - })); - } else { - const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 - var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 - const beg = Object.assign({}, model.points[0]); - const end = Object.assign({}, model.points[model.points.length - 1]); - if (model.isSwitchSection && beg.y !== end.y) { - const swch = Vue.prototype.$jlmap.mapDevice[model.switch.code]; // 获取道岔model 及状态数据 + this.add(new BezierCurve({ + isLine: true, + zlevel: this.zlevel, + progressive: model.progressive, + z: this.z, + culling: true, + shape: shape, + position: model.position, + style: { + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor, + fillOpacity: 0 + } + })); + } else { + const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 + var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 + const beg = Object.assign({}, model.points[0]); + const end = Object.assign({}, model.points[model.points.length - 1]); + if (model.isSwitchSection && beg.y !== end.y) { + const swch = Vue.prototype.$jlmap.mapDevice[model.switch.code]; // 获取道岔model 及状态数据 - if (swch && swch.instance) { - const traingle = new JTriangle(swch.intersection, swch.skew); - if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && !swch.normalPosition && swch.sectionCCode == model.code) { - beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); - beg.y = beg.y + traingle.dricty * (swPadding + switchWidth); - } + if (swch && swch.instance) { + const traingle = new JTriangle(swch.intersection, swch.skew); + if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && !swch.normalPosition && swch.sectionCCode == model.code) { + beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); + beg.y = beg.y + traingle.dricty * (swPadding + switchWidth); + } - if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.normalPosition && swch.sectionCCode == model.code) { - end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); - end.y = end.y + traingle.dricty * (swPadding + switchWidth); - } - } - } + if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.normalPosition && swch.sectionCCode == model.code) { + end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); + end.y = end.y + traingle.dricty * (swPadding + switchWidth); + } + } + } - if (model.points.length == 2) { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - position: model.position, - shape: { - x1: beg.x, - y1: beg.y, - x2: end.x, - y2: end.y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - } else { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - position: model.position, - shape: { - x1: beg.x, - y1: beg.y, - x2: model.points[1].x, - y2: model.points[1].y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); + if (model.points.length == 2) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + progressive: model.progressive, + z: this.z, + position: model.position, + shape: { + x1: beg.x, + y1: beg.y, + x2: end.x, + y2: end.y + }, + style: { + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor + } + })); + } else { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + progressive: model.progressive, + z: this.z, + position: model.position, + shape: { + x1: beg.x, + y1: beg.y, + x2: model.points[1].x, + y2: model.points[1].y + }, + style: { + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor + } + })); - for (let i = 1; i < (model.points.length - 2); i++) { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - position: model.position, - shape: { - x1: model.points[i].x, - y1: model.points[i].y, - x2: model.points[i + 1].x, - y2: model.points[i + 1].y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - } + for (let i = 1; i < (model.points.length - 2); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + progressive: model.progressive, + position: model.position, + shape: { + x1: model.points[i].x, + y1: model.points[i].y, + x2: model.points[i + 1].x, + y2: model.points[i + 1].y + }, + style: { + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor + } + })); + } - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - z: this.z, - position: model.position, - progressive: model.progressive, - shape: { - x1: model.points[model.points.length - 2].x, - y1: model.points[model.points.length - 2].y, - x2: end.x, - y2: end.y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - } - } - } - } + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + position: model.position, + progressive: model.progressive, + shape: { + x1: model.points[model.points.length - 2].x, + y1: model.points[model.points.length - 2].y, + x2: end.x, + y2: end.y + }, + style: { + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor + } + })); + } + } + } + } } diff --git a/src/jmapNew/shape/Section/ERelease.js b/src/jmapNew/shape/Section/ERelease.js index d71c886c2..98282fb77 100644 --- a/src/jmapNew/shape/Section/ERelease.js +++ b/src/jmapNew/shape/Section/ERelease.js @@ -3,70 +3,70 @@ import Line from 'zrender/src/graphic/shape/Line'; /** 延时释放*/ export default class ERelease extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; + constructor(model) { + super(); + this.model = model; + this.isNew = false; - } + } - create() { - if (!this.isNew) { - const model = this.model; + create() { + if (!this.isNew) { + const model = this.model; - this.isNew = true; - this.lines = new Line({ - zlevel: model.zlevel, - z: model.z, - shape: model.shape, - progressive: model.progressive, - style: { - lineWidth: model.lineWidth, - stroke: model.stroke - } - }); - this.add(this.lines); - } - } + this.isNew = true; + this.lines = new Line({ + zlevel: model.zlevel, + z: model.z, + shape: model.shape, + progressive: model.progressive, + style: { + lineWidth: model.lineWidth, + stroke: model.stroke + } + }); + this.add(this.lines); + } + } - setStyle(model) { - this.create(); - this.lines.setStyle(model); - } + setStyle(model) { + this.create(); + this.lines.setStyle(model); + } - hide() { - this.create(); - this.lines.hide(); - } + hide() { + this.create(); + this.lines.hide(); + } - show() { - this.create(); - this.lines.show(); - } + show() { + this.create(); + this.lines.show(); + } - // 开始动画 - animateStyle(loop, animates) { - this.create(); - if (animates && animates.length) { - this.eachChild((child) => { - if (child.animateStyle) { - let an = child.animateStyle(loop); - animates.forEach(elem => { - an = an.when(elem.time, elem.styles); - }); - an.start(); - } - }); - } - } + // 开始动画 + animateStyle(loop, animates) { + this.create(); + if (animates && animates.length) { + this.eachChild((child) => { + if (child.animateStyle) { + let an = child.animateStyle(loop); + animates.forEach(elem => { + an = an.when(elem.time, elem.styles); + }); + an.start(); + } + }); + } + } - // 结束动画 - stopAnimation(flag) { - this.create(); - this.eachChild((child) => { - if (child.stopAnimation) { - child.stopAnimation(flag); - } - }); - } + // 结束动画 + stopAnimation(flag) { + this.create(); + this.eachChild((child) => { + if (child.stopAnimation) { + child.stopAnimation(flag); + } + }); + } } diff --git a/src/jmapNew/shape/Section/ESeparator.js b/src/jmapNew/shape/Section/ESeparator.js index 6087d0597..0c64ff1a8 100644 --- a/src/jmapNew/shape/Section/ESeparator.js +++ b/src/jmapNew/shape/Section/ESeparator.js @@ -4,111 +4,111 @@ import Circle from 'zrender/src/graphic/shape/Circle'; /** 分隔符*/ export default class ESeparator extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.style.Section.separator.z || 6; - this.style = model.style; - this.setType(); - } + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.style.Section.separator.z || 6; + this.style = model.style; + this.setType(); + } - createModel(points, lineWidth = null, stroke = null) { - const model = this.model; - this.partition = new Polyline({ - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - shape: { - points: points - }, - style: { - lineWidth: lineWidth || this.style.Section.separator.width, - stroke: stroke || this.style.Section.separator.color - } - }); - this.add(this.partition); - } + createModel(points, lineWidth = null, stroke = null) { + const model = this.model; + this.partition = new Polyline({ + zlevel: this.zlevel, + progressive: model.progressive, + z: this.z, + shape: { + points: points + }, + style: { + lineWidth: lineWidth || this.style.Section.separator.width, + stroke: stroke || this.style.Section.separator.color + } + }); + this.add(this.partition); + } - // 创建 侵限分隔符 - createCircle() { - const model = this.model; - this.circle = new Circle({ - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - shape: { - cx: model.point.x, - cy: model.point.y, - r: this.style.Section.line.width - }, - style: { - stroke: this.style.Section.line.invadeColor, - GBaseLineWidth: 0.5, - fill: this.style.transparentColor - } - }); - this.add(this.circle); - } + // 创建 侵限分隔符 + createCircle() { + const model = this.model; + this.circle = new Circle({ + zlevel: this.zlevel, + z: this.z, + progressive: model.progressive, + shape: { + cx: model.point.x, + cy: model.point.y, + r: this.style.Section.line.width + }, + style: { + stroke: this.style.Section.line.invadeColor, + GBaseLineWidth: 0.5, + fill: this.style.transparentColor + } + }); + this.add(this.circle); + } - createCircleArc() { - const model = this.model; - this.circleArc = new Circle({ - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - shape: { - cx: model.point.x, - cy: model.point.y, - r: this.style.Section.line.width + 2 - }, - style: { - stroke: 'red', - GBaseLineWidth: 0.5, - fill: this.style.transparentColor - } - }); - this.add(this.circleArc); - } + createCircleArc() { + const model = this.model; + this.circleArc = new Circle({ + zlevel: this.zlevel, + z: this.z, + progressive: model.progressive, + shape: { + cx: model.point.x, + cy: model.point.y, + r: this.style.Section.line.width + 2 + }, + style: { + stroke: 'red', + GBaseLineWidth: 0.5, + fill: this.style.transparentColor + } + }); + this.add(this.circleArc); + } - setType() { - const type = this.model.sepType; - const model = this.model; - if (model && this.style && model.traingle) { - if (type === '01') { // 普通分割 - const points = [ - [model.point.x, model.point.y - (this.style.Section.line.width)], - [model.point.x, model.point.y + (this.style.Section.line.width)] - ]; - this.createModel(points); - } else if (type === '02') { // 单侧分割符 - const points = [ - [model.point.x + model.drict * (this.style.Section.line.width), model.point.y - (this.style.Section.line.width * 1.5)], - [model.point.x, model.point.y - (this.style.Section.line.width * 1.5)], - [model.point.x, model.point.y + (this.style.Section.line.width * 1.5)] - ]; - this.createModel(points); - } else if (type === '03') { // 尽头分隔符 - const points = [ - [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y - (this.style.Section.line.width * 1.2)], - [model.point.x, model.point.y - (this.style.Section.line.width * 1.2)], - [model.point.x, model.point.y + (this.style.Section.line.width * 1.2)], - [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y + (this.style.Section.line.width * 1.2)] - ]; - const lineWidth = this.style.Section.separator.endWidth; - const stroke = this.style.Section.separator.endColor; - this.createModel(points, lineWidth, stroke); - } else if (type === '04') { // 侵限分隔符 - this.createCircle(); - } else if (type === '05') { // 特色分隔符 - this.createCircleArc(); - } - } + setType() { + const type = this.model.sepType; + const model = this.model; + if (model && this.style && model.traingle) { + if (type === '01') { // 普通分割 + const points = [ + [model.point.x, model.point.y - (this.style.Section.line.width)], + [model.point.x, model.point.y + (this.style.Section.line.width)] + ]; + this.createModel(points); + } else if (type === '02') { // 单侧分割符 + const points = [ + [model.point.x + model.drict * (this.style.Section.line.width), model.point.y - (this.style.Section.line.width * 1.5)], + [model.point.x, model.point.y - (this.style.Section.line.width * 1.5)], + [model.point.x, model.point.y + (this.style.Section.line.width * 1.5)] + ]; + this.createModel(points); + } else if (type === '03') { // 尽头分隔符 + const points = [ + [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y - (this.style.Section.line.width * 1.2)], + [model.point.x, model.point.y - (this.style.Section.line.width * 1.2)], + [model.point.x, model.point.y + (this.style.Section.line.width * 1.2)], + [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y + (this.style.Section.line.width * 1.2)] + ]; + const lineWidth = this.style.Section.separator.endWidth; + const stroke = this.style.Section.separator.endColor; + this.createModel(points, lineWidth, stroke); + } else if (type === '04') { // 侵限分隔符 + this.createCircle(); + } else if (type === '05') { // 特色分隔符 + this.createCircleArc(); + } + } - if (model.traingle) { - this.origin = [model.point.x, model.point.y]; - this.rotation = Math.PI * 2 - Math.atan2(model.traingle.absy, model.traingle.absx) * model.traingle.drictx * model.traingle.dricty; - this.dirty(); // 可以无需调用 - } - } + if (model.traingle) { + this.origin = [model.point.x, model.point.y]; + this.rotation = Math.PI * 2 - Math.atan2(model.traingle.absy, model.traingle.absx) * model.traingle.drictx * model.traingle.dricty; + this.dirty(); // 可以无需调用 + } + } } diff --git a/src/jmapNew/shape/Section/EblockLines.js b/src/jmapNew/shape/Section/EblockLines.js index 59893b56c..34d7834e2 100644 --- a/src/jmapNew/shape/Section/EblockLines.js +++ b/src/jmapNew/shape/Section/EblockLines.js @@ -1,7 +1,7 @@ import Group from 'zrender/src/container/Group'; import Line from 'zrender/src/graphic/shape/Line'; import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; -import { +import { cubicSubdivide, quadraticAt, cubicAt, @@ -49,8 +49,8 @@ export default class ELines extends Group { this.add(this.section); } else { if (model.points.length == 2) { - const spaceX= (model.points[1].x - model.points[0].x) / 3; - const spaceY= (model.points[1].y - model.points[0].y) / 3; + const spaceX = (model.points[1].x - model.points[0].x) / 3; + const spaceY = (model.points[1].y - model.points[0].y) / 3; this.sectionM = new Line({ isLine: true, zlevel: this.zlevel, @@ -130,8 +130,7 @@ export default class ELines extends Group { (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t), (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t) ]; - } - else { + } else { return [ (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t), (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t) @@ -141,7 +140,7 @@ export default class ELines extends Group { // 重新计算居中距离点 couvert(shape) { - let out = []; + const out = []; var x1 = shape.x1; var y1 = shape.y1; var x2 = shape.x2; @@ -150,7 +149,7 @@ export default class ELines extends Group { var cpy1 = shape.cpy1; var cpx2 = shape.cpx2; var cpy2 = shape.cpy2; - + cubicSubdivide( x1, cpx1, cpx2, x2, 0.3, out ); @@ -159,7 +158,7 @@ export default class ELines extends Group { x1, cpx1, cpx2, x2, 0.7, out ); var n_x2 = out[3]; - + cubicSubdivide( y1, cpy1, cpy2, y2, 0.3, out ); @@ -168,20 +167,20 @@ export default class ELines extends Group { y1, cpy1, cpy2, y2, 0.7, out ); var n_y2 = out[3]; - + var p = this.someVectorAt(shape, 0.5, true); var v = vec2.normalize(p, p); - - var x0 = Math.sqrt((Math.pow(cpx1-x1, 2)+Math.pow(x2-cpx2, 2))/2, 2); - var y0 = Math.sqrt((Math.pow(cpy1-y1, 2)+Math.pow(y2-cpy2, 2))/2, 2); - + + var x0 = Math.sqrt((Math.pow(cpx1 - x1, 2) + Math.pow(x2 - cpx2, 2)) / 2, 2); + var y0 = Math.sqrt((Math.pow(cpy1 - y1, 2) + Math.pow(y2 - cpy2, 2)) / 2, 2); + return { x1: n_x1, y1: n_y1, x2: n_x2, y2: n_y2, - cpx1: (cpx1+cpx2)/2 + v[1]*x0*0.128, - cpy1: (cpy1+cpy2)/2 + v[0]*y0*0.128 + cpx1: (cpx1 + cpx2) / 2 + v[1] * x0 * 0.128, + cpy1: (cpy1 + cpy2) / 2 + v[0] * y0 * 0.128 }; } } diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index a4c277b4b..d0fcbc824 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -27,6 +27,7 @@ export default class Section extends Group { this.style = style; this.selected = false; // 绘图选中状态 this.selectedType = ''; // 绘图批量选中状态 + this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -783,6 +784,7 @@ export default class Section extends Group { /** 设置状态*/ setState(model, flag = false) { + if (!this.isShowShape) return; this.recover(); // 实际上就是 状态重置 必须在设置其他状态之前 设置颜色之类的 if (this.style.Switch.sectionAction.flag && model.relSwitchCode && !flag) { @@ -887,4 +889,18 @@ export default class Section extends Group { this.section && this.section.setStyle({ stroke: 'rgba(255,255,255,0.8)' }); } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index c8f1a2bbb..9d230e29d 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -25,6 +25,7 @@ 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; this.create(); this.createMouseEvent(); @@ -461,6 +462,7 @@ class Signal extends Group { } setState(model) { + if (!this.isShowShape) return; this.recover(); // /** 设置状态 (点灯类型)*/ // switch (model.status) { @@ -589,6 +591,20 @@ class Signal extends Group { } } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } export default Signal; diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index c43b575f7..30340368c 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -21,7 +21,7 @@ export default class Station extends Group { this.z = 40; this.model = model; this.style = style; - + this.isShowShape = true; this.create(); this.createTurnBack(); // 创建按图折返 if (isShowThePrdType(model.prdType, style.Station.functionButtonShow) || model.previewOrMapDraw) { @@ -312,6 +312,7 @@ export default class Station extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; switch (model.controlMode) { case '': // 无状态 this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); @@ -378,4 +379,18 @@ export default class Station extends Group { this.guideLamp && this.guideLamp.hide(); } } + setShowStation(flag) { + if (flag) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/StationControl/index.js b/src/jmapNew/shape/StationControl/index.js index 43e2a090c..137911f19 100644 --- a/src/jmapNew/shape/StationControl/index.js +++ b/src/jmapNew/shape/StationControl/index.js @@ -18,6 +18,7 @@ export default class StationControl extends Group { this.z = 1; this.model = model; this.style = style; + this.isShowShape = true; this.create(); this.createMouseEvent(); this.setState(model); @@ -114,6 +115,7 @@ export default class StationControl extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; // switch (model.status) { // case '00': // 无状态 // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); @@ -179,4 +181,18 @@ export default class StationControl extends Group { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/StationCounter/index.js b/src/jmapNew/shape/StationCounter/index.js index 4e17573d8..9f6217d11 100644 --- a/src/jmapNew/shape/StationCounter/index.js +++ b/src/jmapNew/shape/StationCounter/index.js @@ -14,6 +14,7 @@ export default class StationCounter extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 30; + this.isShowShape = true; this.create(); this.setState(model); } @@ -81,11 +82,26 @@ export default class StationCounter extends Group { } setState(model) { + if (!this.isShowShape) return; } getShapeTipPoint() { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/StationDelayUnlock/index.js b/src/jmapNew/shape/StationDelayUnlock/index.js index a068cf5ca..df90f1276 100644 --- a/src/jmapNew/shape/StationDelayUnlock/index.js +++ b/src/jmapNew/shape/StationDelayUnlock/index.js @@ -14,6 +14,7 @@ export default class StationDelayUnlock extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 1; + this.isShowShape = true; this.create(); this.setState(model); } @@ -90,6 +91,7 @@ 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); } @@ -105,4 +107,18 @@ export default class StationDelayUnlock extends Group { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index e5ee7e4e3..a1b17a219 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -23,6 +23,7 @@ class StationStand extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 1; + this.isShowShape = true; this.doors = new Group(); this.create(); this.createMouseEvent(); @@ -492,6 +493,7 @@ class StationStand extends Group { } setState(model) { + if (!this.isShowShape) return; // 新版地图使用新版状态变更方式 this.recover(); model.free && this.spare(); /** 空闲*/ @@ -581,5 +583,19 @@ class StationStand extends Group { this.downDetainLamp && this.downDetainLamp.hide(); } } + setShowStation(stationCode) { + if (!stationCode || this.model.deviceStationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } export default StationStand; diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index 567771dd9..2d6f7493b 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -15,7 +15,7 @@ import EHighlight from '../element/EHighlight'; import ERhomboid from './ERhomboid'; import ETriangle from './ETriangle'; import store from '@/store'; -// import Vue from 'vue'; +import Vue from 'vue'; export default class Switch extends Group { constructor(model, style) { @@ -26,6 +26,7 @@ export default class Switch extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 6; + this.isShowShape = true; this.triangle = new JTriangle(model.intersection, model.skew); this.create(); this.createLockRect(); // 创建单锁矩形框显示 @@ -428,6 +429,7 @@ export default class Switch extends Group { } setState(model) { + if (!this.isShowShape) return; if (model.normalPosition) { this.setLocationAction(model); /** 定位*/ } else if (model.reversePosition) { @@ -483,4 +485,18 @@ export default class Switch extends Group { } } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Text/index.js b/src/jmapNew/shape/Text/index.js index b2209aa4d..d46e54728 100644 --- a/src/jmapNew/shape/Text/index.js +++ b/src/jmapNew/shape/Text/index.js @@ -12,6 +12,7 @@ export default class Text2 extends Group { this.model = model; this.style = style; this.z = 6; + this.isShowShape = true; if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) { this.create(); this.setState(model); @@ -46,6 +47,7 @@ export default class Text2 extends Group { } setState(model) { + if (!this.isShowShape) return; } // 设置显示模式 setShowMode() { @@ -57,4 +59,18 @@ export default class Text2 extends Group { this.text && this.text.hide(); } } + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/Train/index.js b/src/jmapNew/shape/Train/index.js index 35f5b5d15..f4cba90aa 100644 --- a/src/jmapNew/shape/Train/index.js +++ b/src/jmapNew/shape/Train/index.js @@ -20,6 +20,7 @@ export default class Train extends Group { this.section = null; this.nextPointIndex = 1; this.currentAdd = 0; + this.isShowShape = true; this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize; this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat; @@ -34,6 +35,7 @@ export default class Train extends Group { } this.create(); this.setState(model, this); + this.initShowStation(model); } _computed() { @@ -404,6 +406,7 @@ export default class Train extends Group { } // 设置状态 setState(model, object) { + if (!this.isShowShape) return; const flag = model.trainWindowModel ? model.trainWindowModel.reversal : false; if (model) { this.recover(); @@ -512,4 +515,25 @@ export default class Train extends Group { this.add(this.trainBorder); } setShowMode() {} + initShowStation(model) { + if (model.trainWindowModel && model.trainWindowModel.instance && !model.trainWindowModel.instance.isShowShape) { + this.eachChild(item => { + item.hide(); + }); + } + } + setShowStation(stationCode) { + if ((this.model.sectionModel && this.model.sectionModel.stationCode === stationCode) || !stationCode ) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model, this); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/TrainWindow/index.js b/src/jmapNew/shape/TrainWindow/index.js index 5f35f4cff..860844258 100644 --- a/src/jmapNew/shape/TrainWindow/index.js +++ b/src/jmapNew/shape/TrainWindow/index.js @@ -14,6 +14,7 @@ class TrainWindow extends Group { this.style = style; this.z = 9; this.prdType = store.state.training.prdType; + this.isShowShape = true; this.create(model); this.createMouseEvent(); this.setState(model); @@ -67,6 +68,7 @@ class TrainWindow extends Group { } setState(model) { + if (!this.isShowShape) return; this.setVisible(model.trainWindowShow); } @@ -79,6 +81,20 @@ class TrainWindow extends Group { return (store.getters['map/getDeviceByCode'](code) || {}).instance; } setShowMode() {} + setShowStation(flag) { + if (flag) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } export default TrainWindow; diff --git a/src/jmapNew/shape/ZcControl/index.js b/src/jmapNew/shape/ZcControl/index.js index 2797866f3..a5bf38970 100644 --- a/src/jmapNew/shape/ZcControl/index.js +++ b/src/jmapNew/shape/ZcControl/index.js @@ -14,6 +14,7 @@ export default class ZcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; + this.isShowShape = true; this.create(model); this.createMouseEvent(); this.setState(model); @@ -60,6 +61,7 @@ export default class ZcControl extends Group { // 设置状态 setState(model) { + if (!this.isShowShape) return; } createMouseEvent() { if (this.style.ZcControl.mouseOverStyle) { @@ -81,4 +83,18 @@ export default class ZcControl extends Group { return null; } setShowMode() {} + setShowStation(stationCode) { + if (!stationCode || this.model.stationCode === stationCode) { + this.eachChild(item => { + item.show(); + }); + this.isShowShape = true; + this.setState(this.model); + } else { + this.eachChild(item => { + item.hide(); + }); + this.isShowShape = false; + } + } } diff --git a/src/jmapNew/shape/element/EControl.js b/src/jmapNew/shape/element/EControl.js index ca72e7336..18b4c3897 100644 --- a/src/jmapNew/shape/element/EControl.js +++ b/src/jmapNew/shape/element/EControl.js @@ -102,12 +102,4 @@ export default class EControl extends Group { this.text.setStyle('textFill', color); } } - hide() { - this.control.hide(); - this.text.hide(); - } - show() { - this.control.show(); - this.text.show(); - } } diff --git a/src/jmapNew/theme/beijing_01/menus/menuBar.vue b/src/jmapNew/theme/beijing_01/menus/menuBar.vue index 19203cd51..c64cf27e5 100644 --- a/src/jmapNew/theme/beijing_01/menus/menuBar.vue +++ b/src/jmapNew/theme/beijing_01/menus/menuBar.vue @@ -89,9 +89,6 @@ - - - @@ -110,960 +107,868 @@ import DetainTrainContorlUpDown from './menuDialog/detainTrainContorlUpDown'; import TrainAdd from './menuDialog/trainAdd'; import TrainTranstalet from './menuDialog/trainTranstalet'; import TrainDelete from './menuDialog/trainDelete'; -import ViewTrainId from './menuDialog/viewTrainId'; -import ViewName from './menuDialog/viewName'; -import ViewDevice from './menuDialog/viewDevice'; import ManageUser from './menuDialog/manageUser'; import HelpAbout from './menuDialog/helpAbout'; import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'; import { EventBus } from '@/scripts/event-bus'; export default { - name: 'MenuBar', - components: { - NoticeInfo, - StationControl, - DetainTrainContorl, - DetainTrainContorlUpDown, - ViewTrainId, - ViewName, - ViewDevice, - TrainAdd, - TrainTranstalet, - TrainDelete, - ManageUser, - HelpAbout - }, - props: { - selected: { - type: Object, - default() { - return null; - } - } - }, - data() { - return { - classA: -1, - classB: -1, - tempClassA: -1, - tempClassB: -1, - valid: true, - menu: [], - menuNormal: { - local: [ - { - title: '系统', - operate: OperationEvent.Command.mBar.system, - children: [ - { - title: '登录', - click: this.undeveloped - }, - { - title: '注销', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '站遥控', - operate: OperationEvent.MixinCommand.remoteControl.mbar, - click: this.stationRemoteControl - }, - { - title: '区域选择', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '连接主用中心', - click: this.undeveloped - }, - { - title: '连接备用中心', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '退出', - click: this.undeveloped - } - ] - }, - { - title: '查看', - operate: OperationEvent.Command.mBar.check, - children: [ - { - title: '运行图', - click: this.undeveloped - }, - { - title: '报告分析', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '视图', - click: this.undeveloped, - operate: '', - children: [{ - title: '报警', - click: this.undeveloped - }, - { - title: '列车运行信息', - click: this.undeveloped - }, - { - title: '设备状态', - click: this.undeveloped - }, - { - title: '列车详细信息', - click: this.undeveloped - }, - { - title: '站台详细信息', - click: this.undeveloped - }] - }, - { - title: '终端站发车列表', - click: this.undeveloped - }, - { - title: '详细设备状态', - click: this.undeveloped - }, - { - title: '查找列车', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '显示目的地号', - click: this.undeveloped - }, - { - title: '显示轨道名', - click: this.undeveloped - }, - { - title: '显示道岔名', - click: this.undeveloped - }, - { - title: '显示信号机名', - click: this.undeveloped - }, - { - title: '显示车次窗位置', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '显示车次号', - click: this.undeveloped - }, - { - title: '显示车组号', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '全屏', - click: this.undeveloped - }, - { - title: '放大', - click: this.undeveloped - }, - { - title: '缩小', - click: this.undeveloped - }, - { - title: '恢复', - click: this.undeveloped - } - ] - }, - { - title: '车站定位', - operate: '', - children: [ - ] - }, - { - title: '显示', - operate: OperationEvent.Command.mBar.view, - hide: true, - children: [ - { - title: '设置列车识别号显示', - click: this.setTrainIdDisplay, - operate: OperationEvent.Command.view.setTrainIdDisplay - }, - { - title: '设置名称显示', - click: this.setNameDisplay, - operate: OperationEvent.Command.view.setNameDisplay - }, - { - title: '设置设备显示', - click: this.setDeviceDisplay, - operate: OperationEvent.Command.view.setDeviceDisplay - } - ] - }, - { - title: 'ATS终端操作', - operate: '', - children: [ - { - title: '当天运行车计划', - click: this.undeveloped - }, - { - title: '出入库预告', - click: this.undeveloped - } - ] - }, - { - title: '计划车操作', - operate: '', - children: [ - { - title: '添加计划车', - click: this.undeveloped - }, - { - title: '平移计划车', - click: this.undeveloped - }, - { - title: '删除计划车', - click: this.undeveloped - } - ] - }, - { - title: '批处理命令', - operate: OperationEvent.Command.mBar.detainControl, - children: [ - { - title: '全线扣车', - operate: OperationEvent.StationStand.setDetainTrainAll.mbar, - click: this.setDetainTrainAll - }, - { - title: '取消全线扣车', - operate: OperationEvent.StationStand.cancelDetainTrainAll.mbar, - click: this.cancelDetainTrainAll - }, - { - title: '取消上行全线扣车', - operate: OperationEvent.StationStand.cancelUpDetainTrainAll.mbar, - click: this.cancelUpDetainTrainAll - }, - { - title: '取消下行全线扣车', - operate: OperationEvent.StationStand.cancelDownDetainTrainAll.mbar, - click: this.cancelDownDetainTrainAll - } - ] - }, - { - title: '信息管理', - operate: '', - children: [ - { - title: '调度日志', - click: this.undeveloped - }, - { - title: '调度留言提醒', - click: this.undeveloped - }, - { - title: '报警设置', - click: this.undeveloped - } - ] - }, - { - title: '帮助', - children: [ - { - title: '关于ITS GPC 工作站', - click: this.about, - operate: OperationEvent.Command.help.about - } - ] - } - ], - central: [ - { - title: '系统', - operate: OperationEvent.Command.mBar.system, - children: [ - { - title: '登录', - click: this.undeveloped - }, - { - title: '注销', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '站遥控', - operate: OperationEvent.MixinCommand.remoteControl.mbar, - click: this.stationRemoteControl - }, - { - title: '区域选择', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '连接主用中心', - click: this.undeveloped - }, - { - title: '连接备用中心', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '退出', - click: this.undeveloped - } - ] - }, - { - title: '查看', - operate: OperationEvent.Command.mBar.check, - children: [ - { - title: '运行图', - click: this.undeveloped - }, - { - title: '报告分析', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '视图', - click: this.undeveloped, - operate: '', - children: [{ - title: '报警', - click: this.undeveloped - }, - { - title: '列车运行信息', - click: this.undeveloped - }, - { - title: '设备状态', - click: this.undeveloped - }, - { - title: '列车详细信息', - click: this.undeveloped - }, - { - title: '站台详细信息', - click: this.undeveloped - }] - }, - { - title: '终端站发车列表', - click: this.undeveloped - }, - { - title: '详细设备状态', - click: this.undeveloped - }, - { - title: '查找列车', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '显示目的地号', - click: this.undeveloped - }, - { - title: '显示轨道名', - click: this.undeveloped - }, - { - title: '显示道岔名', - click: this.undeveloped - }, - { - title: '显示信号机名', - click: this.undeveloped - }, - { - title: '显示车次窗位置', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '显示车次号', - click: this.undeveloped - }, - { - title: '显示车组号', - click: this.undeveloped - }, - { - type: 'separator' - }, - { - title: '全屏', - click: this.undeveloped - }, - { - title: '放大', - click: this.undeveloped - }, - { - title: '缩小', - click: this.undeveloped - }, - { - title: '恢复', - click: this.undeveloped - } - ] - }, - { - title: '车站定位', - operate: '', - children: [ - ] - }, - { - title: '显示', - operate: OperationEvent.Command.mBar.view, - hide: true, - children: [ - { - title: '设置列车识别号显示', - click: this.setTrainIdDisplay, - operate: OperationEvent.Command.view.setTrainIdDisplay - }, - { - title: '设置名称显示', - click: this.setNameDisplay, - operate: OperationEvent.Command.view.setNameDisplay - }, - { - title: '设置设备显示', - click: this.setDeviceDisplay, - operate: OperationEvent.Command.view.setDeviceDisplay - } - ] - }, - { - title: 'ATS终端操作', - operate: '', - children: [ - { - title: '当天运行车计划', - click: this.undeveloped - }, - { - title: '出入库预告', - click: this.undeveloped - } - ] - }, - { - title: '计划车操作', - operate: '', - children: [ - { - title: '添加计划车', - click: this.undeveloped - }, - { - title: '平移计划车', - click: this.undeveloped - }, - { - title: '删除计划车', - click: this.undeveloped - } - ] - }, - { - title: '批处理命令', - operate: OperationEvent.Command.mBar.detainControl, - children: [ - { - title: '全线扣车', - operate: OperationEvent.StationStand.setDetainTrainAll.mbar, - click: this.setDetainTrainAll - }, - { - title: '取消全线扣车', - operate: OperationEvent.StationStand.cancelDetainTrainAll.mbar, - click: this.cancelDetainTrainAll - }, - { - title: '取消上行全线扣车', - operate: OperationEvent.StationStand.cancelUpDetainTrainAll.mbar, - click: this.cancelUpDetainTrainAll - }, - { - title: '取消下行全线扣车', - operate: OperationEvent.StationStand.cancelDownDetainTrainAll.mbar, - click: this.cancelDownDetainTrainAll - } - ] - }, - { - title: '信息管理', - operate: '', - children: [ - { - title: '调度日志', - click: this.undeveloped - }, - { - title: '调度留言提醒', - click: this.undeveloped - }, - { - title: '报警设置', - click: this.undeveloped - } - ] - }, - { - title: '帮助', - children: [ - { - title: '关于ITS GPC 工作站', - click: this.about, - operate: OperationEvent.Command.help.about - } - ] - } - ] - } - }; - }, - computed: { - ...mapGetters('training', [ - 'mode', - 'started', - 'steps', - 'order', - 'mode' - ]), - ...mapGetters('map', [ - 'stationList' - ]) - }, - watch: { - tempClassA() { - this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA; - }, - tempClassB() { - this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB; - }, - '$store.state.menuOperation.break': function (val) { - if (val) { - this.classA = this.classB = -1; - } else { - this.classA = this.tempClassA; - this.classB = this.tempClassB; - } - }, - '$store.state.training.operatemode': function (mode) { - this.initMenu(); - }, - '$store.state.training.started': function (val) { - this.closeMenu(true); - }, - '$store.state.training.prdType': function () { - this.initMenu(); - } - }, - mounted() { - this.initMenu(); - }, - methods: { - handleShow(item) { - if (item.hide) { - return false; - } - return true; - }, - initStationList() { - const list = []; - this.stationList.forEach(station => { - if (station.visible) { - const node = { - title: station.name, - operate: station.code, - show: true, - click: this.mapLocation, - code: station.code - }; + name: 'MenuBar', + components: { + NoticeInfo, + StationControl, + DetainTrainContorl, + DetainTrainContorlUpDown, + TrainAdd, + TrainTranstalet, + TrainDelete, + ManageUser, + HelpAbout + }, + props: { + selected: { + type: Object, + default() { + return null; + } + } + }, + data() { + return { + classA: -1, + classB: -1, + tempClassA: -1, + tempClassB: -1, + valid: true, + menu: [], + menuNormal: { + local: [ + { + title: '系统', + operate: OperationEvent.Command.mBar.system, + children: [ + { + title: '登录', + click: this.undeveloped + }, + { + title: '注销', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '站遥控', + operate: OperationEvent.MixinCommand.remoteControl.mbar, + click: this.stationRemoteControl + }, + { + title: '区域选择', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '连接主用中心', + click: this.undeveloped + }, + { + title: '连接备用中心', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '退出', + click: this.undeveloped + } + ] + }, + { + title: '查看', + operate: OperationEvent.Command.mBar.check, + children: [ + { + title: '运行图', + click: this.undeveloped + }, + { + title: '报告分析', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '视图', + click: this.undeveloped, + operate: '', + children: [{ + title: '报警', + click: this.undeveloped + }, + { + title: '列车运行信息', + click: this.undeveloped + }, + { + title: '设备状态', + click: this.undeveloped + }, + { + title: '列车详细信息', + click: this.undeveloped + }, + { + title: '站台详细信息', + click: this.undeveloped + }] + }, + { + title: '终端站发车列表', + click: this.undeveloped + }, + { + title: '详细设备状态', + click: this.undeveloped + }, + { + title: '查找列车', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '显示目的地号', + click: this.undeveloped + }, + { + title: '显示轨道名', + click: this.undeveloped + }, + { + title: '显示道岔名', + click: this.undeveloped + }, + { + title: '显示信号机名', + click: this.undeveloped + }, + { + title: '显示车次窗位置', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '显示车次号', + click: this.undeveloped + }, + { + title: '显示车组号', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '全屏', + click: this.undeveloped + }, + { + title: '放大', + click: this.undeveloped + }, + { + title: '缩小', + click: this.undeveloped + }, + { + title: '恢复', + click: this.undeveloped + } + ] + }, + { + title: '车站定位', + operate: '', + children: [ + ] + }, + { + title: 'ATS终端操作', + operate: '', + children: [ + { + title: '当天运行车计划', + click: this.undeveloped + }, + { + title: '出入库预告', + click: this.undeveloped + } + ] + }, + { + title: '计划车操作', + operate: '', + children: [ + { + title: '添加计划车', + click: this.undeveloped + }, + { + title: '平移计划车', + click: this.undeveloped + }, + { + title: '删除计划车', + click: this.undeveloped + } + ] + }, + { + title: '批处理命令', + operate: OperationEvent.Command.mBar.detainControl, + children: [ + { + title: '全线扣车', + operate: OperationEvent.StationStand.setDetainTrainAll.mbar, + click: this.setDetainTrainAll + }, + { + title: '取消全线扣车', + operate: OperationEvent.StationStand.cancelDetainTrainAll.mbar, + click: this.cancelDetainTrainAll + }, + { + title: '取消上行全线扣车', + operate: OperationEvent.StationStand.cancelUpDetainTrainAll.mbar, + click: this.cancelUpDetainTrainAll + }, + { + title: '取消下行全线扣车', + operate: OperationEvent.StationStand.cancelDownDetainTrainAll.mbar, + click: this.cancelDownDetainTrainAll + } + ] + }, + { + title: '信息管理', + operate: '', + children: [ + { + title: '调度日志', + click: this.undeveloped + }, + { + title: '调度留言提醒', + click: this.undeveloped + }, + { + title: '报警设置', + click: this.undeveloped + } + ] + }, + { + title: '帮助', + children: [ + { + title: '关于ITS GPC 工作站', + click: this.about, + operate: OperationEvent.Command.help.about + } + ] + } + ], + central: [ + { + title: '系统', + operate: OperationEvent.Command.mBar.system, + children: [ + { + title: '登录', + click: this.undeveloped + }, + { + title: '注销', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '站遥控', + operate: OperationEvent.MixinCommand.remoteControl.mbar, + click: this.stationRemoteControl + }, + { + title: '区域选择', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '连接主用中心', + click: this.undeveloped + }, + { + title: '连接备用中心', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '退出', + click: this.undeveloped + } + ] + }, + { + title: '查看', + operate: OperationEvent.Command.mBar.check, + children: [ + { + title: '运行图', + click: this.undeveloped + }, + { + title: '报告分析', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '视图', + click: this.undeveloped, + operate: '', + children: [{ + title: '报警', + click: this.undeveloped + }, + { + title: '列车运行信息', + click: this.undeveloped + }, + { + title: '设备状态', + click: this.undeveloped + }, + { + title: '列车详细信息', + click: this.undeveloped + }, + { + title: '站台详细信息', + click: this.undeveloped + }] + }, + { + title: '终端站发车列表', + click: this.undeveloped + }, + { + title: '详细设备状态', + click: this.undeveloped + }, + { + title: '查找列车', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '显示目的地号', + click: this.undeveloped + }, + { + title: '显示轨道名', + click: this.undeveloped + }, + { + title: '显示道岔名', + click: this.undeveloped + }, + { + title: '显示信号机名', + click: this.undeveloped + }, + { + title: '显示车次窗位置', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '显示车次号', + click: this.undeveloped + }, + { + title: '显示车组号', + click: this.undeveloped + }, + { + type: 'separator' + }, + { + title: '全屏', + click: this.undeveloped + }, + { + title: '放大', + click: this.undeveloped + }, + { + title: '缩小', + click: this.undeveloped + }, + { + title: '恢复', + click: this.undeveloped + } + ] + }, + { + title: '车站定位', + operate: '', + children: [ + ] + }, + { + title: 'ATS终端操作', + operate: '', + children: [ + { + title: '当天运行车计划', + click: this.undeveloped + }, + { + title: '出入库预告', + click: this.undeveloped + } + ] + }, + { + title: '计划车操作', + operate: '', + children: [ + { + title: '添加计划车', + click: this.undeveloped + }, + { + title: '平移计划车', + click: this.undeveloped + }, + { + title: '删除计划车', + click: this.undeveloped + } + ] + }, + { + title: '批处理命令', + operate: OperationEvent.Command.mBar.detainControl, + children: [ + { + title: '全线扣车', + operate: OperationEvent.StationStand.setDetainTrainAll.mbar, + click: this.setDetainTrainAll + }, + { + title: '取消全线扣车', + operate: OperationEvent.StationStand.cancelDetainTrainAll.mbar, + click: this.cancelDetainTrainAll + }, + { + title: '取消上行全线扣车', + operate: OperationEvent.StationStand.cancelUpDetainTrainAll.mbar, + click: this.cancelUpDetainTrainAll + }, + { + title: '取消下行全线扣车', + operate: OperationEvent.StationStand.cancelDownDetainTrainAll.mbar, + click: this.cancelDownDetainTrainAll + } + ] + }, + { + title: '信息管理', + operate: '', + children: [ + { + title: '调度日志', + click: this.undeveloped + }, + { + title: '调度留言提醒', + click: this.undeveloped + }, + { + title: '报警设置', + click: this.undeveloped + } + ] + }, + { + title: '帮助', + children: [ + { + title: '关于ITS GPC 工作站', + click: this.about, + operate: OperationEvent.Command.help.about + } + ] + } + ] + } + }; + }, + computed: { + ...mapGetters('training', [ + 'mode', + 'started', + 'steps', + 'order', + 'mode' + ]), + ...mapGetters('map', [ + 'stationList' + ]) + }, + watch: { + tempClassA() { + this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA; + }, + tempClassB() { + this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB; + }, + '$store.state.menuOperation.break': function (val) { + if (val) { + this.classA = this.classB = -1; + } else { + this.classA = this.tempClassA; + this.classB = this.tempClassB; + } + }, + '$store.state.training.operatemode': function (mode) { + this.initMenu(); + }, + '$store.state.training.started': function (val) { + this.closeMenu(true); + }, + '$store.state.training.prdType': function () { + this.initMenu(); + } + }, + mounted() { + this.initMenu(); + }, + methods: { + handleShow(item) { + if (item.hide) { + return false; + } + return true; + }, + initStationList() { + const list = []; + this.stationList.forEach(station => { + if (station.visible) { + const node = { + title: station.name, + operate: station.code, + show: true, + click: this.mapLocation, + code: station.code + }; - list.push(node); - } - }); - return list; - }, - initMenu(menu) { - this.menu = menuBarConvert(this.menuNormal[SystemType[this.$store.state.training.prdType]], this.$store.state.training.operatemode); - if (this.menu[2]) { - this.menu[2].children = this.initStationList(); - } - this.clickEvent(); - this.closeMenu(true); - }, - clickEvent() { - const self = this; - window.onclick = function (e) { - if (document.getElementById('menuBar')) { - self.closeMenu(false); - } - }; - }, - getDomId(item) { - if (item && item.operate) { - return item.operate.domId; - } - return ''; - }, - noShowingChildren(children) { - if (!children || children.length <= 0) { - return true; - } - return false; - }, - hasShowingChildren(children) { - if (children && children.length > 0) { - return true; - } - return false; - }, - closeMenu(flag) { - if (flag || (this.mode !== TrainingMode.EDIT && this.mode !== TrainingMode.TEACH)) { - this.classA = this.tempClassA = -1; - this.classB = this.tempClassB = -1; - } - }, - hookClick(item, event) { - this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); - if (item && typeof item.click == 'function') { - item.click(item.operate); - } - }, - selectedClassA(item, index) { - const order = this.order || 0; - if (this.mode !== TrainingMode.TEACH) { // 编辑模式下可显示 - this.popupMenuA(item, index); - } else if (this.steps[order] && this.steps[order].type == 'bar') { // 操作步骤没有顶部操作顶部菜单都不可显示 - this.popupMenuA(item, index); - } - }, - // 弹出顶部菜单操作 - popupMenuA(item, index) { - this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); - this.clickEvent(); - const operate = { - type: 'bar', - operation: item.operate.operation - }; - this.tempClassA = index; - this.tempClassB = -1; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - } - }); - }, - selectedClassB(item, index) { - const order = this.order || 0; - if (this.mode !== TrainingMode.TEACH) { // 编辑模式下可显示 - this.popupMenuB(item, index); - } else if (this.steps[order] && this.steps[order].type == 'bar') { // 操作步骤没有顶部操作顶部菜单都不可显示 - this.popupMenuB(item, index); - } - }, - popupMenuB(item, index) { - this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); - const operate = { - type: 'bar', - operation: item.operate.operation - }; - this.tempClassB = index; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - } - }); - }, - // 设置地图定位 - mapLocation(code) { - if (code) { - this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: code }); - this.closeMenu(true); - } - }, - // 站遥控 - stationRemoteControl(order) { - const operate = { - type: 'bar', - operation: order.operation - }; + list.push(node); + } + }); + return list; + }, + initMenu(menu) { + this.menu = menuBarConvert(this.menuNormal[SystemType[this.$store.state.training.prdType]], this.$store.state.training.operatemode); + if (this.menu[2]) { + this.menu[2].children = this.initStationList(); + } + this.clickEvent(); + this.closeMenu(true); + }, + clickEvent() { + const self = this; + window.onclick = function (e) { + if (document.getElementById('menuBar')) { + self.closeMenu(false); + } + }; + }, + getDomId(item) { + if (item && item.operate) { + return item.operate.domId; + } + return ''; + }, + noShowingChildren(children) { + if (!children || children.length <= 0) { + return true; + } + return false; + }, + hasShowingChildren(children) { + if (children && children.length > 0) { + return true; + } + return false; + }, + closeMenu(flag) { + if (flag || (this.mode !== TrainingMode.EDIT && this.mode !== TrainingMode.TEACH)) { + this.classA = this.tempClassA = -1; + this.classB = this.tempClassB = -1; + } + }, + hookClick(item, event) { + this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); + if (item && typeof item.click == 'function') { + item.click(item.operate); + } + }, + selectedClassA(item, index) { + const order = this.order || 0; + if (this.mode !== TrainingMode.TEACH) { // 编辑模式下可显示 + this.popupMenuA(item, index); + } else if (this.steps[order] && this.steps[order].type == 'bar') { // 操作步骤没有顶部操作顶部菜单都不可显示 + this.popupMenuA(item, index); + } + }, + // 弹出顶部菜单操作 + popupMenuA(item, index) { + this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); + this.clickEvent(); + const operate = { + type: 'bar', + operation: item.operate.operation + }; + this.tempClassA = index; + this.tempClassB = -1; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + } + }); + }, + selectedClassB(item, index) { + const order = this.order || 0; + if (this.mode !== TrainingMode.TEACH) { // 编辑模式下可显示 + this.popupMenuB(item, index); + } else if (this.steps[order] && this.steps[order].type == 'bar') { // 操作步骤没有顶部操作顶部菜单都不可显示 + this.popupMenuB(item, index); + } + }, + popupMenuB(item, index) { + this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); + const operate = { + type: 'bar', + operation: item.operate.operation + }; + this.tempClassB = index; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + } + }); + }, + // 设置地图定位 + mapLocation(code) { + if (code) { + this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: code }); + this.closeMenu(true); + } + }, + // 站遥控 + stationRemoteControl(order) { + const operate = { + type: 'bar', + operation: order.operation + }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.stationControl.doShow(operate); - } - }); - }, - // 设置全线扣车 - setDetainTrainAll(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.detainTrainContorl.doShow(operate); - } - }); - }, - // 取消全线扣车 - cancelDetainTrainAll(order) { - const operate = { - type: 'bar', - operation: order.operation - }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.stationControl.doShow(operate); + } + }); + }, + // 设置全线扣车 + setDetainTrainAll(order) { + const operate = { + type: 'bar', + operation: order.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.detainTrainContorl.doShow(operate); + } + }); + }, + // 取消全线扣车 + cancelDetainTrainAll(order) { + const operate = { + type: 'bar', + operation: order.operation + }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.detainTrainContorl.doShow(operate); - } - }); - }, - // 取消上行扣车 - cancelUpDetainTrainAll(order) { - const operate = { - type: 'bar', - operation: order.operation - }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.detainTrainContorl.doShow(operate); + } + }); + }, + // 取消上行扣车 + cancelUpDetainTrainAll(order) { + const operate = { + type: 'bar', + operation: order.operation + }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.detainTrainContorlUpDown.doShow(operate); - } - }); - }, - // 取消下行扣车 - cancelDownDetainTrainAll(order) { - const operate = { - type: 'bar', - operation: order.operation - }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.detainTrainContorlUpDown.doShow(operate); + } + }); + }, + // 取消下行扣车 + cancelDownDetainTrainAll(order) { + const operate = { + type: 'bar', + operation: order.operation + }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.detainTrainContorlUpDown.doShow(operate); - } - }); - }, - // 设置列车识别号显示 - setTrainIdDisplay(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.viewTrainId.doShow(operate); - } - }); - }, - // 设置设备显示 - setNameDisplay(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.viewName.doShow(operate); - } - }); - }, - // 设置名称显示 - setDeviceDisplay(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.viewDevice.doShow(operate); - } - }); - }, - // 添加计划车 - addPlanTrain(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.trainAdd.doShow(operate); - } - }); - }, - // 平移计划车 - translatPlanTrain(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.trainTranstalet.doShow(operate); - } - }); - }, - // 删除计划车 - delPlanTrain(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.trainDelete.doShow(operate); - } - }); - }, - // 用户管理 - userManage(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.manageUser.doShow(operate); - } - }); - }, - // 关于 - about(order) { - const operate = { - type: 'bar', - operation: order.operation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.closeMenu(true); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - this.$refs.helpAbout.doShow(operate); - } - }); - }, - // 刷新 - refresh() { - this.closeMenu(true); - EventBus.$emit('refresh'); - }, - getLoginResult(operate) { - /** 密码校验*/ - if (operate.operation == OperationEvent.StationControl.forcedStationControl.passwordConfirm.operation) { - if (operate.success) { - /** 校验成功*/ - this.$refs.stationControlConvert.doShow({ operation: OperationEvent.StationControl.forcedStationControl.mbar.operation }); - } - } - }, - undeveloped() { - this.doClose(); - this.$alert('实现中......', '提示', { - confirmButtonText: '确定', - callback: action => { - } - }); - }, - doClose() { - this.$nextTick(() => { - EventBus.$emit('closeMenu'); - }); - } - } + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.detainTrainContorlUpDown.doShow(operate); + } + }); + }, + // 添加计划车 + addPlanTrain(order) { + const operate = { + type: 'bar', + operation: order.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainAdd.doShow(operate); + } + }); + }, + // 平移计划车 + translatPlanTrain(order) { + const operate = { + type: 'bar', + operation: order.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainTranstalet.doShow(operate); + } + }); + }, + // 删除计划车 + delPlanTrain(order) { + const operate = { + type: 'bar', + operation: order.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainDelete.doShow(operate); + } + }); + }, + // 用户管理 + userManage(order) { + const operate = { + type: 'bar', + operation: order.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.manageUser.doShow(operate); + } + }); + }, + // 关于 + about(order) { + const operate = { + type: 'bar', + operation: order.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + this.closeMenu(true); + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.helpAbout.doShow(operate); + } + }); + }, + // 刷新 + refresh() { + this.closeMenu(true); + EventBus.$emit('refresh'); + }, + getLoginResult(operate) { + /** 密码校验*/ + if (operate.operation == OperationEvent.StationControl.forcedStationControl.passwordConfirm.operation) { + if (operate.success) { + /** 校验成功*/ + this.$refs.stationControlConvert.doShow({ operation: OperationEvent.StationControl.forcedStationControl.mbar.operation }); + } + } + }, + undeveloped() { + this.doClose(); + this.$alert('实现中......', '提示', { + confirmButtonText: '确定', + callback: action => { + } + }); + }, + doClose() { + this.$nextTick(() => { + EventBus.$emit('closeMenu'); + }); + } + } }; diff --git a/src/jmapNew/theme/beijing_01/menus/menuDialog/viewDevice.vue b/src/jmapNew/theme/beijing_01/menus/menuDialog/viewDevice.vue deleted file mode 100644 index 75084ae0f..000000000 --- a/src/jmapNew/theme/beijing_01/menus/menuDialog/viewDevice.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - - - 车次窗 - - - 区段边界 - - - 联锁自动进路表示灯 - - - ATS自动触发表示灯 - - - - - 确定 - - - - 取 消 - - - - - - - - diff --git a/src/jmapNew/theme/beijing_01/menus/menuDialog/viewName.vue b/src/jmapNew/theme/beijing_01/menus/menuDialog/viewName.vue deleted file mode 100644 index 957ac7b13..000000000 --- a/src/jmapNew/theme/beijing_01/menus/menuDialog/viewName.vue +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - 信号机名称 - - - 站台轨名称 - - - - - 按钮名称 - - - 折返轨名称 - - - - - 股道名称 - - - 转换轨名称 - - - - - 道岔名称 - - - 标识灯名称 - - - - - 道岔区段名称 - - - 目的地名称 - - - - - 计轴区段名称 - - - 公里标 - - - - - - 确定 - - - 取 消 - - - - - - - \ No newline at end of file diff --git a/src/jmapNew/theme/beijing_01/menus/menuDialog/viewTrainId.vue b/src/jmapNew/theme/beijing_01/menus/menuDialog/viewTrainId.vue deleted file mode 100644 index 7449859bc..000000000 --- a/src/jmapNew/theme/beijing_01/menus/menuDialog/viewTrainId.vue +++ /dev/null @@ -1,192 +0,0 @@ - - - - 计划车显示模式 - - - - 表号+车次号 - - - 表号+车组号 - - - - - 目的地号+车次号 - - - 目的地号+车组号 - - - - - 目的地号+表号+车次号 - - - 目的地号+表号+车组号 - - - - - - 头码车显示模式 - - - - 目的地号+车次号 - - - 目的地号+车组号 - - - - - - 字体大小 - - - - - - (范围:16-99) - - - - - - 确定 - - - 取 消 - - - - - - - diff --git a/src/jmapNew/theme/beijing_01/menus/menuSignal.vue b/src/jmapNew/theme/beijing_01/menus/menuSignal.vue index a64facb7a..b09861534 100644 --- a/src/jmapNew/theme/beijing_01/menus/menuSignal.vue +++ b/src/jmapNew/theme/beijing_01/menus/menuSignal.vue @@ -47,6 +47,8 @@ export default { data() { return { menu: [], + clickNum:0, + oldSelected:null, menuNormal: { Local: [ // { @@ -206,6 +208,23 @@ export default { switch (buttonOperation) { case OperationEvent.Signal.arrangementRoute.button.operation: { // 进路建立 + if (this.clickNum >= 1) { + let route = null; + this.routeList.forEach(elem => { + if (elem.startSignalCode === this.oldSelected.code && elem.endSignalCode === selectType.code) { + route = elem; + } + }); + if (route) { + this.setRoute(route); + } else { + this.$refs.noticeInfo.doShow({}, `没有以[${this.oldSelected.name}(${this.oldSelected.code})]为始端信号机,以[${selectType.name}(${selectType.code})] 为终端信号机的进路`); + } + this.clickNum = 0; + } else { + this.oldSelected = selectType; + this.clickNum++; + } break; } case OperationEvent.Signal.cancelTrainRoute.button.operation: { @@ -325,6 +344,23 @@ export default { this.$refs.noticeInfo.doShow(operate); }); }, + // 现地设置进路 + setRoute(route) { + const operate = { + start: true, + code: this.selected.code, + operation: OperationEvent.Signal.arrangementRoute.menu.operation, + param: { + routeCode: route.code + }, + cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + }).catch((error) => { + this.$refs.noticeInfo.doShow(operate, error.message); + }); + }, // 取消进路 cancelTrainRoute() { const operate = { diff --git a/src/jmapNew/theme/chengdu_01/model.js b/src/jmapNew/theme/chengdu_01/model.js index c050ebdef..62440bda8 100644 --- a/src/jmapNew/theme/chengdu_01/model.js +++ b/src/jmapNew/theme/chengdu_01/model.js @@ -29,7 +29,7 @@ class Model { nameFontSize: 10 // 字体大小 }; this['private'][deviceType.TrainWindow] = { - trainWindowShow: false + trainWindowShow: true }; } diff --git a/src/jmapNew/theme/chengdu_03/menus/menuBar.vue b/src/jmapNew/theme/chengdu_03/menus/menuBar.vue index 0a24c55e9..2e8b0bdae 100644 --- a/src/jmapNew/theme/chengdu_03/menus/menuBar.vue +++ b/src/jmapNew/theme/chengdu_03/menus/menuBar.vue @@ -66,7 +66,6 @@ - @@ -89,7 +88,6 @@ import TrainDelete from './menuDialog/trainDelete'; import PasswordBox from './menuDialog/passwordBox'; import ViewTrainId from './menuDialog/viewTrainId'; import ViewName from './menuDialog/viewName'; -import ViewDevice from './menuDialog/viewDevice'; import ManageUser from './menuDialog/manageUser'; import HelpAbout from './menuDialog/helpAbout'; import SetLimitSpeed from './menuDialog/setLimitSpeed'; @@ -104,7 +102,6 @@ export default { PasswordBox, ViewTrainId, ViewName, - ViewDevice, TrainAdd, TrainTranstalet, TrainDelete, diff --git a/src/jmapNew/theme/chengdu_03/menus/menuButton.vue b/src/jmapNew/theme/chengdu_03/menus/menuButton.vue index d385ec3c1..1f911fe85 100644 --- a/src/jmapNew/theme/chengdu_03/menus/menuButton.vue +++ b/src/jmapNew/theme/chengdu_03/menus/menuButton.vue @@ -76,12 +76,12 @@ - 功 - 能 + 功 + 能 - 按 - 钮 + 按 + 钮 @@ -332,18 +332,37 @@ export default { } else if (deviceList.length === 2) { this.routeList.forEach(item => { if (item.startSignalCode === deviceList[0].code && item.endSignalCode === deviceList[1].code) { - item.type; const operate = this.handelOperate(item); - console.log(operate, item); this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}); } }); } }, + handelFunctionButton(model, subType) { + const operate = { + send: true, + operation: this.$store.state.menuOperation.buttonOperation, + cmdType: '', + param: {} + }; + if (model._type === 'StationStand' && subType === 'StopJumpLamp') { + operate.cmdType = CMD.Stand.CMD_STAND_SET_JUMP_STOP; + operate.param = {standCode: model.code, trainGroupNumber: ''}; + } else if (model._type === 'StationStand' && subType === 'CancelStopJumpLamp') { + operate.cmdType = CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP; + operate.param = {standCode: model.code, trainGroupNumber: ''}; + } else if (model._type === 'MapCycleButtonVO' ) { + operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK; + operate.param = {cycleCode: model.cycleCode}; + } + this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}); + console.log(operate); + }, selectedChange() { // 按钮按下时 if (this.$store.state.menuOperation.buttonOperation) { const model = this.$store.state.menuOperation.selected; // 选择设备 + const subType = this.$store.state.menuOperation.subType; // 选择设备的子元素 this.deviceList.push(model); if (model._type) { if (this.Signal.arrangementRoute.button.operation === this.$store.state.menuOperation.buttonOperation) { @@ -351,8 +370,11 @@ export default { return; } this.arrangementRouteOperation(this.deviceList); + } if (this.$store.state.menuOperation.buttonOperation === this.MixinCommand.functionButton.button.operation) { + this.handelFunctionButton(model, subType); } else { const operate = this.handelOperate(model); + console.log(operate); if (this.cmdTypeList.indexOf(model._type) >= 0) { this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => { if (valid) { diff --git a/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewDevice.vue b/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewDevice.vue deleted file mode 100644 index c78c6ca30..000000000 --- a/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewDevice.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - - - 车次窗 - - - 区段边界 - - - 联锁自动进路表示灯 - - - ATS自动触发表示灯 - - - - - 确定 - - - - 取 消 - - - - - - - - diff --git a/src/jmapNew/theme/factory.js b/src/jmapNew/theme/factory.js index 0c4aef1a2..6523bc302 100644 --- a/src/jmapNew/theme/factory.js +++ b/src/jmapNew/theme/factory.js @@ -10,6 +10,15 @@ class Theme { '06': 'ningbo_01', '07': 'haerbin_01' // 哈尔滨培训线路 }; + this._localShowMode = { // 现地显示模式 + '01': 'all', // 成都一 全显 + '02': 'all', // 福州一 全显 + '03': 'all', // 北京一 全显 + '04': 'all', // 成都三 全显 + '05': 'all', // 国际版运行图皮肤 指向05 福州线路 全显 + '06': 'all', // 宁波一 全显 + '07': 'ecStation' // 哈尔滨培训线路 集中站显示 + }; } // 加载菜单组件 diff --git a/src/jmapNew/theme/haerbin_01/menus/index.vue b/src/jmapNew/theme/haerbin_01/menus/index.vue index b64f0c18f..437ecb332 100644 --- a/src/jmapNew/theme/haerbin_01/menus/index.vue +++ b/src/jmapNew/theme/haerbin_01/menus/index.vue @@ -63,7 +63,7 @@ export default { this.$store.state.training.roles != 'BigScreen'; }, isShowBar() { - return this.$store.state.training.prdType; + return this.$store.state.training.prdType === '01'; } }, watch: { @@ -353,4 +353,15 @@ export default { .haerbin-01__systerm .el-dialog .button-group { margin-top: 10px; } + .haerbin-01__systerm .nav-border .el-button { + height: 20px; + line-height: 20px; + padding: 0px; + width: 80px; + border: 1px solid #1F313F; + font-size: 12px; + border-radius: 5px !important; + color: #000; + background: #FFFFFF; + } diff --git a/src/jmapNew/theme/haerbin_01/menus/menuBar.vue b/src/jmapNew/theme/haerbin_01/menus/menuBar.vue index e59b47d55..c0d107e6f 100644 --- a/src/jmapNew/theme/haerbin_01/menus/menuBar.vue +++ b/src/jmapNew/theme/haerbin_01/menus/menuBar.vue @@ -1,118 +1,75 @@ - - - - - {{ item.title }} - - - - - {{ item.title }} - - - - - - - - {{ child.title }} - - - - - - - - - {{ grandchild.title }} - - - - - - - - - - - - - {{ child.title }} - - - - + + + + + + 登录 + + + + + + + + + + + {{ item.name }} - - - - + + + + {{ item.name }} + + + + + + + + A级警报 + B级警报 + C级警报 + 记录 + + + 声音 + 双屏 + TGI + 管理 + + + + + +   + + {{ '版本:' + version }} + + + + + +   +   + + + - - - - - - - - - - - diff --git a/src/jmapNew/theme/ningbo_01/menus/menuDialog/viewName.vue b/src/jmapNew/theme/ningbo_01/menus/menuDialog/viewName.vue deleted file mode 100644 index f9938cccb..000000000 --- a/src/jmapNew/theme/ningbo_01/menus/menuDialog/viewName.vue +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - 信号机名称 - - - 站台轨名称 - - - - - 按钮名称 - - - 折返轨名称 - - - - - 股道名称 - - - 转换轨名称 - - - - - 道岔名称 - - - 标识灯名称 - - - - - 道岔区段名称 - - - 目的地名称 - - - - - 计轴区段名称 - - - 公里标 - - - - - - 确定 - - - 取 消 - - - - - - - \ No newline at end of file diff --git a/src/jmapNew/theme/ningbo_01/menus/menuDialog/viewTrainId.vue b/src/jmapNew/theme/ningbo_01/menus/menuDialog/viewTrainId.vue deleted file mode 100644 index 43aee5cda..000000000 --- a/src/jmapNew/theme/ningbo_01/menus/menuDialog/viewTrainId.vue +++ /dev/null @@ -1,192 +0,0 @@ - - - - 计划车显示模式 - - - - 表号+车次号 - - - 表号+车组号 - - - - - 目的地号+车次号 - - - 目的地号+车组号 - - - - - 目的地号+表号+车次号 - - - 目的地号+表号+车组号 - - - - - - 头码车显示模式 - - - - 目的地号+车次号 - - - 目的地号+车组号 - - - - - - 字体大小 - - - - - - (范围:16-99) - - - - - - 确定 - - - 取 消 - - - - - - - diff --git a/src/scripts/cmdPlugin/CommandEnum.js b/src/scripts/cmdPlugin/CommandEnum.js index f3661d218..45b043238 100644 --- a/src/scripts/cmdPlugin/CommandEnum.js +++ b/src/scripts/cmdPlugin/CommandEnum.js @@ -91,7 +91,11 @@ export default { /** 取消联锁自动触发 */ CMD_SIGNAL_CANCEL_CI_AUTO_TRIGGER: {value:'Signal_Cancel_CI_Auto_Trigger', label: '取消联锁自动触发'}, /** 查询进路状态 */ - CMD_SIGNAL_DETAIL: {value:'Signal_Detail', label: '查询进路状态'} + CMD_SIGNAL_DETAIL: {value:'Signal_Detail', label: '查询进路状态'}, + /** 设置自动折返 */ + CMD_SIGNAL_SET_AUTO_TURN_BACK: {value: 'Signal_Set_Auto_Turn_Back', label: '设置自动折返'}, + /** 取消自动折返 */ + CMD_SIGNAL_CANCEL_AUTO_TURN_BACK: {value: 'Signal_Cancel_Auto_Turn_Back', label: '取消自动折返'} }, // 物理区段操作 diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 32afb8d79..8c8c6fa0e 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -196,7 +196,8 @@ const map = { trainDetails: null, // 地图'列车详情'显示 deleteCount: 0, // 绘图快捷删除标识 updateCount: 0, // 绘图快捷修改标识 - mousemove: 0 // 实训战场图移动标识 + mousemove: 0, // 实训战场图移动标识 + version: '' // 地图版本 }, getters: { @@ -255,7 +256,7 @@ const map = { }, version: (state) => { if (state.map) { - return state.map.version; + return state.version; } else { return null; } @@ -637,6 +638,9 @@ const map = { }, updateRouteState: (state, status) => { state.routeData[status.code] = deepAssign(state.routeData[status.code], status); + }, + setMapVersion:(state, version) => { + state.version = version; } }, @@ -784,6 +788,9 @@ const map = { setMousemove: ({ commit }) => { commit('setMousemove'); + }, + setMapVersion: ({commit}, version) => { + commit('setMapVersion', version); } } diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index d8b10d887..ae880e5e3 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -3,10 +3,10 @@ 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.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.6:9000'; // 旭强 - BASE_API = 'http://192.168.3.41:9000'; // 张赛 + // BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 diff --git a/src/utils/loaddata.js b/src/utils/loaddata.js index d7af33551..3c29d45e2 100644 --- a/src/utils/loaddata.js +++ b/src/utils/loaddata.js @@ -51,6 +51,7 @@ export function loadNewMapDataByGroup(group) { store.dispatch('map/setRouteData', routeData); const mapConfig = resp.data.configVO; store.dispatch('map/setMapConfig', mapConfig); + store.dispatch('map/setMapVersion', resp.data.version); }).catch(error => { reject(error); }); diff --git a/src/views/newMap/jlmapNew/index.vue b/src/views/newMap/jlmapNew/index.vue index c32936182..aff6a8fd8 100644 --- a/src/views/newMap/jlmapNew/index.vue +++ b/src/views/newMap/jlmapNew/index.vue @@ -4,7 +4,8 @@ - + + @@ -36,6 +37,7 @@ import localStore from 'storejs'; import Jlmap from '@/jmapNew/map'; import ZoomBox from './pendant/zoom'; import ShowMode from './pendant/showMode'; +import SwitchStation from './pendant/switchStation'; import ProgressBar from '@/views/components/progressBar/index'; import { mapGetters } from 'vuex'; import { TrainingMode } from '@/scripts/ConstDic'; @@ -47,7 +49,8 @@ export default { components: { ZoomBox, ProgressBar, - ShowMode + ShowMode, + SwitchStation }, data() { return { @@ -62,7 +65,11 @@ export default { y: 0 }, sectionActive: false, - operate: null + operate: null, + concentrationStationList: [], + showMode: '03', + localStationShow: false, + previewOrMapDraw: false }; }, computed: { @@ -159,12 +166,9 @@ export default { // 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作 const path = window.location.href; const mouseWheelFlag = true; - let previewOrMapDraw = false; - // if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) { - // mouseWheelFlag = true; - // } + this.previewOrMapDraw = false; if (path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1) { - previewOrMapDraw = true; + this.previewOrMapDraw = true; } const prdType = this.$route.query.prdType; Vue.prototype.$theme = new Theme(); @@ -183,7 +187,7 @@ export default { }, showConfig: { prdType: prdType, - previewOrMapDraw: previewOrMapDraw, + previewOrMapDraw: this.previewOrMapDraw, showMode: '03' }, methods: { @@ -227,6 +231,18 @@ export default { // 地图数据加载完成 handleDataLoaded() { this.$store.dispatch('map/mapDataLoaded'); + const concentrationStationList = []; + this.$store.state.map.map.stationList.forEach(item => { + if (item.centralized) { + concentrationStationList.push({value: item.code, name: item.name}); + } + }); + this.concentrationStationList = concentrationStationList; + const lineCode = this.$store.state.map.map.skinVO.code; + if (Vue.prototype.$theme) { + this.localStationShow = Vue.prototype.$theme._localShowMode[lineCode] === 'ecStation'; + } + this.$store.dispatch('map/setTrainWindowShow', this.previewOrMapDraw); }, // 地图视图加载完成 handleViewLoaded() { @@ -330,10 +346,30 @@ export default { }, // 切换现地行调显示界面(绘图和预览页面下) setShowMode(showMode) { - const list = [...this.$store.state.map.map.automaticRouteButtonList, ...this.$store.state.map.map.cycleButtonList, - ...this.$store.state.map.map.stationList, ...this.$store.state.map.map.stationStandList, - ...this.$store.state.map.map.lineList, ...this.$store.state.map.map.textList, ...this.$store.state.map.map.outerFrameList]; + if (this.showMode !== showMode) { + this.setShowStation(''); + this.$refs.switchStation.inintShowStation(); + } + this.showMode = showMode; + const nameList = Object.keys(this.$store.state.map.map); + let list = []; + nameList.forEach(item => { + if (item !== 'skinVO') { + list = [...list, ...this.$store.state.map.map[item]]; + } + }); this.$jlmap.updateShowMode(list, showMode); + }, + setShowStation(stationCode) { + const nameList = Object.keys(this.$store.state.map.map); + let list = []; + nameList.forEach(item => { + if (item !== 'skinVO') { + list = [...list, ...this.$store.state.map.map[item]]; + } + }); + this.$jlmap.updateShowStation(list, stationCode); + this.setCenter(stationCode); } } }; diff --git a/src/views/newMap/jlmapNew/pendant/showMode.vue b/src/views/newMap/jlmapNew/pendant/showMode.vue index 469b9d02c..344175d23 100644 --- a/src/views/newMap/jlmapNew/pendant/showMode.vue +++ b/src/views/newMap/jlmapNew/pendant/showMode.vue @@ -8,10 +8,18 @@ + diff --git a/src/views/newMap/jlmapNew/pendant/zoom.vue b/src/views/newMap/jlmapNew/pendant/zoom.vue index 87764c435..814655164 100644 --- a/src/views/newMap/jlmapNew/pendant/zoom.vue +++ b/src/views/newMap/jlmapNew/pendant/zoom.vue @@ -31,13 +31,15 @@ export default { }); } }, + mounted() { + this.setPosition(); + }, methods: { setPosition() { this.$nextTick(() => { let offset = 15; const menuBar = document.getElementById('menuBar'); const menuTool = document.getElementById('menuTool'); - if (menuBar) { offset += (menuBar.offsetHeight || 0); }