代码调整

This commit is contained in:
dong 2022-12-12 11:04:13 +08:00
parent 835ff2219f
commit e0bee230d9
4 changed files with 38 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuO
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { DeviceMenu, OperateMode, TrainingMode } from '@/scripts/ConstDic';
// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { judgeStationControl } from '@/jmapNew/theme/components/utils/menuJudge.js';
export default {
name: 'MenuLimit',
@ -41,12 +42,18 @@ export default {
{
label: '设置自动折返',
handler: this.handlerTurnBack,
cmdType: CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK
cmdType: CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK,
isDisabled: (selected, work) => {
return selected.setUp === 1;
}
},
{
label: '取消自动折返',
handler: this.cancelTurnBack,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK,
isDisabled: (selected, work) => {
return selected.setUp === 0;
}
}
]
};
@ -75,6 +82,11 @@ export default {
// this.menu = MenuContextHandler.covert(this.menuNormal);
this.menu = [];
this.menuNormal.forEach(menuItem => {
let status = judgeStationControl(this.selected.belongStationCode, this.selected.stationCode, this.work);
if (menuItem.roleDisabled) {
status = true;
}
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected, this.work) || !status : false;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true;
this.menu.push(menuItem);
});

View File

@ -89,11 +89,17 @@ export default {
{
label: '设置自动通过进路',
handler: this.singalPassModel,
isDisabled: (signal, work) => {
return signal.fleetMode === 1;
},
cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO
},
{
label: '取消自动通过进路',
handler: this.singalCancelPassModel,
isDisabled: (signal, work) => {
return signal.fleetMode !== 1;
},
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO
},
{
@ -109,12 +115,18 @@ export default {
label: '封锁',
handler: this.lock,
cmdType: CMD.Signal.CMD_SIGNAL_BLOCK,
isDisabled: (signal, work) => {
return signal.blockade !== 0;
},
isShow: (selected, work) => work == 'localWork'
},
{
label: '解封',
handler: this.unlock,
cmdType: CMD.Signal.CMD_SIGNAL_UNBLOCK,
isDisabled: (signal, work) => {
return signal.blockade !== 1;
},
isShow: (selected, work) => work == 'localWork'
},
{

View File

@ -43,7 +43,6 @@ export default {
handler: this.setEmergencyControl,
cmdType: CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL,
isDisabled: (selected, work) => {
console.log('🚀 ~ file: menuStationControl.vue:50 ~ data ~ selected', selected.controlMode);
return selected.controlMode == 'Emergency';
}
},

View File

@ -82,24 +82,36 @@ export default {
label: '道岔单锁',
handler: this.lock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK,
isDisabled: (station, work) => {
return station.singleLock === 1;
},
isShow: (selected, work) => work == 'localWork'
},
{
label: '道岔单解',
handler: this.unlock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK,
isDisabled: (station, work) => {
return station.singleLock !== 1;
},
isShow: (selected, work) => work == 'localWork'
},
{
label: '道岔封锁',
handler: this.block,
cmdType: CMD.Switch.CMD_SWITCH_BLOCK,
isDisabled: (station, work) => {
return station.blockade === 1;
},
isShow: (selected, work) => work == 'localWork'
},
{
label: '道岔解封',
handler: this.unblock,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK,
isDisabled: (station, work) => {
return station.blockade !== 1;
},
isShow: (selected, work) => work == 'localWork'
},
{