From 611e3902e5a062fe601c6da9485a65686d60fda7 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 12 Dec 2022 17:56:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/chengdu_01/menus/menuStation.vue | 237 +++++++++++++++++- 1 file changed, 233 insertions(+), 4 deletions(-) diff --git a/src/jmapNew/theme/chengdu_01/menus/menuStation.vue b/src/jmapNew/theme/chengdu_01/menus/menuStation.vue index acc418989..1b63d6e2c 100644 --- a/src/jmapNew/theme/chengdu_01/menus/menuStation.vue +++ b/src/jmapNew/theme/chengdu_01/menus/menuStation.vue @@ -15,7 +15,7 @@ import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import CMD from '@/scripts/cmdPlugin/CommandEnum'; -import { judgeStationControl } from '@/jmapNew/theme/components/utils/menuJudge.js'; +import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; export default { name: 'StationMenu', @@ -45,6 +45,73 @@ export default { return { menu: [], menuNormal: [ + { + label: '本地控制许可', + children: [ + { + label: '请求', + handler: this.setStationControl, + cmdType: this.work === 'localWork' ? CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL : CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL, + isDisabled: (station, work) => { + if (work === 'localWork') { + return station.controlMode !== 'Center'; + } else { + return station.controlMode === 'Center'; + } + } + }, + { + label: '取消', + handler: this.setCenterControl, + cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL, + isDisabled: (station, work) => { + if (work === 'localWork') { + return station.controlMode === 'Center'; + } else { + return station.controlMode !== 'Center'; + } + }, + isShow: (station, work) => { + return work === 'localWork'; + } + }, + { + label: '紧急本地控制', + handler: this.setEmergencyControl, + cmdType: CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL, + isDisabled: (station, work) => { + return station.controlMode === 'Emergency'; + }, + isShow: (station, work) => { + return work === 'localWork'; + } + } + ] + }, + { + label: '进路模式', + children: [ + { + label: '自动', + handler: this.atsAutoControlALL, + cmdType: CMD.Station.CMD_STATION_OPEN_AUTO_SETTING, + isDisabled: (station, work) => { + return false; + } + }, + { + label: '人工', + handler: this.humanControlALL, + cmdType: CMD.Station.CMD_STATION_CLOSE_AUTO_SETTING, + isDisabled: (station, work) => { + return false; + } + } + ], + isShow: (station, work) => { + return work === 'dispatchWork'; + } + } ], menuForce: [ { @@ -94,12 +161,21 @@ export default { }; }, initMenu() { + const selected = this.selected; + const work = this.work; + function setDisabledShow(item) { + if (item.children) { + item.children.forEach(ii => { + setDisabledShow(ii); + }); + } + item.disabled = item.isDisabled ? item.isDisabled(selected, work) : false; + item.show = item.isShow ? item.isShow(selected, work) : true; + } if (this.selected.centralized) { this.menu = []; this.menuNormal.forEach(menuItem => { - const status = judgeStationControl(this.selected.belongStationCode, this.selected.stationCode, this.work); - menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected, this.work) || !status : false; - menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work, this.lineCode) : true; + setDisabledShow(menuItem); this.menu.push(menuItem); }); // 故障模式菜单列表 @@ -149,6 +225,159 @@ export default { } }); }, + // 所有进路自排关 + humanControlALL() { + const step = { + start: true, + code: `${this.selected.code}`, + operation: OperationEvent.Station.humanControlALL.menu.operation, + param: { + stationCode: this.selected.code + } + }; + this.$store.dispatch('trainingNew/next', step).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$store.dispatch('menuOperation/pushRequestList', { + device: this.selected, + operation: { + code: OperationEvent.Command.commandXian.confirm.operation, + name: '所有进路自排关', + cmdType: CMD.Station.CMD_STATION_CLOSE_AUTO_SETTING, + param: step.param + } + }); + } else { + this.$refs.noticeInfo.doShow(); + } + }).catch(() => { + this.$refs.noticeInfo.doShow(); + }); + }, + // 所有进路自排开 + atsAutoControlALL() { + const step = { + start: true, + code: `${this.selected.code}`, + operation: OperationEvent.Station.atsAutoControlALL.menu.operation, + param: { + stationCode: this.selected.code + } + }; + this.$store.dispatch('trainingNew/next', step).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$store.dispatch('menuOperation/pushRequestList', { + device: this.selected, + operation: { + code: OperationEvent.Command.commandXian.confirm.operation, + name: '所有进路自排开', + cmdType: CMD.Station.CMD_STATION_OPEN_AUTO_SETTING, + param: step.param + } + }); + } else { + this.$refs.noticeInfo.doShow(); + } + }).catch(() => { + this.$refs.noticeInfo.doShow(); + }); + }, + setPriorityStrategy() { + this.getStrategyByStation('侧线优先'); + }, + setLineStrategy() { + this.getStrategyByStation('直线折返'); + }, + setLateralStrategy() { + this.getStrategyByStation('侧线折返'); + }, + getStrategyByStation(type) { + const tbStrategy = this.tbStrategyList.find(strategy=>{ + return strategy.stationCode == this.selected.code; + }); + if (tbStrategy) { + const strategy = tbStrategy.optionList.find(each=>{ + return each.label == type; + }); + if (strategy) { + commitOperate(menuOperate.StationControl.setBackStrategy, {stationCode: this.selected.code, id:strategy.id}, 0).then(({valid, operate})=>{ + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$store.dispatch('menuOperation/pushRequestList', { + device: this.selected, + operation: { + code: OperationEvent.Command.commandXian.confirm.operation, + name: type, + cmdType: CMD.Station.CMD_STATION_SET_TURN_BACK_STRATEGY, + param: {stationCodes:[this.selected.code]} + } + }); + }).catch((error) => { + console.error(error); + this.$refs.noticeInfo.doShow(); + }); + } + } + }, + setStationControl() { + // 请求站控 + commitOperate(menuOperate.StationControl.requestStationControl, {stationCode:this.selected.code}, 0).then(({valid, operate})=>{ + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$store.dispatch('menuOperation/pushRequestList', { + device: this.selected, + operation: { + code: OperationEvent.Command.commandXian.confirm.operation, + name: '请求站控', + cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL, + param: {stationCodes:[this.selected.code]} + } + }); + } + }); + }, + setCenterControl() { + // 请求中控 + commitOperate(menuOperate.StationControl.requestCentralControl, {stationCode:this.selected.code}, 0).then(({valid, operate})=>{ + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$store.dispatch('menuOperation/pushRequestList', { + device: this.selected, + operation: { + code: OperationEvent.Command.commandXian.confirm.operation, + name: '请求中控', + cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL, + param: {stationCodes:[this.selected.code]} + } + }); + } + }); + }, + setEmergencyControl() { + // 紧急站控 + commitOperate(menuOperate.StationControl.emergencyStationControl, {stationCode:this.selected.code}, 0).then(({valid, operate})=>{ + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$store.dispatch('menuOperation/pushRequestList', { + device: this.selected, + operation: { + code: OperationEvent.Command.commandXian.confirm.operation, + name: '紧急站控', + cmdType: CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL, + param: {stationCodes:[this.selected.code]} + } + }); + } + }); + }, + undeveloped() { + this.doClose(); + this.$alert('实现中......', '提示', { + confirmButtonText: '确定', + callback: action => { + } + }); + }, triggerFaultManagement() { this.$store.dispatch('training/setTriggerFaultCount', this.selected); }