代码调整

This commit is contained in:
fan 2022-10-21 09:52:27 +08:00
parent 812ef04cbd
commit 1b90935de6
7 changed files with 131 additions and 154 deletions

View File

@ -6,7 +6,7 @@
<menu-switch ref="menuSwitch" :selected="selected" :work="'localWork'" />
<menu-signal ref="menuSignal" :selected="selected" :work="'localWork'" />
<menu-section ref="menuSection" :selected="selected" :work="'localWork'" />
<menu-train ref="menuTrain" :selected="selected" />
<menu-train ref="menuTrain" :selected="selected" :work="'localWork'" />
<menu-station ref="menuStation" :selected="selected" :work="'localWork'" />
<passive-alarm ref="passiveAlarm" />
<passive-contorl ref="passiveControl" pop-class="fuzhou-01__systerm" />

View File

@ -174,7 +174,7 @@ export default {
this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : false;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.word) : true;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true;
this.menu.push(menuItem);
});
//

View File

@ -262,7 +262,7 @@ export default {
this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : false;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.word) : true;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true;
this.menu.push(menuItem);
});
//

View File

@ -19,7 +19,6 @@ import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
@ -157,8 +156,11 @@ export default {
methods: {
initMenu() {
this.menu = [];
//
this.menu = MenuContextHandler.covert(this.menuNormal);
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : false;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true;
this.menu.push(menuItem);
});
//
if (this.operatemode === OperateMode.FAULT) {

View File

@ -27,7 +27,6 @@ import Psl from '@/jmapNew/theme/components/menus/dialog/psl';
import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
@ -50,97 +49,94 @@ export default {
default() {
return null;
}
},
work: {
type: String,
default() {
return '';
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: this.$t('menu.menuStationStand.setDetainTrain'),
handler: this.setDetainTrain,
cmdType:CMD.Stand.CMD_STAND_SET_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
handler: this.cancelDetainTrainForce,
cmdType:CMD.Stand.CMD_STAND_FORCE_CANCEL_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
cmdType:CMD.Stand.CMD_STAND_SET_JUMP_STOP
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
cmdType:CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
cmdType:CMD.Stand.CMD_STAND_VIEW_STATUS
}
],
Center: [
{
label: this.$t('menu.menuStationStand.setDetainTrain'),
handler: this.setDetainTrain,
cmdType:CMD.Stand.CMD_STAND_SET_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainAll'),
handler: this.cancelDetainTrainAll,
cmdType:CMD.Stand.CMD_STAND_WHOLE_LINE_CANCEL_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
cmdType:CMD.Stand.CMD_STAND_SET_JUMP_STOP
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
cmdType:CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP
},
{
label: this.$t('menu.menuStationStand.setStopTime'),
handler: this.setStopTime,
cmdType:CMD.Stand.CMD_STAND_SET_PARK_TIME
},
{
label: this.$t('menu.menuStationStand.setRunLevel'),
handler: this.setRunLevel,
cmdType:CMD.Stand.CMD_STAND_SET_RUN_TIME
},
{
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
handler: this.earlyDeparture,
cmdType:CMD.Stand.CMD_STAND_EARLY_DEPART
},
{
label: this.$t('menu.menuStationStand.setBackStrategy'),
handler: this.setBackStrategy,
cmdType:CMD.Stand.CMD_STAND_SET_REENTRY_STRATEGY
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
cmdType:CMD.Stand.CMD_STAND_VIEW_STATUS
}
]
},
menuNormal: [
{
label: this.$t('menu.menuStationStand.setDetainTrain'),
handler: this.setDetainTrain,
cmdType:CMD.Stand.CMD_STAND_SET_HOLD_TRAIN,
isDisabled: stand => stand.centerHoldTrain === 1,
isShow: (station, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN,
isDisabled: stand => stand.centerHoldTrain !== 1,
isShow: (station, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuStationStand.setDetainTrain'),
handler: this.setDetainTrain,
cmdType:CMD.Stand.CMD_STAND_SET_HOLD_TRAIN,
isDisabled: stand => stand.stationHoldTrain === 1,
isShow: (station, work) => work === 'localWork'
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN,
isDisabled: stand => stand.stationHoldTrain !== 1,
isShow: (station, work) => work === 'localWork'
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
handler: this.cancelDetainTrainForce,
cmdType:CMD.Stand.CMD_STAND_FORCE_CANCEL_HOLD_TRAIN
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
cmdType:CMD.Stand.CMD_STAND_SET_JUMP_STOP,
isDisabled: stand => stand.allSkip === 1
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
cmdType:CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP,
isDisabled: stand => stand.allSkip !== 1 && stand.assignSkip !== 1
},
{
label: this.$t('menu.menuStationStand.setStopTime'),
handler: this.setStopTime,
cmdType:CMD.Stand.CMD_STAND_SET_PARK_TIME,
isShow: (station, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuStationStand.setRunLevel'),
handler: this.setRunLevel,
cmdType:CMD.Stand.CMD_STAND_SET_RUN_TIME,
isShow: (station, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
handler: this.earlyDeparture,
cmdType:CMD.Stand.CMD_STAND_EARLY_DEPART,
isDisabled: stand => stand.trainParking !== 1,
isShow: (station, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuStationStand.setBackStrategy'),
handler: this.setBackStrategy,
cmdType:CMD.Stand.CMD_STAND_SET_REENTRY_STRATEGY,
isShow: (station, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
cmdType:CMD.Stand.CMD_STAND_VIEW_STATUS
}
],
menuForce: [
{
label: this.$t('menu.menuStationStand.setFault'),
@ -191,8 +187,12 @@ export default {
methods: {
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
// this.menu = MenuContextHandler.menuFiltration(this.menuNormal);
this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : 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];
}
@ -202,7 +202,7 @@ export default {
this.menu = this.menuForce;
}
// PSL
if (this.operatemode !== OperateMode.FAULT && this.$store.state.training.prdType === '01') {
if (this.operatemode !== OperateMode.FAULT && this.work === 'localWork') {
this.menu = [
...this.menu,
{
@ -211,8 +211,6 @@ export default {
}
];
}
// this.menu = MenuContextHandler.covert(this.menu);
},
doShow(point) {
this.initMenu();

View File

@ -155,7 +155,7 @@ export default {
this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : false;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.word) : true;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true;
this.menu.push(menuItem);
});
if (this.operatemode === OperateMode.ADMIN) {

View File

@ -26,7 +26,6 @@ import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import SpeedLimit from '@/jmapNew/theme/components/menus/dialog/trainSpeedLimit';
import { menuOperate, commitOperate, commitTrainSend } from '@/jmapNew/theme/components/utils/menuOperate';
import TrainOperation from './menuDialog/trainOperation';
@ -53,46 +52,37 @@ export default {
default() {
return null;
}
},
work: {
type: String,
default() {
return '';
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [],
Center: [
{
label: this.$t('menu.menuTrain.addTrainId'),
handler: this.addTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_ADD_TRAIN_TRACE
},
{
label: this.$t('menu.menuTrain.deleteTrainId'),
handler: this.delTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_REMOVE_TRAIN_TRACE
},
{
label: this.$t('menu.menuTrain.editTrainId'),
handler: this.editTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
// {
// label: this.$t('menu.menuTrain.editTrainNo'),
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
// },
// {
// label: this.$t('menu.menuTrain.moveTrainId'),
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
// },
// {
// label: this.$t('menu.menuTrain.switchTrainId'),
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
// }
]
},
menuNormal: [
{
label: this.$t('menu.menuTrain.addTrainId'),
handler: this.addTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_ADD_TRAIN_TRACE,
isShow: (train, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuTrain.deleteTrainId'),
handler: this.delTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_REMOVE_TRAIN_TRACE,
isShow: (train, work) => work === 'dispatchWork'
},
{
label: this.$t('menu.menuTrain.editTrainId'),
handler: this.editTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE,
isShow: (train, work) => work === 'dispatchWork'
}
],
menuForce: [
{
label: '设置故障',
@ -108,26 +98,10 @@ export default {
}
],
menuDirective: [
// {
// label: '',
// handler: this.nextStation
// },
// {
// label: '',
// handler: this.handleOverFuideSignal
// },
// {
// label: '',
// handler: this.handleOverEedLight
// },
{
label: '开关门',
handler: this.handleOpenOrCloseDoor
},
// {
// label: '',
// handler: this.handleSpeedLimit
// },
{
label: '换端',
handler: this.handleTurnDirection
@ -217,8 +191,12 @@ export default {
},
initMenu() {
//
// this.menu = MenuContextHandler.menuFiltration(this.menuNormal);
this.menu = MenuContextHandler.covert(this.menuNormal);
this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : 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, ...this.menuSpeed];
}
@ -239,7 +217,6 @@ export default {
},
doShow(point) {
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}