diff --git a/src/jmapNew/theme/beijing_01/menus/dialog/routeControl.vue b/src/jmapNew/theme/beijing_01/menus/dialog/routeControl.vue index 5c4c5001a..4a63296a5 100644 --- a/src/jmapNew/theme/beijing_01/menus/dialog/routeControl.vue +++ b/src/jmapNew/theme/beijing_01/menus/dialog/routeControl.vue @@ -55,8 +55,8 @@ export default { selected: null, operation: null, stationName: '', - signalName: '' - + signalName: '', + operateName:'' }; }, computed: { @@ -70,7 +70,8 @@ export default { return this.dialogShow ? getDomIdByOperation(this.operation) : ''; }, title() { - if (this.operation == OperationEvent.Signal.cancelTrainRoute.menu.operation) { + // if (this.operation == OperationEvent.Signal.cancelTrainRoute.menu.operation) { + if (this.operateName == CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE.value) { return '取消列车进路'; } else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) { return '信号关灯'; @@ -100,6 +101,7 @@ export default { } } this.operation = operate.operation; + this.operateName = operate.operateName; } this.dialogShow = true; this.$nextTick(function () { @@ -113,7 +115,8 @@ export default { mouseCancelState(this.selected); }, commit() { - if (this.operation == OperationEvent.Signal.cancelTrainRoute.menu.operation) { + // if (this.operation == OperationEvent.Signal.cancelTrainRoute.menu.operation) { + if (this.operateName == CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE.value) { /** 取消列车进路*/ this.cancelTrainRoute(); } else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) { @@ -138,10 +141,10 @@ export default { cancelTrainRouteFunc() { const operate = { over: true, - operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, + operation:this.operation, + // operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE }; - this.loading = true; this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.loading = false; diff --git a/src/jmapNew/theme/beijing_01/menus/dialog/routeSelection.vue b/src/jmapNew/theme/beijing_01/menus/dialog/routeSelection.vue index 984460c94..2ac879382 100644 --- a/src/jmapNew/theme/beijing_01/menus/dialog/routeSelection.vue +++ b/src/jmapNew/theme/beijing_01/menus/dialog/routeSelection.vue @@ -230,7 +230,8 @@ export default { if (this.row && this.row.canSetting) { const operate = { over: true, - operation: OperationEvent.Signal.arrangementRoute.menu.operation, + // operation: OperationEvent.Signal.arrangementRoute.menu.operation, + operate:this.operation, cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE, param: { routeCode: this.row.code diff --git a/src/jmapNew/theme/beijing_01/menus/menuSignal.vue b/src/jmapNew/theme/beijing_01/menus/menuSignal.vue index 85919ca51..317056d4a 100644 --- a/src/jmapNew/theme/beijing_01/menus/menuSignal.vue +++ b/src/jmapNew/theme/beijing_01/menus/menuSignal.vue @@ -253,49 +253,64 @@ export default { }, // 设置进路 arrangementRoute() { - const operate = { - start: true, - // send: true, - code: this.selected.code, - // type: MapDeviceType.Signal.type, - // label: MapDeviceType.Signal.label, - operation: OperationEvent.Signal.arrangementRoute.menu.operation, - param: { - signalCode: `${this.selected.code}` - } - }; + const command = MenuContextHandler.getCommandByCmdType(CMD.Signal.CMD_SIGNAL_SET_ROUTE); + if (command) { + const operate = { + start: true, + // send: true, + code: this.selected.code, + // type: MapDeviceType.Signal.type, + // label: MapDeviceType.Signal.label, + operation:command.id, + // operation: OperationEvent.Signal.arrangementRoute.menu.operation, + param: { + signalCode: `${this.selected.code}` + } + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + if (valid) { + const routes = []; + this.routeList.forEach(elem => { + if (elem.startSignalCode === this.selected.code) { + routes.push(elem); + } + }); + this.$refs.routeSelection.doShow(operate, this.selected, routes); + } + }).catch(() => { + this.$refs.noticeInfo.doShow(operate); + }); - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - if (valid) { - const routes = []; - this.routeList.forEach(elem => { - if (elem.startSignalCode === this.selected.code) { - routes.push(elem); - } - }); - this.$refs.routeSelection.doShow(operate.operation, this.selected, routes); - } - }).catch(() => { - this.$refs.noticeInfo.doShow(operate); - }); + } else { + this.$refs.noticeInfo.doShow({}, '该指令不存在'); + console.error('该指令不存在,可能是指令字典里面没有该指令,可能是指令每句里面没有该指令'); + } }, // 取消进路 cancelTrainRoute() { - const operate = { - start: true, - code: this.selected.code, - operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, - param: { - signalCode: `${this.selected.code}` - } - }; - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); - if (valid) { - this.$refs.routeControl.doShow(operate, this.selected); - } - }); + const command = MenuContextHandler.getCommandByCmdType(CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE); + if (command) { + const operate = { + start: true, + code: this.selected.code, + operation:command.id, + operateName:command.operate, + // operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, + param: { + signalCode: `${this.selected.code}` + } + }; + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + if (valid) { + this.$refs.routeControl.doShow(operate, this.selected); + } + }); + } else { + this.$refs.noticeInfo.doShow({}, '该指令不存在'); + console.error('该指令不存在,可能是指令字典里面没有该指令,可能是指令每句里面没有该指令'); + } }, // // 信号封锁 // lock() { diff --git a/src/scripts/cmdPlugin/MenuContextHandler.js b/src/scripts/cmdPlugin/MenuContextHandler.js index 246363225..69c6dc284 100644 --- a/src/scripts/cmdPlugin/MenuContextHandler.js +++ b/src/scripts/cmdPlugin/MenuContextHandler.js @@ -121,6 +121,10 @@ class MenuContextHandler { return menu; } + getCommandByCmdType(cmdType) { + return CommandHandler.getDefinition(cmdType); + } + menuBarConvert(menu, mode) { if (menu) { if (mode === OperateMode.NORMAL) {