增加车次窗右键操作

This commit is contained in:
zyy 2020-02-12 17:43:18 +08:00
parent c4b37c1519
commit d22f2582c3
3 changed files with 192 additions and 202 deletions

View File

@ -19,9 +19,6 @@
<script>
import PopMenu from '@/components/PopMenu';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import TrainDelete from './dialog/trainDelete';
import TrainDefine from './dialog/trainDefine';
@ -35,6 +32,12 @@ import TrainSetHead from './dialog/trainSetHead';
import TrainSetWork from './dialog/trainSetWork';
import TrainFlag from './dialog/trainFlag';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default {
name: 'MenuTrain',
components: {
@ -64,197 +67,163 @@ export default {
return {
menu: [],
menuNormal: {
local: [
Local: [
// {
// label: '',
// handler: this.addTrainId,
// cmdType: ''
// },
// {
// label: '',
// handler: this.delTrainId,
// cmdType: ''
// },
// {
// label: '',
// handler: this.editTrainId,
// cmdType: ''
// },
// {
// label: '',
// handler: this.moveTrainId,
// cmdType: ''
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.setPlanTrain,
// cmdType: ''
// },
// {
// label: '',
// handler: this.setHeadTrain,
// cmdType: ''
// },
// {
// label: '',
// handler: this.setWorkTrain,
// cmdType: ''
// },
// {
// type: 'separator'
// },
{
label: '定义车组号',
handler: this.addTrainId,
disabledCallback: MenuDisabledState.Train.addTrainId,
auth: { station: true, center: true }
},
{
label: '删除车组号',
handler: this.delTrainId,
disabledCallback: MenuDisabledState.Train.delTrainId,
auth: { station: true, center: true }
},
{
label: '修改车组号',
handler: this.editTrainId,
disabledCallback: MenuDisabledState.Train.editTrainId,
auth: { station: true, center: true }
},
{
label: '移动车组号',
handler: this.moveTrainId,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '设置计划车',
handler: this.setPlanTrain,
disabledCallback: MenuDisabledState.Train.setPlanTrain,
auth: { station: true, center: true }
},
{
label: '设置头码车',
handler: this.setHeadTrain,
disabledCallback: MenuDisabledState.Train.setHeadTrain,
auth: { station: true, center: true }
},
{
label: '设置人工车',
handler: this.setWorkTrain,
disabledCallback: MenuDisabledState.Train.setWorkTrain,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '添加计划车',
// handler: this.undeveloped,
label: '新建计划车',
handler: this.addPlanTrain,
// disabledCallback: MenuDisabledState.Train.moveTrainId,
disabledCallback: MenuDisabledState.Train.addPlanTrain,
auth: { station: true, center: true }
cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
},
{
label: '删除计划车',
// {
// label: '',
// handler: this.deletePlanTrain,
// cmdType: ''
// },
// {
// label: '',
// handler: this.moveEventlyTrain,
// cmdType: ''
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.trainToFlag,
// cmdType: ''
// },
// {
// label: '',
// handler: this.trainUnFlag,
// cmdType: ''
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.undeveloped,
handler: this.deletePlanTrain,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
label: '平移计划车',
// handler: this.undeveloped,
handler: this.moveEventlyTrain,
disabledCallback: MenuDisabledState.Train.moveEventlyTrain,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '标记重点列车',
handler: this.trainToFlag,
disabledCallback: MenuDisabledState.Train.trainToFlag,
auth: { station: true, center: true }
},
{
label: '取消标记重点列车',
handler: this.trainUnFlag,
disabledCallback: MenuDisabledState.Train.trainUnFlag,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '列车信息',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
}
// cmdType: ''
// }
],
central: [
Center: [
// {
// label: '',
// handler: this.addTrainId,
// cmdType: ''
// },
// {
// label: '',
// handler: this.delTrainId,
// cmdType: ''
// },
// {
// label: '',
// handler: this.editTrainId,
// cmdType: ''
// },
// {
// label: '',
// handler: this.moveTrainId,
// cmdType: ''
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.setPlanTrain,
// cmdType: ''
// },
// {
// label: '',
// handler: this.setHeadTrain,
// cmdType: ''
// },
// {
// label: '',
// handler: this.setWorkTrain,
// cmdType: ''
// },
// {
// type: 'separator'
// },
{
label: '定义车组号',
handler: this.addTrainId,
disabledCallback: MenuDisabledState.Train.addTrainId,
auth: { station: true, center: true }
},
{
label: '删除车组号',
handler: this.delTrainId,
disabledCallback: MenuDisabledState.Train.delTrainId,
auth: { station: true, center: true }
},
{
label: '修改车组号',
handler: this.editTrainId,
disabledCallback: MenuDisabledState.Train.editTrainId,
auth: { station: true, center: true }
},
{
label: '移动车组号',
handler: this.moveTrainId,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '设置计划车',
handler: this.setPlanTrain,
disabledCallback: MenuDisabledState.Train.setPlanTrain,
auth: { station: true, center: true }
},
{
label: '设置头码车',
handler: this.setHeadTrain,
disabledCallback: MenuDisabledState.Train.setHeadTrain,
auth: { station: true, center: true }
},
{
label: '设置人工车',
handler: this.setWorkTrain,
disabledCallback: MenuDisabledState.Train.setWorkTrain,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '添加计划车',
// handler: this.undeveloped,
label: '新建计划车',
handler: this.addPlanTrain,
// disabledCallback: MenuDisabledState.Train.moveTrainId,
disabledCallback: MenuDisabledState.Train.addPlanTrain,
auth: { station: true, center: true }
cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
},
{
label: '删除计划车',
// {
// label: '',
// handler: this.deletePlanTrain,
// cmdType: ''
// },
// {
// label: '',
// handler: this.moveEventlyTrain,
// cmdType: ''
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.trainToFlag,
// cmdType: ''
// },
// {
// label: '',
// handler: this.trainUnFlag,
// cmdType: ''
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.undeveloped,
handler: this.deletePlanTrain,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
label: '平移计划车',
// handler: this.undeveloped,
handler: this.moveEventlyTrain,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '标记重点列车',
handler: this.trainToFlag,
disabledCallback: MenuDisabledState.Train.trainToFlag,
auth: { station: true, center: true }
},
{
label: '取消标记重点列车',
handler: this.trainUnFlag,
disabledCallback: MenuDisabledState.Train.trainUnFlag,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '列车信息',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
}
// cmdType: ''
// }
]
},
menuForce: [
@ -305,17 +274,12 @@ export default {
},
initMenu() {
//
this.menu = trainMenuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed];
}
this.menu = MenuContextHandler.covert(this.menuNormal);
console.log(this.menu);
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed];
this.menu = this.menuForce;
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
@ -485,17 +449,19 @@ export default {
},
//
addPlanTrain() {
const operate = {
const step = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.addPlanTrainId.menu.operation
operation: OperationEvent.Train.createPlanTrain.menu.operation,
param: {
trainWindowCode: this.selected.code
}
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainAddPlan.doShow(operate, this.selected);
this.$refs.trainAddPlan.doShow(step, this.selected);
}
});
},

View File

@ -19,6 +19,8 @@ class MenuContextHandler {
control = store.getters['map/getDeviceStationCodeByStationCode'](selected.deviceStationCode);
} else if (selected._type == 'Station') {
control = store.getters['map/getDeviceStationCodeByStationCode'](selected.code);
} else if (selected._type == 'Train') { // 车次窗单独处理
control = store.getters['map/getDeviceTrainWindowCodeByStationCode'](selected.code);
} else {
control = store.getters['map/getDeviceStationCodeByStationCode'](selected.stationCode);
}

View File

@ -456,6 +456,28 @@ const map = {
});
}
return device;
},
// 通过循环区段来获取控制模式
getDeviceTrainWindowCodeByStationCode: (state) => (code) => {
let device = null;
if (code &&
state.map &&
state.map.sectionList && state.map.sectionList.length) {
state.map.sectionList.forEach(elem => {
if (elem.trainWindowCode == code) {
if (state.map.stationList && state.map.stationList.length) {
state.map.stationList.forEach(elems => {
if (elems.code == elem.stationCode) {
device = state.mapDevice[elems.code];
}
});
}
}
});
}
return device;
}
},