增加车次窗右键操作

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> <script>
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'; 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 { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import TrainDelete from './dialog/trainDelete'; import TrainDelete from './dialog/trainDelete';
import TrainDefine from './dialog/trainDefine'; import TrainDefine from './dialog/trainDefine';
@ -35,6 +32,12 @@ import TrainSetHead from './dialog/trainSetHead';
import TrainSetWork from './dialog/trainSetWork'; import TrainSetWork from './dialog/trainSetWork';
import TrainFlag from './dialog/trainFlag'; 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 { export default {
name: 'MenuTrain', name: 'MenuTrain',
components: { components: {
@ -64,197 +67,163 @@ export default {
return { return {
menu: [], menu: [],
menuNormal: { 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: '定义车组号', 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,
handler: this.addPlanTrain, handler: this.addPlanTrain,
// disabledCallback: MenuDisabledState.Train.moveTrainId, cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
disabledCallback: MenuDisabledState.Train.addPlanTrain,
auth: { station: true, center: true }
}, },
{ // {
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.undeveloped,
handler: this.deletePlanTrain, // cmdType: ''
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 }
}
], ],
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: '定义车组号', 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,
handler: this.addPlanTrain, handler: this.addPlanTrain,
// disabledCallback: MenuDisabledState.Train.moveTrainId, cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
disabledCallback: MenuDisabledState.Train.addPlanTrain,
auth: { station: true, center: true }
}, },
{ // {
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.undeveloped,
handler: this.deletePlanTrain, // cmdType: ''
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 }
}
] ]
}, },
menuForce: [ menuForce: [
@ -305,17 +274,12 @@ export default {
}, },
initMenu() { initMenu() {
// //
this.menu = trainMenuFiltration(this.menuNormal); this.menu = MenuContextHandler.covert(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) { console.log(this.menu);
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed];
}
// //
if (this.operatemode === OperateMode.FAULT) { if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed]; this.menu = this.menuForce;
} }
this.menu = menuConvert(this.menu);
}, },
doShow(point) { doShow(point) {
this.clickEvent(); this.clickEvent();
@ -485,17 +449,19 @@ export default {
}, },
// //
addPlanTrain() { addPlanTrain() {
const operate = { const step = {
start: true, start: true,
code: this.selected.code, code: this.selected.code,
type: MapDeviceType.Train.type, operation: OperationEvent.Train.createPlanTrain.menu.operation,
label: MapDeviceType.Train.label, param: {
operation: OperationEvent.Train.addPlanTrainId.menu.operation trainWindowCode: this.selected.code
}
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); 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); control = store.getters['map/getDeviceStationCodeByStationCode'](selected.deviceStationCode);
} else if (selected._type == 'Station') { } else if (selected._type == 'Station') {
control = store.getters['map/getDeviceStationCodeByStationCode'](selected.code); control = store.getters['map/getDeviceStationCodeByStationCode'](selected.code);
} else if (selected._type == 'Train') { // 车次窗单独处理
control = store.getters['map/getDeviceTrainWindowCodeByStationCode'](selected.code);
} else { } else {
control = store.getters['map/getDeviceStationCodeByStationCode'](selected.stationCode); 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; return device;
} }
}, },