diff --git a/src/jmapNew/theme/foshan_01/menus/dispatchWorkMenu.vue b/src/jmapNew/theme/foshan_01/menus/dispatchWorkMenu.vue index 7c77a9b09..e0cd941b1 100644 --- a/src/jmapNew/theme/foshan_01/menus/dispatchWorkMenu.vue +++ b/src/jmapNew/theme/foshan_01/menus/dispatchWorkMenu.vue @@ -3,6 +3,12 @@ + + + + + + diff --git a/src/jmapNew/theme/foshan_01/menus/menuStationStand.vue b/src/jmapNew/theme/foshan_01/menus/menuStationStand.vue index 74e5701df..e6b1ec989 100644 --- a/src/jmapNew/theme/foshan_01/menus/menuStationStand.vue +++ b/src/jmapNew/theme/foshan_01/menus/menuStationStand.vue @@ -123,7 +123,7 @@ export default { label: '设置跳停', handler: this.setJumpStop, cmdType:CMD.Stand.CMD_STAND_SET_JUMP_STOP, - isDisabled: (stand, work) => { stand.allSkip === 1; }, + isDisabled: (stand, work) => { stand.allSkip === 0; }, isShow: (stand, work) => work === 'dispatchWork' }, { @@ -131,7 +131,7 @@ export default { handler: this.cancelJumpStop, cmdType:CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP, // && stand.assignSkip !== 1 - isDisabled: (stand, work) => { (stand.allSkip !== 1); }, + isDisabled: (stand, work) => { return stand.allSkip !== 1 || stand.assignSkip !== 1; }, isShow: (stand, work) => work === 'dispatchWork' }, { diff --git a/src/jmapNew/theme/foshan_01/menus/menuSwitch.vue b/src/jmapNew/theme/foshan_01/menus/menuSwitch.vue index 443877097..8c557537e 100644 --- a/src/jmapNew/theme/foshan_01/menus/menuSwitch.vue +++ b/src/jmapNew/theme/foshan_01/menus/menuSwitch.vue @@ -25,7 +25,6 @@ import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuO import CMD from '@/scripts/cmdPlugin/CommandEnum'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; -// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; export default { name: 'SwitchMenu', @@ -45,77 +44,101 @@ export default { default() { return null; } + }, + work: { + type: String, + default() { + return ''; + } } }, data() { return { menu: [], - menuNormal: { - Local: [ - // { - // label: '道岔强扳定位', - // handler: this.locate, - // cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION - // }, - // { - // label: '道岔强扳反位', - // handler: this.reverse, - // cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION - // }, - { - label: '区段激活', - handler: this.active, - cmdType: CMD.Switch.CMD_SWITCH_ACTIVE - }, - { - label: '区段切除', - handler: this.split, - cmdType: CMD.Switch.CMD_SWITCH_CUT_OFF - }, - { - label: '设置临时限速', - handler: this.setSpeed, - cmdType: CMD.Switch.CMD_SWITCH_SET_LIMIT_SPEED - }, - { - label: '全线取消限速', - handler: this.cancelSpeed, - cmdType:CMD.LimitControl.CMD_CANCEL_ALL_LIMIT_SPEED - } - ], - Center: [ - { - label: '道岔总定', - handler: this.locate, - cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION - }, - { - label: '道岔总反', - handler: this.reverse, - cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION - }, - { - label: '道岔单锁', - handler: this.lock, - cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK - }, - { - label: '道岔单解', - handler: this.unlock, - cmdType:CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK - }, - { - label: '道岔封闭', - handler: this.block, - cmdType:CMD.Switch.CMD_SWITCH_BLOCK - }, - { - label: '道岔解封', - handler: this.unblock, - cmdType:CMD.Switch.CMD_SWITCH_UNBLOCK - } - ] - }, + menuNormal: [ + + { + label: '道岔总定', + handler: this.locate, + cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION, + isDisabled: switchDevice => switchDevice.pos === 'N', + isShow: (switchDevice, work) => work === 'dispatchWork' + }, + { + label: '道岔总反', + handler: this.reverse, + cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION, + isDisabled: switchDevice => switchDevice.pos === 'R', + isShow: (switchDevice, work) => work === 'dispatchWork' + }, + { + label: '道岔单锁', + handler: this.lock, + cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK, + isDisabled: switchDevice => switchDevice.singleLock === 1, + isShow: (switchDevice, work) => work === 'dispatchWork' + }, + { + label: '道岔单解', + handler: this.unlock, + cmdType:CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK, + isDisabled: switchDevice => switchDevice.singleLock !== 1, + isShow: (switchDevice, work) => work === 'dispatchWork' + }, + { + label: '道岔封闭', + handler: this.block, + cmdType:CMD.Switch.CMD_SWITCH_BLOCK, + isDisabled: switchDevice => switchDevice.blockade === 1, + isShow: (switchDevice, work) => work === 'dispatchWork' + }, + { + label: '道岔解封', + handler: this.unblock, + cmdType:CMD.Switch.CMD_SWITCH_UNBLOCK, + isDisabled: switchDevice => switchDevice.blockade !== 1, + isShow: (switchDevice, work) => work === 'dispatchWork' + }, + + { + label: '道岔强扳定位', + handler: this.locate, + cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION, + isDisabled: switchDevice => switchDevice.pos === 'N', + isShow: (switchDevice, work) => work === 'localWork' + }, + { + label: '道岔强扳反位', + handler: this.reverse, + cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION, + isDisabled: switchDevice => switchDevice.pos === 'R', + isShow: (switchDevice, work) => work === 'localWork' + }, + { + label: '区段激活', + handler: this.active, + cmdType: CMD.Switch.CMD_SWITCH_ACTIVE, + isShow: (switchDevice, work) => work === 'localWork' + }, + { + label: '区段切除', + handler: this.split, + cmdType: CMD.Switch.CMD_SWITCH_CUT_OFF, + isShow: (switchDevice, work) => work === 'localWork' + }, + { + label: '设置临时限速', + handler: this.setSpeed, + cmdType: CMD.Switch.CMD_SWITCH_SET_LIMIT_SPEED, + isShow: (switchDevice, work) => work === 'localWork' + }, + { + label: '全线取消限速', + handler: this.cancelSpeed, + cmdType:CMD.LimitControl.CMD_CANCEL_ALL_LIMIT_SPEED, + isShow: (switchDevice, work) => work === 'localWork' + } + ], menuForce: [ { label: '设置故障', @@ -167,7 +190,16 @@ export default { }, initMenu() { // 编辑模式菜单列表 - // this.menu = MenuContextHandler.covert(this.menuNormal); + this.menu = []; + this.menuNormal.forEach(menuItem => { + menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected, this.work) : false; + menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true; + this.menu.push(menuItem); + }); + if (this.operatemode === OperateMode.ADMIN) { + this.menu = [...this.menu, ...this.menuForce]; + } + // 故障模式菜单列表 if (this.operatemode === OperateMode.FAULT) { // if (!this.$store.state.scriptRecord.bgSet) {