diff --git a/src/api/rtSimulation.js b/src/api/rtSimulation.js new file mode 100644 index 000000000..6c9e74571 --- /dev/null +++ b/src/api/rtSimulation.js @@ -0,0 +1,94 @@ +import request from '@/utils/request'; +/** 创建仿真 */ +export function createSimulation(data) { + return request({ + url: `/rtSimulation?mapId=${data.mapId}&prdType=${data.prdType}`, + method: 'post' + }); +} +/** 根据仿真group获取仿真基础信息 */ +export function getSimulationInfoByGroup(groupId) { + return request({ + url: `/common/simulation/${groupId}`, + method: 'get' + }); +} +/** 根据仿真group获取仿真地图数据 */ +export function getMapDataByGroup(groupId) { + return request({ + url: `/rtSimulation/${groupId}/mapData`, + method: 'get' + }); +} +/** 仿真发送指令 */ +export function sendSimulationCommand(group, memberId, type, data) { + return request({ + url: `/common/simulation/${group}/member/${memberId}/operate/${type}`, + method: 'post', + data + }); +} +/** 获取仿真成员列表 */ +export function getMemberListCommon(group) { + return request({ + url: `/common/simulation/${group}/members`, + method: 'get' + }); +} +/** 获取仿真用户列表 */ +export function getUserListCommon(group) { + return request({ + url: `/common/simulation/${group}/users`, + method: 'get' + }); +} +/** 销毁仿真 */ +export function destroySimulation(group) { + return request({ + url: `/common/simulation/${group}/destroy`, + method: 'delete' + }); +} +/** 初始化仿真 */ +export function initSimulation(group) { + return request({ + url: `/common/simulation/${group}/init`, + method: 'put' + }); +} +/** 设置故障 */ +export function setSimulationFault(group, data) { + return request({ + url: `/common/simulation/${group}/fault`, + method: 'post', + data + }); +} +/** 取消故障 */ +export function cancelSimulationFault(group, deviceId, faultType) { + return request({ + url: `/common/simulation/${group}/device/${deviceId}/fault/${faultType}`, + method: 'delete' + }); +} +/** 仿真运行倍速 */ +export function timesSpeedPlayback(group, speed) { + return request({ + url: `/common/simulation/${group}/updateSpeed/${speed}`, + method: 'put' + }); +} +/** 仿真暂停 */ +export function simulationPause(group) { + return request({ + url: `/common/simulation/${group}/pause`, + method: 'put' + }); +} +/** 仿真开始 */ +export function simulationStart(group) { + return request({ + url: `/common/simulation/${group}/start`, + method: 'put' + }); +} diff --git a/src/api/trainingPlatform.js b/src/api/trainingPlatform.js index 277ffebb1..6a3d9a6b2 100644 --- a/src/api/trainingPlatform.js +++ b/src/api/trainingPlatform.js @@ -15,6 +15,13 @@ export function generateMapSystem(mapId) { method: 'post' }); } +/** 生成指定子系统 */ +export function generateAppointMapSystem(mapId, prdType) { + return request({ + url: `/api/mapSystem/generate/${mapId}/${prdType}`, + method: 'post' + }); +} /** 查询子系统信息 */ export function getSubSystemInfo(id) { return request({ diff --git a/src/jmapNew/config/skinCode/datie_01.js b/src/jmapNew/config/skinCode/datie_01.js index 8e3eb812c..9707823b8 100644 --- a/src/jmapNew/config/skinCode/datie_01.js +++ b/src/jmapNew/config/skinCode/datie_01.js @@ -168,6 +168,7 @@ class SkinCode extends defaultStyle { this[deviceType.Signal] = { distance: 10, // 设备距离区段的距离 + colorSpecial: true, // 特殊处理灯位颜色 post: { standardLength: 6, // 高柱长度 standardHeight: 6, // 灯柱高度 @@ -182,9 +183,18 @@ class SkinCode extends defaultStyle { fontSize: 11, // 信号机名称字体大小 fontWeight: 'bold', // 信号机名称字体粗细 defaultColor: '#FFFFFF', // 信号灯字体默认色 - blockColor: '#EF0C08', // 信号灯字体锁定颜色 + blockColor: '#FFFFFF', // 信号灯字体锁定颜色 checkColor: '#00FF00' // 信号保护区段检查颜色 }, + remainTimeColor: '#F00', + tText: { + offsetX: 0, + offsetY: -30, + fontSize: 11, // 信号机名称字体大小 + fontWeight: 'bold', // 信号机名称字体粗细 + defaultColor: '#F00', // 信号灯字体默认色 + defaultText: 0 + }, lamp: { bgShow: false, // 是否被选中 guidName: 'singleRY', // 成都三号线引导类型 diff --git a/src/jmapNew/config/skinCode/race_01.js b/src/jmapNew/config/skinCode/race_01.js index 1e2640fae..aa4da8d91 100644 --- a/src/jmapNew/config/skinCode/race_01.js +++ b/src/jmapNew/config/skinCode/race_01.js @@ -529,8 +529,8 @@ class SkinCode extends defaultStyle { core: { length: 6, // 道岔单边长度 graphShow: true, // 图形显示 - graphInversionColor: '#FFFF00', // 反位颜色 - graphLocalColor: '#00FF00' // 定位颜色 + graphInversionColor: '#FFFF00', // 反位颜色 + graphLocalColor: '#00FF00' // 定位颜色 }, jointImg: { // 道岔 A B C D四元素属性配置 trapezoidLength: 8, // 直角梯形元素默认长度 @@ -662,13 +662,14 @@ class SkinCode extends defaultStyle { changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 specialTrainType: [ { - type: '03', + type: 'MANUAL', serviceNumber: 'M0', nameFormat: 'serviceNumber:groupNumber' }, { - type: '02', - nameFormat: 'targetCode:groupNumber' + type: 'HEAD', + serviceNumber: 'M0', + nameFormat: 'serviceNumber:targetCode' } ], // 特殊列车类型需设置显示格式 lrPadding: 4, // 两边间隔 @@ -697,8 +698,8 @@ class SkinCode extends defaultStyle { textAContent: 'A'// textA文本 }, trainNumber: { - targetCodePrefix: '000', // 目的地码前缀 - trainNumberOffset: { x: 0, y: 1 }// 目的地码偏移量 + targetCodePrefix: '00', // 目的地码前缀 + trainNumberOffset: { x: 0, y: 4 }// 目的地码偏移量 }, trainServer: { serviceNumberPrefix: '00', // 服务号(表号)前缀 @@ -803,7 +804,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.FloodGate] = {}; this[deviceType.DirectionRod] = {}; - this[deviceType.IndicatorLight] = {}; + this[deviceType.IndicatorLight] = {}; } } diff --git a/src/jmapNew/shape/Signal/ESigName.js b/src/jmapNew/shape/Signal/ESigName.js index 55c9feccf..b8025bd18 100644 --- a/src/jmapNew/shape/Signal/ESigName.js +++ b/src/jmapNew/shape/Signal/ESigName.js @@ -44,13 +44,23 @@ class ESigName extends Group { getNameText() { return this.name; } - hide() { this.name.hide(); } show() { this.name.show(); } + setAnimationStart(color) { + this.name && this.name.animateStyle(true) + .when(0, { textFill: this.model.style.backgroundColor }) + .when(1000, { textFill: color }) + .when(2000, { textFill: this.model.style.backgroundColor }) + .when(3000, { textFill: color }) + .start(); + } + setAnimationEnd() { + this.name && this.name.stopAnimation(false); + } } export default ESigName; diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index 0de7279be..e2222933c 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -18,6 +18,7 @@ import Text from 'zrender/src/graphic/Text'; import Isogon from 'zrender/src/graphic/shape/Isogon'; import deviceType from '../../constant/deviceType'; import { findDeviceByModelDepType } from '../utils/ShapeDepFind'; +import store from '@/store/index'; // import BoundingRect from 'zrender/src/core/BoundingRect'; // import background from './../../../ibp/shape/background'; @@ -164,6 +165,22 @@ const SignalAspectMap = { 3: () => {} }; exec(lampsMap[lamps.length]); + }, + // 12 红闪 + 12: (lamps, style) => { + const lampsMap = { + 1: () => { + lamps[0].setColor(style.Signal.lamp.redColor); + lamps[0].setAnimationStart(style.Signal.lamp.redColor); + }, + 2: () => { + lamps[0].setColor(style.Signal.lamp.redColor); + lamps[0].setAnimationStart(style.Signal.lamp.redColor); + lamps[1].setColor(style.backgroundColor); + }, + 3: () =>{} + }; + exec(lampsMap[lamps.length]); } }; @@ -262,8 +279,8 @@ class Signal extends Group { z: this.z, _val: '3', style: { - x: endPoint.x, - y: endPoint.y, + x: endPoint.x + (style.Signal.tText.offsetX || 0), + y: endPoint.y + (style.Signal.tText.offsetY || 0), fontWeight: style.Signal.tText.fontWeight, fontSize: style.Signal.tText.fontSize, fontFamily: style.fontFamily, @@ -359,7 +376,7 @@ class Signal extends Group { fontWeight: style.Signal.text.fontWeight, fontSize: 12, fontFamily: style.fontFamily, - textFill: '#FFF', + textFill: style.Signal.remainTimeColor || '#FFF', textAlign: 'center', textVerticalAlign: 'middle' }); @@ -682,7 +699,7 @@ class Signal extends Group { if (this.style.Signal.text.nameBorderShow) { this.sigName.setStyle({ textBorderWidth: 1 }); } - if (this.sigBack) { + if (this.sigBack && (!this.model.signalButtonList || !this.model.signalButtonList.length)) { this.sigBack.show(); this.sigBack.setStyle('fill', this.style.Signal.sigBack.fillColor); } @@ -690,6 +707,12 @@ class Signal extends Group { this.lamps[0].setBorderColor(this.style.Signal.lamp.borderColor); this.lamps[0].setAnimationStart(this.style.Signal.lamp.blockColor); } + if (this.model.signalButtonList && this.model.signalButtonList.length) { + this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + button && button.instance && button.instance.blockShow(); + }); + } } reblock() { this.sigPost.setHorColor(this.style.Signal.post.reblockHorColor); @@ -835,6 +858,15 @@ class Signal extends Group { showRemainTime(number) { this.remainTImeName.show(); this.remainTImeName && this.remainTImeName.setStyle({ text: number }); + this.model.signalButtonList && this.model.signalButtonList.length && this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + if (button.type === 'PICK') { + button && button.instance && button.instance.startAnimate(); + } + }); + if (this.model.type === 'SHUNTING') { + this.sigName && this.sigName.setAnimationStart(this.style.Signal.text.defaultColor); + } } setAshShow() { this.lamps.forEach(item=> { item.setStyle({fill: '#7F7F7F', stroke: '#7F7F7F'}); }); @@ -844,6 +876,7 @@ class Signal extends Group { } // 恢复状态 recover() { + this.sigName && this.sigName.setAnimationEnd(); this.lamps && this.lamps.forEach(item=> { item.show(); item.setGuideSectorShowHide(false); }); this.sigName.setStyle({ textBorderWidth: 0 }); this.sigName.setColor(this.style.Signal.text.defaultColor); @@ -883,9 +916,16 @@ class Signal extends Group { this.ciConfirm && this.ciConfirm.stopAnimation(false); this.ciConfirm && this.ciConfirm.hide(); this.sigBack && this.sigBack.hide(); + this.tText && this.tText.hide(); this.sigBack && this.sigBack.stopAnimation(false); this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd(); this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor); + if (this.model.signalButtonList && this.model.signalButtonList.length) { + this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + button && button.instance && button.instance.recover(); + }); + } } setState(model) { @@ -913,10 +953,19 @@ class Signal extends Group { model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放 model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放 model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示 + if (model.remainTime) { + this.showRemainTime(model.remainTime); + } else { + this.model.signalButtonList && this.model.signalButtonList.length && this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + if (button.type === 'PICK') { + button && button.instance && button.instance.setState(button); + } + }); + } /** 信号机封锁 */ // 缺一个功能封锁 - model.blockade && this.block(); + model.blockade && this.block(); // 因大铁处理信号按钮状态 封锁处理需在延时解锁时间之后处理 model.reblockade && this.reblock(); - model.remainTime && this.showRemainTime(model.remainTime); if (!path.includes('/map/draw')) { // 联锁自动进路通过 model.fleetMode && this.setAutoRouteOpen(); @@ -980,9 +1029,15 @@ class Signal extends Group { // 灯是否点灯显示 this.lamps.forEach(lamp => { lamp.setStop(model.signalLight); }); } - + if (model.hasSelected) { + this.sigName && this.sigName.setAnimationStart(this.style.Signal.text.defaultColor); + } // 信号机故障 model.fault && this.fault(); + if (model.guideTime) { + this.tText && this.tText.setStyle('text', model.guideTime); + this.tText && this.tText.show(); + } // 设置灰显 if (model.noStatus || model.level === 0) { this.setAshShow(); diff --git a/src/jmapNew/shape/SignalButton/index.js b/src/jmapNew/shape/SignalButton/index.js index fd9756f45..e1d8d15e1 100644 --- a/src/jmapNew/shape/SignalButton/index.js +++ b/src/jmapNew/shape/SignalButton/index.js @@ -20,12 +20,7 @@ export default class SignalButton extends Group { create() { const model = this.model; - let fillColor = '#008000'; - if (model.type === 'GUIDE') { - fillColor = '#5050E1'; - } else if (model.type === 'FLEXIBLE' || model.type === 'SHUNT_TERMINAL') { - fillColor = '#808080'; - } + const fillColor = this.getTypeColor(); this.rectButton = new Rect({ zlevel: this.zlevel, z: this.z, @@ -75,7 +70,7 @@ export default class SignalButton extends Group { }); this.add(this.rightLine); this.rightLine.hide(); - if (model.name) { + if (model.type === 'PASS') { this.buttonText = new Text({ zlevel: this.zlevel, z: this.z, @@ -95,23 +90,42 @@ export default class SignalButton extends Group { } } startAnimate() { - let color = '#008000'; - if (this.model.type === 'TRAIN_TERMINAL') { - color = '#008000'; - } else if (this.model.type === 'FLEXIBLE' || this.model.type === 'SHUNT_TERMINAL') { - color = '#808080'; - } this.rectButton && this.rectButton.animateStyle(true) .when(0, { fill: '#000' }) - .when(1000, { fill: color }) + .when(1000, { fill: this.getTypeColor() }) .when(2000, { fill: '#000' }) .start(); } stopAnimation() { this.rectButton && this.rectButton.stopAnimation(true); } + getTypeColor() { + let color = ''; + if (this.model.type === 'FLEXIBLE' || this.model.type === 'SHUNT_TERMINAL') { + color = '#808080'; + } else if (this.model.type === 'GUIDE') { + color = '#5050E1'; + } else { + color = '#008000'; + } + return color; + } + recover() { + this.stopAnimation(); + this.rectButton && this.rectButton.setStyle({ fill:this.getTypeColor() }); + this.rightLine && this.rightLine.hide(); + this.leftLine && this.leftLine.hide(); + } + blockShow() { + this.rightLine && this.rightLine.show(); + this.leftLine && this.leftLine.show(); + } setState(model) { + this.recover(); if (!this.isShowShape) return; + if (model.hasSelected) { + this.startAnimate(); + } } // 设置显示模式 setShowMode() { diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index e1370ce0a..fdec3adfb 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -230,16 +230,16 @@ export default class Switch extends Group { offsetX = directx * this.style.Switch.rectLock.offset.x; offsetY = directy * this.style.Switch.rectLock.offset.y; } - let x = this.model.intersection.x - this.style.Switch.rectLock.rectWidth / 2 + offsetX; - let y = this.model.intersection.y - this.style.Switch.rectLock.rectWidth / 2 + offsetY; - if (this.style.Switch.rectLock.followName) { - const directx = this.triangle.drictx; - const rect = this.name.getBoundingRect(); - const wLen = this.style.Switch.rectLock.rectWidth - (directx > 0? rect.width: rect.width/2); - const hLen = this.style.Switch.rectLock.rectWidth - rect.height - x = rect.x - wLen/2; - y = rect.y - hLen/2 - } + let x = this.model.intersection.x - this.style.Switch.rectLock.rectWidth / 2 + offsetX; + let y = this.model.intersection.y - this.style.Switch.rectLock.rectWidth / 2 + offsetY; + if (this.style.Switch.rectLock.followName) { + const directx = this.triangle.drictx; + const rect = this.name.getBoundingRect(); + const wLen = this.style.Switch.rectLock.rectWidth - (directx > 0 ? rect.width : rect.width / 2); + const hLen = this.style.Switch.rectLock.rectWidth - rect.height; + x = rect.x - wLen / 2; + y = rect.y - hLen / 2; + } this.lockRect = new ELockRect({ // 单锁矩形框 zlevel: this.zlevel, @@ -326,7 +326,7 @@ export default class Switch extends Group { /** 恢复状态*/ recover() { this.lockRect && this.lockRect.hide(); // 矩形包围框 - this.lockCircle && this.lockCircle.hide(); // 圆形包围框 + this.lockCircle && this.lockCircle.hide(); // 圆形包围框 this.lockArc && this.lockArc.hide(); // 圆形单锁框 this.name.getNameText().stopAnimation(false); this.shapeModelC.hide(); // 形状 C @@ -703,6 +703,9 @@ export default class Switch extends Group { this.setInversionAction(model); /** 反位*/ } else { this.setLossAction(model.fault); // 失去 + if (model.switchSplit) { + this.setForkAction(); + } } model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示 diff --git a/src/jmapNew/shape/Train/TrainBody.js b/src/jmapNew/shape/Train/TrainBody.js index dd8be5b04..3d1444c7d 100644 --- a/src/jmapNew/shape/Train/TrainBody.js +++ b/src/jmapNew/shape/Train/TrainBody.js @@ -40,21 +40,11 @@ export default class TrainBody extends Group { create() { const model = this.model; const style = this.model.style; - this.nameFormat = model.nameFormat; const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) : model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号 - let serviceNumber = ''; // 服务号(表号) - if (this.model.type == 'PLAN') { // 计划车 - serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber); - } else if (this.model.type == 'HEAD') { // 头码车 - serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); - this.nameFormat = 'serviceNumber:groupNumber'; - } else if (this.model.type == 'MANUAL') { // 人工车 - serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceHeadNum); - this.nameFormat = 'serviceNumber:groupNumber'; - } + const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);// 服务号(表号) let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码 if (Vue.prototype.$jlmap.lineCode == '09') { // 暂时先写死 后面有了删掉就好 targetCode = '01'; diff --git a/src/jmapNew/theme/chengdu_01/model.js b/src/jmapNew/theme/chengdu_01/model.js index c7d80a99e..b7c5f905f 100644 --- a/src/jmapNew/theme/chengdu_01/model.js +++ b/src/jmapNew/theme/chengdu_01/model.js @@ -39,6 +39,9 @@ class Model { this['private'][deviceType.TrainWindow] = { trainWindowShow: true }; + this['private'][deviceType.SignalButton] = { + hasSelected: 0 + }; } initPublicProps(model) { diff --git a/src/jmapNew/theme/components/menus/dialog/setFault.vue b/src/jmapNew/theme/components/menus/dialog/setFault.vue index 868e92d7a..9e9aa69f8 100644 --- a/src/jmapNew/theme/components/menus/dialog/setFault.vue +++ b/src/jmapNew/theme/components/menus/dialog/setFault.vue @@ -110,7 +110,7 @@ export default { }, groupNumber: '', field: '', - selected: null, + selected: null, rules: { faultType: [ { required: true, message: '请选择故障类型', trigger: 'change'} @@ -172,8 +172,8 @@ export default { this.field = field == this.field ? '' : field; }, doShow(operate, selected, judge) { - this.$root.$emit('dialogOpen', selected); - this.selected = selected; + this.$root.$emit('dialogOpen', selected); + this.selected = selected; if (!this.dialogShow) { this.switchName = ''; this.stationName = ''; @@ -210,7 +210,7 @@ export default { this.dialogShow = false; this.form.faultType = ''; this.$refs.form.resetFields(); - this.$root.$emit('dialogClose', this.selected); + this.$root.$emit('dialogClose', this.selected); this.$store.dispatch('training/emitTipFresh'); }, commit() { diff --git a/src/jmapNew/theme/components/menus/dialog/setFaultNew.vue b/src/jmapNew/theme/components/menus/dialog/setFaultNew.vue new file mode 100644 index 000000000..86b662260 --- /dev/null +++ b/src/jmapNew/theme/components/menus/dialog/setFaultNew.vue @@ -0,0 +1,400 @@ + + + + + + {{ title }} + + + + + + + + + + + + + + 激活 + + + + + + + + 设备: + 故障类型: + + + + + + + + + + + + + + + + + + + + + 确定 + + + 取消 + + + + + + + + + + + + + diff --git a/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue b/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue index 5d5a948dc..2f41411df 100644 --- a/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue +++ b/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue @@ -102,7 +102,7 @@ export default { return this.dialogShow && !this.$store.state.menuOperation.break; }, domIdCancel() { - return this.dialogShow ? OperationEvent.Command.cancel.password.domId : '' + return this.dialogShow ? OperationEvent.Command.cancel.password.domId : ''; }, domIdConfirm() { return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : ''; diff --git a/src/jmapNew/theme/datie_01/menus/index.vue b/src/jmapNew/theme/datie_01/menus/index.vue index e83faddc5..f72e31776 100644 --- a/src/jmapNew/theme/datie_01/menus/index.vue +++ b/src/jmapNew/theme/datie_01/menus/index.vue @@ -1,7 +1,7 @@ - + diff --git a/src/jmapNew/theme/datie_01/menus/menuButton.vue b/src/jmapNew/theme/datie_01/menus/menuButton.vue index 71a930450..cf5ba2f87 100644 --- a/src/jmapNew/theme/datie_01/menus/menuButton.vue +++ b/src/jmapNew/theme/datie_01/menus/menuButton.vue @@ -1,109 +1,106 @@ - - - - 排列 - 进路 - - - - - 总 - 取消 - - - - - 引导 - 进路 - - - - + + - 引导 - 总锁 + X引导总锁 - + + + + 坡道解锁 + + + + + 总取消 + + + - 总 - 人解 + 总人解 - 区 - 故解 + 区故解 - + - 道岔 - 定操 + 总定位 - + - 道岔 - 反操 - - - - - 道岔 - 单锁 - - - - - 道岔 - 解锁 - - - - - 封 - 锁 - - - - - 解 - 封 - - - - - - 功 - 能 - - - 按 - 钮 - - - - - - 自 - 动控 - - - - - 人 - 工控 + 总反位 - 清 - 除 + 清除 - + + + 单锁 + + + + + 单解 + + + + + 按钮封锁 + + + + + 按钮解封 + + + + + 道岔封锁 + + + + + 道岔解封 + + + + + S引导总锁 + + + + + + 上电解锁 + + + + + + 辅助菜单 + + + + + + 分路不良 + + + + + + 标记窗 + + + @@ -112,12 +109,12 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import OperationHandler from '@/scripts/cmdPlugin/OperationHandler'; import Handler from '@/scripts/cmdPlugin/Handler'; -import { getAutoReentryBySignalCode } from '@/utils/mapList'; import PasswordBox from './dialog/childDialog/passwordInputBox.vue'; import CMD from '@/scripts/cmdPlugin/CommandEnum'; import { mapGetters } from 'vuex'; import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo'; -import { OperateMode } from '@/scripts/ConstDic'; +import { MouseEvent } from '@/scripts/ConstDic'; +// import { OperateMode } from '@/scripts/ConstDic'; export default { name: 'MapButtonMenu', @@ -125,22 +122,38 @@ export default { PasswordBox, NoticeInfo }, + props: { + selected: { + type: Object, + default: () => { + return null; + } + } + }, data() { return { point: { x: 0, - y: 15 + y: 0 }, operation: '0', buttonName: '', - buttonDownColor: '#A8A8A8', + guideColorDown: '#FEEE1A', + guideColorUp: '#DCDCDC', + buttonDownColor: '#FEEE1A', buttonUpColor: '#DCDCDC', - width: 58, + width: 78, tempData: null, offset: {}, commandTypeList: [], cmdTypeList: [], - deviceList: [] + deviceList: [], + timeNode: 0, // 按钮 15秒 计时 + deviceTimeNode: 0, // 信号按钮设备15秒 计时 + routeDataMap: null, // btnCodeList 为key + routeButtonCodeList: [], // btnCodeList 拼接code list + guideLockRightFlag: false, + guideLockLeftFlag: false }; }, computed: { @@ -188,10 +201,10 @@ export default { return CMD.Switch.CMD_SWITCH_NORMAL_POSITION; case this.Switch.reverse.button.operation: // 道岔反位 return CMD.Switch.CMD_SWITCH_REVERSE_POSITION; - case this.Signal.atsAutoControl.button.operation: // 自动控 - return CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING; - case this.Signal.humanControl.button.operation: // 人工控 - return CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING; + case this.Switch.block.button.operation: // 道岔封锁 + return CMD.Switch.CMD_SWITCH_BLOCK; + case this.Switch.unblock.button.operation: + return CMD.Switch.CMD_SWITCH_UNBLOCK; case this.Section.fault.button.operation: // 区故解 return CMD.Section.CMD_SECTION_FAULT_UNLOCK; case this.Signal.humanTrainRoute.button.operation: // 总人解 (取消引导进路) @@ -200,10 +213,6 @@ export default { return CMD.Signal.CMD_SIGNAL_SET_ROUTE; case this.Signal.guide.button.operation: // 办理引导 return CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE; - case this.Signal.reopenSignal.button.operation: - return CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL; - case this.Station.guideLock.button.operation: - return CMD.Station.CMD_STATION_SET_MASTER_GUIDE_LOCK; } return ''; } @@ -214,45 +223,61 @@ export default { }, '$store.state.menuOperation.selectedCount': function (val) { this.selectedChange(); + }, + '$store.state.map.clearButtonCount': function(val) { + this.commandTypeList = []; + this.$store.dispatch('menuOperation/setButtonOperation', null); + this.clearOperate(); + this.guideLockRightFlag = false; + this.guideLockLeftFlag = false; + }, + '$store.state.socket.simulationTimeSync': function (val) { + if (this.timeNode && val - this.timeNode >= 15) { + this.clearOperate(); + } + if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) { + if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') { + this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]); + } else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') { + this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'Signal', hasSelected: 0}]); + } + this.deviceList = []; + } } }, beforeDestroy() { - this.resetMbmButton(); + this.routeDataMap = null; + this.routeButtonCodeList = []; }, methods: { + // 输入密码正确回调 passWordCommit(data) { let operate = {}; - if (data.overNext) { + if (data.nextCmdType) { operate = { over: true, - code: data.code, operation: data.operation, - cmdType: this.cmdType, + cmdType: data.nextCmdType, param: data.param }; - - } else if (data.nextCmdType) { - operate = { - over: true, - operation: data.operation, - cmdType: data.nextCmdType - }; } else { operate = { + operationPre: data.operation, operation: data.operateNext }; } this.trainingOperation(operate); - - }, - checkCancel() { - Handler.clear(); // 清空操作组 - this.$store.dispatch('menuOperation/setButtonOperation', null); }, // 执行操作 trainingOperation(operate) { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { + /* 引导总锁输入面后 处理按钮选中状态 */ + if (operate.operationPre === this.Switch.guideLock.leftButton.operation || operate.operation === this.Switch.guideLock.leftButton.operation) { + this.guideLockLeftFlag = !this.guideLockLeftFlag; + } else if (operate.operationPre === this.Switch.guideLock.rightButton.operation || operate.operation === this.Switch.guideLock.rightButton.operation) { + this.guideLockRightFlag = !this.guideLockRightFlag; + } this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); } }).catch((error) => { @@ -280,22 +305,50 @@ export default { } } }, + // S引导总锁按钮点击 + guideLockLeftButtonDown() { + const operate = { + operation: this.Switch.guideLock.leftButton.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + // 引导总锁弹出 调用取消引导总锁指令 + if (this.guideLockRightFlag) { + operate.nextCmdType = CMD.Switch.CMD_SWITCH_MASTER_UNBLOCK; + operate.param = {right: false}; + } + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + operate['operateNext'] = this.Command.close.password.operation; + this.$refs.password.doShow(operate); + } + }); + }, + // X引导总锁按钮点击 + guideLockRightButtonDown() { + const operate = { + operation: this.Switch.guideLock.rightButton.operation + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + if (valid) { + // 引导总锁弹出 调用取消引导总锁指令 + if (this.guideLockRightFlag) { + operate.nextCmdType = CMD.Switch.CMD_SWITCH_MASTER_UNBLOCK; + operate.param = {right: true}; + } + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + operate['operateNext'] = this.Command.close.password.operation; + this.$refs.password.doShow(operate); + } + }); + }, buttonDown(operation, commandTypeList) { - // 清空当前的选择的设备 - this.deviceList = []; + this.clearOperate(); if (operation != this.Command.cancel.clearMbm.operation) { const operate = { operation: operation }; - // 以下 会弹出密码框 (总人解,区故解,道岔解封,解封按钮,总取消,引导总锁) - const operationList = [this.Signal.humanTrainRoute.button.operation, - this.Section.fault.button.operation, - this.Switch.unlock.button.operation, - this.MixinCommand.unblock.button.operation, - this.Station.guideLock.button.operation - // this.MixinCommand.totalCancel.button.operation - ]; - + // 以下 会弹出密码框 (总人解,区故解) 铅封按钮 + const operationList = [this.Signal.humanTrainRoute.button.operation, this.Section.fault.button.operation]; this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.operation = operation; @@ -307,10 +360,12 @@ export default { operate['operateNext'] = this.Command.close.password.operation; this.$refs.password.doShow(operate); } + this.timeNode = this.$store.state.socket.simulationTimeSync; this.$store.dispatch('training/emitTipFresh'); } }); } else { + // 清除按钮 const operate = { start: true, operation: operation @@ -319,318 +374,171 @@ export default { if (valid) { this.commandTypeList = []; this.$store.dispatch('menuOperation/setButtonOperation', null); - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - Handler.clear(); // 清空操作组 } }); } }, - resetMbmButton() { - this.commandTypeList = []; - this.$store.dispatch('menuOperation/setButtonOperation', null); - Handler.clear(); // 清空操作组 + // 解析进路数据 + handleRouteDataMap() { + this.routeDataMap = {}; + this.routeButtonCodeList = []; + this.routeList.forEach(item => { + const name = item.btnCodeList.join('-'); + this.routeDataMap[name] = item; + this.routeButtonCodeList.push(name); + }); + }, + // 校验已点击的信号按钮code 是否有符合条件的进路 + checkHaveRoute(deviceList) { + let name = ''; + deviceList.forEach((device, index) =>{ + name = name + (index ? '-' : '') + device.code; + }); + return this.routeButtonCodeList.some(item => item.includes(name)); }, // 排列进路 OR 信号重开操作 arrangementRouteOperation(deviceList) { const operate = { - operation: this.$store.state.menuOperation.buttonOperation + operation: this.Signal.arrangementRoute.button.operation }; - let isArrangementRoute = false; - if (deviceList.length === 1) { - const signal = deviceList[0]; - const sectionModel = this.$store.getters['map/getDeviceByCode'](signal.sectionCode); - if (sectionModel) { - // 判断 信号机所在区段的 左右关联区段 是否有锁闭 - const sectionLeft = this.$store.getters['map/getDeviceByCode'](sectionModel.leftSectionCode); - const sectionRight = this.$store.getters['map/getDeviceByCode'](sectionModel.rightSectionCode); - if (sectionLeft.routeLock || sectionRight.routeLock) { - isArrangementRoute = true; - } - } - // 如果该信号机红灯亮 而且 所属区段左右两侧区段锁闭 执行信号重启操作 - if (signal.redOpen && !signal.greenOpen && !signal.yellowOpen && isArrangementRoute) { // 信号重启 - operate.over = true; - operate.cmdType = CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL; - operate.code = deviceList[0].code; - operate.param = {signalCode: deviceList[0].code}; - this.deviceList = []; - this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch(() => { - this.$refs.noticeInfo.doShow(); - }); - } else { - operate.code = deviceList[0].code; // 进路排列 - this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch(() => { - this.$refs.noticeInfo.doShow(); - }); - } - } else if (deviceList.length === 2) { - let flag = false; - this.routeList.forEach(item => { - // item.endButtonSignalCode - // 起始信号机 和 结束信号机按钮 过滤进路 - if (item.startSignalCode === deviceList[0].code && item.endSignalCode === deviceList[1].code) { - operate.over = true; - operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE; - operate.code = deviceList[1].code; - operate.param = {routeCode: item.code}; - this.deviceList = []; - flag = true; - this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => { - }).catch(() => { - this.$refs.noticeInfo.doShow(); - }); - } - }); - if (!flag) { - this.deviceList = []; - this.$refs.noticeInfo.doShow('未找到选择的进路!'); - } - } - }, - // - handelFunctionButton(model, subType) { - const operate = { - over: true, - operation: this.$store.state.menuOperation.buttonOperation, - param: {} - }; - if (model._type === 'StationStand' && subType === 'StopJumpLamp') { - operate.cmdType = CMD.Stand.CMD_STAND_SET_JUMP_STOP; - operate.param = {standCode: model.code, trainGroupNumber: ''}; - operate.code = model.code; - } else if (model._type === 'StationStand' && subType === 'CancelStopJumpLamp') { - operate.cmdType = CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP; - operate.param = {standCode: model.code, trainGroupNumber: ''}; - operate.code = model.code; - } else if (model._type === 'AutoTurnBack' ) { - operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK; - operate.param = {cycleCode: model.cycleCode}; - operate.code = model.code; - } else if (model._type === 'AutomaticRoute') { - const route = this.routeData[model.automaticRouteCode]; - operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_CI_AUTO; - operate.param = {signalCode: route.startSignalCode}; - operate.code = model.code; - } else if (model._type === 'Station') { - switch (subType) { - case 'substation': - operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL; - operate.param = {stationCodes: [model.code]}; - operate.code = model.code; - break; - case 'center': - // operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL; - delete operate.over; - operate.subType = 'center'; - operate.param = {stationCodes: [model.code]}; - operate.code = model.code; - break; - case 'emergency': - // operate.cmdType = CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL; - delete operate.over; - operate.subType = 'emergency'; - operate.param = {stationCodes: [model.code]}; - operate.code = model.code; - break; - case 'interconnected': - // operate.cmdType = CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL; - delete operate.over; - operate.subType = 'interconnected'; - operate.param = {stationCodes: [model.code]}; - operate.code = model.code; - break; - } - } - this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => { - // 判断是否需要 弹窗密码框 - // const operate = Object.assign({}, operate); - if (subType == 'center ' || subType == 'emergency' || subType == 'interconnected' ) { - operate['operateNext'] = operate.operation = this.Command.close.password.operation; - if (subType == 'center') { - operate['nextCmdType'] = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL; - } else if (subType == 'emergency') { - operate['nextCmdType'] = CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL; - } else { - operate['nextCmdType'] = CMD.ControlConvertMenu.CMD_CM_INTERLOCK_CONTROL; - } - this.$refs.password.doShow(operate); - } - }).catch((error) => { - this.deviceList = []; - console.error(error); - this.$refs.noticeInfo.doShow(); + if (!this.routeDataMap) { this.handleRouteDataMap(); } - }); - }, - handelTotalCancel(model, subType) { - const operate = { - over: true, - code: model.code, - operation: this.$store.state.menuOperation.buttonOperation, - cmdType: '', - param: {} - }; - if (model._type === 'Signal') { - const autoReentry = getAutoReentryBySignalCode(model.code, this.routeList, this.autoReentryList); - let autoReentrySet = ''; - autoReentry.forEach(item => { - const autoReentryRel = this.autoReentryData[item.code]; - if (autoReentryRel.setUp) { - autoReentrySet = autoReentryRel; - } - }); - if (autoReentrySet) { - operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK; - operate.param = {cycleCode: autoReentrySet.code, cancelRoute: true}; - } else { - operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE; - operate.param = {signalCode: model.code}; - } - } else if (model._type === 'AutoTurnBack') { - operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK; - operate.param = {cycleCode: model.cycleCode, cancelRoute: false}; - operate.code = model.code; - } else if (model._type === 'AutomaticRoute') { - const route = this.routeData[model.automaticRouteCode]; - operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO; - operate.param = {signalCode: route.startSignalCode}; - operate.code = model.code; + if (!this.checkHaveRoute(deviceList)) { // 无效的进路按钮选择 清除deviceList + this.$message.error('无效的进路按钮'); + this.clearOperate(); + return; } - this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch((error) => { - this.deviceList = []; - console.error(error); - this.$refs.noticeInfo.doShow(); - }); - }, - handleGuideRoute(deviceList) { - if (deviceList.length === 1) { - let route = ''; - this.routeList.forEach(item => { - if (item.startSignalCode === deviceList[0].code && this.routeData[item.code].lock) { - route = item; - } - }); - - if (!route) { - const operate = { - code: deviceList[0].code, - operation: this.$store.state.menuOperation.buttonOperation - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - operate['operateNext'] = this.Command.close.password.operation; - this.$refs.password.doShow(operate); + this.deviceTimeNode = this.$store.state.socket.simulationTimeSync; + const signal = this.$store.getters['map/getDeviceByCode'](deviceList[0].signalCode || deviceList[0].code);// deviceList[0] 为 SignalButton || Signal + if (deviceList.length === 1 && !signal.routeLock) { // 排列进路 处理始端信号机状态 + operate.code = deviceList[0].code; + this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => { + if (valid) { + // 仅信号按钮调车信号机有状态 + if (deviceList[0]._type === 'SignalButton' || (deviceList[0]._type === 'Signal' && deviceList[0].type === 'SHUNTING')) { + this.$store.dispatch('training/updateMapState', [{code: deviceList[0].code, _type: deviceList[0]._type, hasSelected: 1}]); } - }).catch((error) => { - console.error(error); - this.$refs.noticeInfo.doShow(); - }); - } else { - const operate = { - code: deviceList[0].code, - operation: this.$store.state.menuOperation.buttonOperation, - overNext: true, - param: {routeCode: route.code, signalCode: deviceList[0].code} - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.deviceList = []; - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - operate['operateNext'] = this.Command.close.password.operation; - operate['operation'] = this.Command.close.password.operation; - this.$refs.password.doShow(operate); - } - }).catch((error) => { - console.error(error); - this.$refs.noticeInfo.doShow(); - }); - } - } else if (deviceList.length === 2) { - const operate = { - over: true, - code: deviceList[1].code, - cmdType: this.cmdType, - operation: this.$store.state.menuOperation.buttonOperation, - overNext: true - }; - let flag = false; - this.routeList.forEach(item => { - if (item.startSignalCode === deviceList[0].code && item.endSignalCode === deviceList[1].code) { - operate.param = {routeCode: item.code, signalCode: deviceList[0].code}; - this.deviceList = []; - flag = true; - this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch((error) => { - this.$refs.noticeInfo.doShow(); - console.error(error); - }); } - }); - if (!flag) { - this.deviceList = []; - this.$refs.noticeInfo.doShow('未找到选择进路!'); - } - } - }, - handleTotalHumanSolution(model) { - const operate = { - send: true, - overNext: true, - code: model.code, - operation: this.$store.state.menuOperation.buttonOperation - }; - - if (model.yellowOpen && model.redOpen) { - operate.cmdType = CMD.Signal.CMD_SIGNAL_CLOSE_GUIDE; - operate.param = {signalCode: model.code}; - this.deviceList = []; - this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}); - } else { - operate.cmdType = CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE; - operate.param = {signalCode: model.code}; - operate.val = model.code; - this.deviceList = []; - this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => { - console.error(error); + }).catch(() => { this.$refs.noticeInfo.doShow(); }); + } else if (deviceList.length === 1 && signal.routeLock) { // 信号重开 + operate.operation = this.Signal.reopenSignal.button.operation; + operate.over = true; + operate.cmdType = CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL; + operate.code = signal.code; + operate.param = {signalId: signal.code}; + this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => { + this.clearOperate(); + }).catch(() => this.$refs.noticeInfo.doShow() ); + } else if (deviceList.length > 1) { + let key = ''; + deviceList.forEach((item, index) => { + key = key + (index ? '-' : '') + item.code; + }); + const route = this.routeDataMap[key]; + if (route) { + operate.over = true; + operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE; + operate.code = deviceList[deviceList.length - 1].code; + operate.param = {routeId: route.code}; + this.deviceList = []; + this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => { + this.$store.dispatch('training/updateMapState', [{code: deviceList[0].code, _type: deviceList[0]._type, hasSelected: 0}]); + this.deviceTimeNode = 0; + }).catch(() => { + this.deviceTimeNode = 0; + this.$refs.noticeInfo.doShow(); + }); + } } }, - handelControlRoute(model) { // 自动控 人工控点击button 发送 - const routeCodeList = []; + // 总取消 + handelTotalCancel(model) { const operate = { over: true, code: model.code, operation: this.$store.state.menuOperation.buttonOperation, - cmdType: this.cmdType, - param: {} - }; - this.routeList.forEach(item => { - if (item.startSignalCode === model.code) { - routeCodeList.push(item.code); + cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE, + param: { + signalId: model._type === 'Signal' ? model.code : model.signalCode } - }); - operate.param = {signalCode: model.code, routeCodeList: routeCodeList}; - this.deviceList = []; - this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => { + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => { + this.clearOperate(); + }).catch((error) => { + this.clearOperate(); console.error(error); this.$refs.noticeInfo.doShow(); }); }, + // 引导信号 + handleGuideSignal(model) { + const operate = { + over: true, + code: model.code, + operation: this.Signal.guide.button.operation, + cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE, + param: {signalId: model.signalCode} + }; + const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode); + // 信号机引导时间15s以内再次点击引导不需要进行密码输入 + if (signal.guideTime) { + this.sendCommand(operate); + } else { + operate.nextCmdType = CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE; + this.$refs.password.doShow(operate); + } + }, + // 人解进路 + handleTotalHumanSolution(model) { + const operate = { + over: true, + code: model.code, + operation: this.$store.state.menuOperation.buttonOperation, + val: model.code, + cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE + }; + const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode || model.code); + if (model._type === 'SignalButton' && model.type === 'PICK' && signal.routeLock) { + operate.param = {signalId: model.signalCode}; + this.sendCommand(operate); + } else if (model._type === 'Signal' && model.type === 'SHUNTING' && signal.routeLock) { + operate.param = {signalId: model.code}; + this.sendCommand(operate); + } + }, handelSwitchOperate(model) { const operate = { over: true, code: model.code, operation: this.$store.state.menuOperation.buttonOperation, cmdType: this.cmdType, - param: { switchCode: model.code} + param: { id: model.code} }; + this.sendCommand(operate); + }, + // 发送指令 + sendCommand(operate) { this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => { console.error(error); this.$refs.noticeInfo.doShow(); - }); + }).finally(() =>{ this.clearOperate(); }); }, - handelBlockOrUnblock(model) { + // 校验是否有列车(接车)按钮 + checkHasTrainButton(model) { + if (model.signalButtonList && model.signalButtonList.length > 0) { + let flag = false; + model.signalButtonList.forEach(item => { + const signalButton = this.$store.getters['map/getDeviceByCode'](item); + flag = flag || signalButton.type === 'PICK'; + }); + return flag; + } else { + return false; + } + }, + handelSignalBlockOrUnblock(model) { const buttonOperation = this.$store.state.menuOperation.buttonOperation; const operate = { over: true, @@ -639,112 +547,103 @@ export default { cmdType: '', param: {} }; - if (model._type === 'Switch' && buttonOperation === this.MixinCommand.block.button.operation) { - operate.cmdType = CMD.Switch.CMD_SWITCH_BLOCK; - operate.param = {switchCode: model.code}; - } else if (model._type === 'Switch' && buttonOperation === this.MixinCommand.unblock.button.operation) { - operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK; - operate.param = {switchCode: model.code}; - } else if (model._type === 'Signal' && buttonOperation === this.MixinCommand.block.button.operation) { - operate.cmdType = CMD.Signal.CMD_SIGNAL_BLOCK; - operate.param = {signalCode: model.code}; - } else if (model._type === 'Signal' && buttonOperation === this.MixinCommand.unblock.button.operation) { - operate.cmdType = CMD.Signal.CMD_SIGNAL_UNBLOCK; - operate.param = {signalCode: model.code}; + if (model._type === 'Signal' && !this.checkHasTrainButton(model)) { + if (buttonOperation === this.Signal.lock.button.operation) { + operate.cmdType = CMD.Signal.CMD_SIGNAL_BLOCK; + operate.param = {signalId: model.code}; + } else if (buttonOperation === this.Signal.unlock.button.operation) { + operate.cmdType = CMD.Signal.CMD_SIGNAL_UNBLOCK; + operate.param = {signalId: model.code}; + } + } else if (model._type === 'SignalButton' && model.type === 'PICK') { + if (buttonOperation === this.Signal.lock.button.operation) { + operate.cmdType = CMD.Signal.CMD_SIGNAL_BLOCK; + operate.param = {signalId: model.signalCode}; + } else if (buttonOperation === this.Signal.unlock.button.operation) { + operate.cmdType = CMD.Signal.CMD_SIGNAL_UNBLOCK; + operate.param = {signalId: model.signalCode}; + } } - this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => { - console.error(error); - this.$refs.noticeInfo.doShow(); - }); + this.sendCommand(operate); }, - handelGuideLock(model) { - const operate = { - over: true, - code: model.code, - operation: this.$store.state.menuOperation.buttonOperation, - cmdType: '', - param: {stationCode: model.stationCode} - }; - if (model.totalGuideLock) { - operate.cmdType = CMD.Station.CMD_STATION_CANCEL_MASTER_GUIDE_LOCK; - } else { - operate.cmdType = CMD.Station.CMD_STATION_SET_MASTER_GUIDE_LOCK; + handleGuideLock(model) { + const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode); + if (signal && (this.guideLockRightFlag && signal.right) || (this.guideLockLeftFlag && !signal.right)) { + const operate = { + over: true, + code: model.code, + operation: this.guideLockRightFlag ? this.Switch.guideLock.rightButton : this.Switch.guideLock.leftButton, + nextCmdType: CMD.Switch.CMD_SWITCH_MASTER_LOCK, + param: {signalId: model.signalCode} + }; + this.$refs.password.doShow(operate); } - this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => { - this.resetMbmButton(); - }).catch((error) => { - console.error(error); - this.$refs.noticeInfo.doShow(); - }); }, handelFaultSection(model) { - const operate = { - over: true, - code: model.code, - operation: this.$store.state.menuOperation.buttonOperation, - cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK, - param: {sectionCode: model.code} - }; - this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => { - console.error(error); - this.$refs.noticeInfo.doShow(); - }); + if (model._type === 'Section') { + const operate = { + over: true, + code: model.code, + operation: this.$store.state.menuOperation.buttonOperation, + cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK, + param: {id: model.code} + }; + this.sendCommand(operate); + } }, selectedChange() { // 按钮按下时 - if (this.$store.state.training.prdType != '01') { - return ''; - } - - const buttonOperation = this.$store.state.menuOperation.buttonOperation; - const model = this.$store.state.menuOperation.selected; // 选择设备 - const subType = this.$store.state.menuOperation.subType; // 选择设备的子元素 - const switchOperation = [this.Switch.lock.button.operation, this.Switch.unlock.button.operation, this.Switch.locate.button.operation, this.Switch.reverse.button.operation]; - if (!model._type && !model._code) { + const model = this.selected; // 选择设备 + if (this.$store.state.training.prdType != '01' || this.selected._event !== MouseEvent.Left || (!model._type && !model._code)) { return; } - if (buttonOperation && buttonOperation === this.MixinCommand.functionButton.button.operation) { - this.handelFunctionButton(model, subType); - } else { - const station = this.$store.getters['map/getDeviceByCode'](model.stationCode); - if (station) { - if (station.controlMode == 'Local' || station.controlMode == 'Emergency') { - if (buttonOperation && this.commandTypeList.includes(model._type)) { - this.deviceList.push(model); - if (buttonOperation === this.Signal.arrangementRoute.button.operation) { - this.arrangementRouteOperation(this.deviceList); - } else if (buttonOperation === this.MixinCommand.totalCancel.button.operation) { - this.handelTotalCancel(model, subType); - } else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) { - this.handleTotalHumanSolution(model); - } else if (buttonOperation === this.Signal.guide.button.operation) { - this.handleGuideRoute(this.deviceList); - } else if (buttonOperation === this.Signal.atsAutoControl.button.operation || buttonOperation === this.Signal.humanControl.button.operation) { - this.handelControlRoute(model); - } else if (switchOperation.includes(buttonOperation)) { - this.handelSwitchOperate(model); - } else if (buttonOperation === this.MixinCommand.block.button.operation || buttonOperation === this.MixinCommand.unblock.button.operation) { - this.handelBlockOrUnblock(model); - } else if (buttonOperation === this.Station.guideLock.button.operation) { - this.handelGuideLock(model); - } else if (buttonOperation === this.Section.fault.button.operation) { - this.handelFaultSection(model); - } else { - this.clearOperate(); - } - } else { - this.clearOperate(); - } - } else { - this.clearOperate(); - this.operatemode != OperateMode.FAULT && this.$message.info('请先切换到站控或紧急站控'); - } + const buttonOperation = this.$store.state.menuOperation.buttonOperation; + const switchOperation = [ + this.Switch.lock.button.operation, + this.Switch.unlock.button.operation, + this.Switch.locate.button.operation, + this.Switch.reverse.button.operation, + this.Switch.block.button.operation, + this.Switch.unblock.button.operation + ]; + if ((this.guideLockLeftFlag || this.guideLockRightFlag) && model._type === 'SignalButton' && model.type === 'GUIDE') { + this.handleGuideLock(model); + } else if (buttonOperation && this.commandTypeList.includes(model._type)) { + if (buttonOperation === this.MixinCommand.totalCancel.button.operation) { + this.handelTotalCancel(model); + } else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) { + this.handleTotalHumanSolution(model); + } else if (switchOperation.includes(buttonOperation)) { + this.handelSwitchOperate(model); + } else if (buttonOperation === this.Signal.lock.button.operation || buttonOperation === this.Signal.unlock.button.operation) { + this.handelSignalBlockOrUnblock(model); + } else if (buttonOperation === this.Section.fault.button.operation) { + this.handelFaultSection(model); + } else { + this.clearOperate(); + } + } else if (!buttonOperation) { + if (model._type === 'SignalButton' && !this.checkSignalBlock(model.signalCode) && model.type === 'GUIDE' ) { + this.handleGuideSignal(model); + } else if (model._type === 'SignalButton' && !this.checkSignalBlock(model.signalCode) || (model._type === 'Signal' && !model.blockade)) { + this.deviceList.push(model); + this.arrangementRouteOperation(this.deviceList); + } else { + this.clearOperate(); } } + if (this.timeNode) { this.timeNode = 0; } }, - clearOperate() { + checkSignalBlock(code) { // 校验信号是否锁闭 + if (code) { + const signal = this.$store.getters['map/getDeviceByCode'](code); + return signal && signal.blockade; + } else { return false; } + }, + clearOperate() { // 清除操作 + this.deviceList && this.deviceList.length && this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0}]); + this.deviceList = []; Handler.clear(); // 清空操作组 - this.deviceList = []; this.$store.dispatch('menuOperation/setButtonOperation', null); } } @@ -752,10 +651,12 @@ export default {