From e48543d5eefda56771eca5985cb45a3c7d9f1852 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Tue, 2 Mar 2021 15:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E8=B7=AF=EF=BC=9A=E8=A5=BF=E5=AE=892?= =?UTF-8?q?=20=E9=97=AE=E9=A2=98=EF=BC=9A=201.=E6=89=A3=E8=BD=A6=E5=92=8C?= =?UTF-8?q?=E8=B7=B3=E5=81=9C=E4=BA=92=E6=96=A5=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B=202.=E4=B8=BA=E8=8E=B7=E5=8F=96=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=9D=83=E6=97=B6=EF=BC=8C=E6=B2=A1=E6=9C=89=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=8E=92=E5=88=97=E8=BF=9B=E8=B7=AF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=203.=E4=BF=AE=E6=94=B9=E8=BD=A6=E7=AB=99AU/MN=20LA=20=E7=9A=84?= =?UTF-8?q?=E7=BB=98=E5=9B=BE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/xian_02.js | 58 +++---------- src/jmapNew/map.js | 1 + src/jmapNew/shape/Station/index.js | 81 ++++++++++++++++--- .../theme/xian_02/menus/menuSignal.vue | 13 ++- .../theme/xian_02/menus/menuStation.vue | 1 - .../theme/xian_02/menus/popStationStand.vue | 29 +++---- src/scripts/cmdPlugin/CommandHandler.js | 1 + src/scripts/cmdPlugin/Handler.js | 2 +- src/scripts/cmdPlugin/MenuContextHandler.js | 64 +++++++++++---- 9 files changed, 164 insertions(+), 86 deletions(-) diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 64c6eb003..0abecacea 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -415,54 +415,22 @@ class SkinCode extends defaultStyle { text: { distance: 2, // 灯和文字之间的距离 fontSize: 12, // 字体大小 - fontFormat: 'consolas', // 字体格式 - centerControlColor: '#ffffff', // 中控字体颜色 - stationControlColor: '#ff0', // 站控字体颜色 - emergencyControlColor:'#f00', // 紧急站控字体颜色 + offsetX: 30, // 偏移差值X + offsetY: 0, // 偏移差值Y + fontFormat: 'consolas', // 字体格式 + centerControlColor: '#ffffff', // 中控字体颜色 + stationControlColor: '#ff0', // 站控字体颜色 + emergencyControlColor:'#f00', // 紧急站控字体颜色 + automaticRouteColor: '#3CB960', // 自动进路 + manualRouteColor: '#f00', // 人工进路 + openCommunicationColor: '#3CB960', // 建立通信 + closeCommunicationColor: '#f00', // 断开通信 + testValidColor: '#3CB960', // 验证生效 + testInvalidColor: '#f00', // 验证无效 fontWeight: 'normal', // 字体粗细 textAlign: 'middle', // 字体水平对齐 - textVerticalAlign: 'top' // 字体垂直对齐 + textVerticalAlign: 'top', // 字体垂直对齐 } - // lamp: { - // count: 4, // 控制模式的个数 - // offset: {x: 20, y: 0}, // 偏移量 - // emergencyOffset: {x: 0, y: 0}, - // radiusR: 4, // 控制模式灯的半径 - // distance: 46, // 控制模式之间灯之间的距离 - // grayColor: '#C0C0C0', // 控制模式灰色 - // greenColor: 'green', // 控制模式绿色 - // redColor: 'red', // 控制模式红色 - // yellowColor: 'yellow' // 控制模式黄色 - // }, - // emergencyControl: { // 紧急站控 - // show: true, - // offset: { x: 0, y: 0 }, - // text: '紧急', - // arrowShow: false, - // grayColor: '#7F7F7F' - // }, - // centerControl: { // 中控 - // show: true, - // offset: { x: 0, y: 0 }, - // text: '中控', - // buttonShow: false, - // arrowShow: false, - // grayColor: '#7F7F7F' - // }, - // substationControl: { // 站控按钮 - // show: true, - // offset: { x: 0, y: 0 }, - // text: '站控', - // arrowShow: false, - // grayColor: '#7F7F7F' - // }, - // interconnectedControl: { // 联锁控 - // show: false, - // offset: { x: 0, y: 0 }, - // text: '联锁控', - // arrowShow: false, - // grayColor: '#7F7F7F' - // } } }; diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 80e8138da..bc52f88b4 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -527,6 +527,7 @@ class Jlmap { } const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig); + if (elem.dispose) { this.$painter.delete(oDevice); } else { diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index 7b0e9a8c8..3b48fb5ca 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -155,7 +155,10 @@ export default class Station extends Group { if (!this.style.Station.StationControl.disPlayNone) { if (this.style.Station.StationControl.special) { if (model.visible && model.createControlMode) { // model.createControlMode 控制模式 - this.createSpecialControlMode(); + this.createControlModeAU(); + this.createControlModeCC(); + this.createControlModeCL(); + this.createControlModeVA(); } } else { if (model.visible && model.createControlMode) { // model.createControlMode 控制模式 @@ -170,14 +173,34 @@ export default class Station extends Group { this.setState(model); } - createSpecialControlMode() { + createControlModeAU() { // 西安二 const model = this.model; - this.stationControlText = new Text({ + this.stationControlAU = new Text({ zlevel: this.zlevel, z: this.z, style: { - x: model.controlModePoint.x, - y: model.controlModePoint.y, + x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX*-1, + y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY, + fontWeight: this.style.Station.StationControl.text.fontWeight, + fontSize: this.style.Station.StationControl.text.fontSize, + fontFamily: this.style.fontFamily, + text: 'AU', + textFill: this.style.Station.StationControl.text.automaticRouteColor, + textAlign: this.style.Station.StationControl.text.textAlign, + textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign + } + }); + this.add(this.stationControlAU); + } + + createControlModeCC() { // 西安二 + const model = this.model; + this.stationControlCC = new Text({ + zlevel: this.zlevel, + z: this.z, + style: { + x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX*0, + y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY, fontWeight: this.style.Station.StationControl.text.fontWeight, fontSize: this.style.Station.StationControl.text.fontSize, fontFamily: this.style.fontFamily, @@ -187,7 +210,47 @@ export default class Station extends Group { textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign } }); - this.add(this.stationControlText); + this.add(this.stationControlCC); + } + + createControlModeCL() { // 西安二 + const model = this.model; + this.stationControlCL = new Text({ + zlevel: this.zlevel, + z: this.z, + style: { + x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX*1, + y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY, + fontWeight: this.style.Station.StationControl.text.fontWeight, + fontSize: this.style.Station.StationControl.text.fontSize, + fontFamily: this.style.fontFamily, + text: 'CL', + textFill: this.style.Station.StationControl.text.openCommunicationColor, + textAlign: this.style.Station.StationControl.text.textAlign, + textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign + } + }); + this.add(this.stationControlCL); + } + + createControlModeVA() { // 西安二 + const model = this.model; + this.stationControlVA = new Text({ + zlevel: this.zlevel, + z: this.z, + style: { + x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX*2, + y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY, + fontWeight: this.style.Station.StationControl.text.fontWeight, + fontSize: this.style.Station.StationControl.text.fontSize, + fontFamily: this.style.fontFamily, + text: 'VA', + textFill: this.style.Station.StationControl.text.testValidColor, + textAlign: this.style.Station.StationControl.text.textAlign, + textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign + } + }); + this.add(this.stationControlVA); } createEmergencyControl() { // 紧急站控 @@ -418,7 +481,7 @@ export default class Station extends Group { this.stationText.setColor('#1fdc1f'); } - this.stationControlText && this.stationControlText.setStyle({text:'CC', textFill:this.style.Station.StationControl.text.centerControlColor}); + this.stationControlCC && this.stationControlCC.setStyle({text:'CC', textFill:this.style.Station.StationControl.text.centerControlColor}); // // // if (this.style.Station.StationControl.disPlayNone) { @@ -436,7 +499,7 @@ export default class Station extends Group { this.substationControl && this.substationControl.setTextColor(this.style.Station.StationControl.lamp.yellowColor); // 文字颜色 this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.substationArrowsControl && this.substationArrowsControl.setColor(this.style.Station.StationControl.lamp.greenColor); - this.stationControlText && this.stationControlText.setStyle({text:'LC', textFill:this.style.Station.StationControl.text.stationControlColor}); + this.stationControlCC && this.stationControlCC.setStyle({text:'LC', textFill:this.style.Station.StationControl.text.stationControlColor}); // if (this.style.Station.StationControl.disPlayNone) { // this.stationText && this.stationText.setStyle('textFill', '#fff'); // if (this.model.subheadDisplay) { // 副标题 @@ -454,7 +517,7 @@ export default class Station extends Group { this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyArrowsControl && this.emergencyArrowsControl.setColor(this.style.Station.StationControl.lamp.greenColor); - this.stationControlText && this.stationControlText.setStyle({text:'EL', textFill:this.style.Station.StationControl.text.emergencyControlColor}); + this.stationControlCC && this.stationControlCC.setStyle({text:'EL', textFill:this.style.Station.StationControl.text.emergencyControlColor}); // if (this.style.Station.StationControl.disPlayNone) { // this.stationText && this.stationText.setStyle('textFill', '#fff'); // if (this.model.subheadDisplay) { // 副标题 diff --git a/src/jmapNew/theme/xian_02/menus/menuSignal.vue b/src/jmapNew/theme/xian_02/menus/menuSignal.vue index 5a4df05c1..dda3c4340 100644 --- a/src/jmapNew/theme/xian_02/menus/menuSignal.vue +++ b/src/jmapNew/theme/xian_02/menus/menuSignal.vue @@ -209,7 +209,11 @@ export default { handler: this.triggerFaultManagement, cmdType: CMD.Fault.CMD_TRIGGER_FAULT } - ] + ], + prdType2ControlModeMap: { + '01': 'Local', + '02': 'Center' + } }; }, computed: { @@ -224,6 +228,9 @@ export default { 'routeList', 'routeData' ]), + prdType() { + return this.$store.state.training.prdType; + }, group() { return this.$route.query.group; } @@ -239,7 +246,9 @@ export default { } }, '$store.state.menuOperation.leftClickCount': function (val) { - if (this.selected._type === 'Signal') { + const control = MenuContextHandler.getStationControl(this.selected); + const controlMode = this.prdType2ControlModeMap[this.prdType]; + if (this.selected._type === 'Signal' && control.controlMode == controlMode) { this.arrangementRoute(); } } diff --git a/src/jmapNew/theme/xian_02/menus/menuStation.vue b/src/jmapNew/theme/xian_02/menus/menuStation.vue index 376890341..d73ae9697 100644 --- a/src/jmapNew/theme/xian_02/menus/menuStation.vue +++ b/src/jmapNew/theme/xian_02/menus/menuStation.vue @@ -14,7 +14,6 @@ import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo' import { mapGetters } from 'vuex'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import CMD from '@/scripts/cmdPlugin/CommandEnum'; -// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; diff --git a/src/jmapNew/theme/xian_02/menus/popStationStand.vue b/src/jmapNew/theme/xian_02/menus/popStationStand.vue index a4de8c47b..b058ead31 100644 --- a/src/jmapNew/theme/xian_02/menus/popStationStand.vue +++ b/src/jmapNew/theme/xian_02/menus/popStationStand.vue @@ -19,8 +19,9 @@ import StopProfile from './dialog/stopProfile'; import { mapGetters } from 'vuex'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; -import CMD from '@/scripts/cmdPlugin/CommandEnum'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; +import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; +import CMD from '@/scripts/cmdPlugin/CommandEnum'; export default { name: 'StationStandMenu', @@ -65,17 +66,18 @@ export default { { label: '列车跳停本站', handler: this.setJumpStop, - cmdType: CMD.Stand.CMD_STAND_SET_PARK_TIME + cmdType: CMD.Stand.CMD_STAND_SET_JUMP_STOP, + checkDisabled: (selected) => { return selected && (selected.centerHoldTrain||selected.stationHoldTrain) } }, { label: '取消列车跳停本站', handler: this.cancelJumpStop, - cmdType: CMD.Stand.CMD_STAND_SET_PARK_TIME + cmdType: CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP }, { label: '帮助', handler: this.setStopTime, - cmdType: CMD.Stand.CMD_STAND_SET_PARK_TIME + cmdType: CMD.Stand.CMD_STAND_VIEW_STATUS } ] }, @@ -90,7 +92,7 @@ export default { { label: '帮助', handler: this.setStopTime, - cmdType: CMD.Stand.CMD_STAND_SET_PARK_TIME + cmdType: CMD.Stand.CMD_STAND_VIEW_STATUS } ] }, @@ -100,14 +102,13 @@ export default { { label: '扣车', handler: this.setStandDetain, - cmdType: CMD.Stand.CMD_STAND_SET_PARK_TIME, - disabled: this.selected && this.selected.centerHoldTrain + cmdType: CMD.Stand.CMD_STAND_SET_HOLD_TRAIN, + checkDisabled: (selected) => { return selected && selected.allSkip } }, { label: '发车', handler: this.cancelStandDetain, - cmdType: CMD.Stand.CMD_STAND_SET_PARK_TIME, - disabled: this.selected && !this.selected.centerHoldTrain + cmdType: CMD.Stand.CMD_STAND_EARLY_DEPART } ] }, @@ -238,15 +239,15 @@ export default { this.menu = this.updateStandPlan.Center; break; case 'stopJumping': - this.menu = this.stopJumping.Center; + this.menu = MenuContextHandler.covertList(this.stopJumping.Center); break; case 'allTrainStopJump': this.topTip = '所有列车跳停本站'; - this.menu = this.allTrainStopJump.Center; + this.menu = MenuContextHandler.covertList(this.allTrainStopJump.Center); break; case 'standDetain': this.topTip = '站台扣车 SET/CANCEL'; - this.menu = this.standDetain.Center; + this.menu = MenuContextHandler.covertList(this.standDetain.Center); break; case 'psdInfoConfirm': this.topTip = '站台屏蔽门报警-站台屏蔽门信息确认'; @@ -259,8 +260,8 @@ export default { this.menu = this.downStopProfile.Center; break; } - // this.menu = MenuContextHandler.covert(this.menuNormal); - // 故障模式菜单列表 + + // 故障模式菜单列表 if (this.operatemode === OperateMode.FAULT) { this.menu = this.menuForce; } diff --git a/src/scripts/cmdPlugin/CommandHandler.js b/src/scripts/cmdPlugin/CommandHandler.js index f6bbf9c17..4e64bbff4 100644 --- a/src/scripts/cmdPlugin/CommandHandler.js +++ b/src/scripts/cmdPlugin/CommandHandler.js @@ -58,6 +58,7 @@ class CommandHandle { getDefinition(cmdType) { if (cmdType) { const simulationRole = Handler.getSimulationRole(); + if (simulationRole) { return this.definitionMap[simulationRole][cmdType.value] || this.definitionMap.Common[cmdType.value] || null; } else { diff --git a/src/scripts/cmdPlugin/Handler.js b/src/scripts/cmdPlugin/Handler.js index 23bd42953..733126b74 100644 --- a/src/scripts/cmdPlugin/Handler.js +++ b/src/scripts/cmdPlugin/Handler.js @@ -147,7 +147,7 @@ class Handler { getOrder() { return store.state.training.order; - } + } getSimulationRole() { return State2SimulationMap[store.state.training.prdType]; diff --git a/src/scripts/cmdPlugin/MenuContextHandler.js b/src/scripts/cmdPlugin/MenuContextHandler.js index 3f09394f3..33f202bb2 100644 --- a/src/scripts/cmdPlugin/MenuContextHandler.js +++ b/src/scripts/cmdPlugin/MenuContextHandler.js @@ -4,7 +4,7 @@ import { State2SimulationMap, State2ControlMap } from './Config'; import { OperateMode } from '@/scripts/ConstDic'; class MenuContextHandler { - constructor() { + constructor(store) { this.operates = []; // 操作数据 this.command = {}; // 命令对象 } @@ -35,6 +35,10 @@ class MenuContextHandler { return store.state.training.prdType; } + getDeviceByCode(code) { + return store.state.map.mapDevice[code]; + } + // 判断指令是否隐藏 checkDisabled(data, selected) { let result = false; @@ -60,7 +64,7 @@ class MenuContextHandler { return result; } - covert2(menuList) { + covert2(menuMap) { const selected = this.getCurrentStateObject(); let menu = []; const control = this.getStationControl(selected); @@ -69,14 +73,12 @@ class MenuContextHandler { const type = State2SimulationMap[this.getPrdType()]; const status = State2ControlMap[control.controlMode]; // 判断当前模式 if (type) { - menu = [...menuList[type]]; + menu = [...menuMap[type]]; } // 特殊处理站台的右键操作( 因为小站台不允许有操作 ) - if (selected._type == 'StationStand') { - if (selected.small) { - menu = []; - } + if (selected._type == 'StationStand' && selected.small) { + menu = []; } if (menu.constructor === Array) { @@ -95,7 +97,7 @@ class MenuContextHandler { return menu; } - covert(menuList) { + covert(menuMap) { const selected = this.getCurrentStateObject(); let menu = []; const control = this.getStationControl(selected); @@ -104,13 +106,11 @@ class MenuContextHandler { const type = State2SimulationMap[this.getPrdType()]; const status = State2ControlMap[control.controlMode]; // 判断当前模式 if (type) { - menu = [...menuList[type]]; + menu = [...menuMap[type]]; } // 特殊处理站台的右键操作( 因为小站台不允许有操作 ) - if (selected._type == 'StationStand') { - if (selected.small) { - menu = []; - } + if (selected._type == 'StationStand' && selected.small) { + menu = []; } if (menu.constructor === Array) { menu.forEach(elem => { @@ -128,18 +128,54 @@ class MenuContextHandler { return menu; } + covertList(list) { + const menu = [...list]; + const selected = this.getCurrentStateObject(); + const control = this.getStationControl(selected); + if (control && !store.state.scriptRecord.audioPlay) { + if (this.getPrdType() != '' && this.getPrdType() != null) { + const type = State2SimulationMap[this.getPrdType()]; + const status = State2ControlMap[control.controlMode]; // 判断当前模式 + + // 特殊处理站台的右键操作( 因为小站台不允许有操作 ) + if (selected._type == 'StationStand' && selected.small) { + menu = []; + } + + if (menu.constructor === Array) { + menu.forEach(elem => { + if (elem.children && elem.children.length > 0) { + elem.children.forEach(each=>{ + this.covertEachCommand(each, type, selected, status, false); + }); + } else { + this.covertEachCommand(elem, type, selected, status, false); + } + }); + } + } + } + return menu; + } + covertEachCommand(elem, type, selected, status, isSettingCommand = true) { if (elem.type === 'separator') { elem.show = true; return; } + const data = CommandHandler.getDefinition(elem.cmdType); + const model = this.getDeviceByCode(selected.code); if (data) { // 判断指令是否显示 if (data.simulationRole.toUpperCase() == type.toUpperCase() && data.controlMode.indexOf(status) > -1) { elem.show = true; - elem.disabled = this.checkDisabled(data, selected); + elem.disabled = this.checkDisabled(data, model); + if (!elem.disabled && + elem.checkDisabled) { + elem.disabled = !!elem.checkDisabled(model); + } } else { elem.show = true; elem.disabled = true;