rt-sim-training-client/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue

583 lines
26 KiB
Vue
Raw Normal View History

2019-11-29 12:51:58 +08:00
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<route-selection ref="routeSelection"></route-selection>
<route-control ref="routeControl"></route-control>
<route-detail ref="routeDetail"></route-detail>
<route-guide ref="routeGuide"></route-guide>
<notice-info ref="noticeInfo"></notice-info>
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import RouteControl from './dialog/routeControl';
import RouteSelection from './dialog/routeSelection';
import RouteDetail from './dialog/routeDetail';
import RouteGuide from './dialog/routeGuide';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
export default {
name: 'SignalMenu',
components: {
PopMenu,
RouteControl,
RouteSelection,
RouteDetail,
RouteGuide,
NoticeInfo
},
props: {
selected: {
type: Object
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '办理进路',
handler: this.arrangementRoute,
disabledCallback: MenuDisabledState.Signal.arrangementRoute,
auth: { station: true, center: false },
},
{
label: '办理引导进路',
handler: this.guide,
disabledCallback: MenuDisabledState.Signal.guide,
auth: { station: true, center: false },
},
{
label: '取消进路',
handler: this.cancelTrainRoute,
disabledCallback: MenuDisabledState.Signal.cancelTrainRoute,
auth: { station: true, center: false },
},
{
label: '总人解',
handler: this.humanTrainRoute,
disabledCallback: MenuDisabledState.Signal.humanTrainRoute,
auth: { station: true, center: false },
},
{
label: '信号重开',
handler: this.reopenSignal,
disabledCallback: MenuDisabledState.Signal.reopenSignal,
auth: { station: true, center: false },
},
{
label: '信号封锁',
handler: this.lock,
disabledCallback: MenuDisabledState.Signal.lock,
auth: { station: true, center: false },
},
{
label: '信号解封',
handler: this.unlock,
disabledCallback: MenuDisabledState.Signal.unlock,
auth: { station: true, center: false },
},
{
label: '进路收人工控',
handler: this.humanControl,
disabledCallback: MenuDisabledState.Signal.humanControl,
auth: { station: false, center: true },
},
{
label: '进路交自动控',
handler: this.atsAutoControl,
disabledCallback: MenuDisabledState.Signal.atsAutoControl,
auth: { station: false, center: true },
},
{
label: '查询进路控制状态',
handler: this.detail,
disabledCallback: MenuDisabledState.Signal.detail,
auth: { station: true, center: true },
}
// {
// label: '设置联锁自动进路',
// handler: this.setAutoInterlock,
// disabledCallback: MenuDisabledState.Signal.setAutoInterlock,
// auth: { station: true, center: false },
// },
// {
// label: '取消联锁自动进路',
// handler: this.cancelAutoInterlock,
// disabledCallback: MenuDisabledState.Signal.cancelAutoInterlock,
// auth: { station: true, center: false },
// },
// {
// label: '设置联锁自动触发',
// handler: this.setAutoTrigger,
// disabledCallback: MenuDisabledState.Signal.setAutoTrigger,
// auth: { station: true, center: false },
// },
// {
// label: '取消联锁自动触发',
// handler: this.cancelAutoTrigger,
// disabledCallback: MenuDisabledState.Signal.cancelAutoTrigger,
// auth: { station: true, center: false },
// },
// {
// label: '信号关灯',
// handler: this.signalClose,
// disabledCallback: MenuDisabledState.Signal.signalClose,
// auth: { station: true, center: false },
// }
],
central: [
{
label: '办理进路',
handler: this.arrangementRoute,
disabledCallback: MenuDisabledState.Signal.arrangementRoute,
auth: { station: true, center: false },
},
{
label: '办理引导进路',
handler: this.guide,
disabledCallback: MenuDisabledState.Signal.guide,
auth: { station: true, center: false },
},
{
label: '取消进路',
handler: this.cancelTrainRoute,
disabledCallback: MenuDisabledState.Signal.cancelTrainRoute,
auth: { station: true, center: false },
},
{
label: '总人解',
handler: this.humanTrainRoute,
disabledCallback: MenuDisabledState.Signal.humanTrainRoute,
auth: { station: true, center: false },
},
{
label: '信号重开',
handler: this.reopenSignal,
disabledCallback: MenuDisabledState.Signal.reopenSignal,
auth: { station: true, center: false },
},
{
label: '信号封锁',
handler: this.lock,
disabledCallback: MenuDisabledState.Signal.lock,
auth: { station: true, center: false },
},
{
label: '信号解封',
handler: this.unlock,
disabledCallback: MenuDisabledState.Signal.unlock,
auth: { station: true, center: false },
},
{
label: '进路收人工控',
handler: this.humanControl,
disabledCallback: MenuDisabledState.Signal.humanControl,
auth: { station: false, center: true },
},
{
label: '进路交自动控',
handler: this.atsAutoControl,
disabledCallback: MenuDisabledState.Signal.atsAutoControl,
auth: { station: false, center: true },
},
{
label: '查询进路控制状态',
handler: this.detail,
disabledCallback: MenuDisabledState.Signal.detail,
auth: { station: true, center: true },
}
],
},
menuForce: [
{
label: '信号关灯',
handler: this.signalClose,
disabledCallback: '',
},
{
label: '设置故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Signal.setStoppage
},
{
label: '取消故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Signal.cancelStoppage
}
]
}
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Signal) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//编辑模式菜单列表
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce]
}
//故障模式菜单列表
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//设置故障
setStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.stoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//取消故障
cancelStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
// 设置进路
arrangementRoute() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.arrangementRoute.menu.operation
}
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
var tempData = null;
if (response) {
tempData = response.data;
}
this.$refs.routeSelection.doShow(operate.operation, this.selected, tempData);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//进路引导
guide() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.guide.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
var tempData = null;
if (response) {
tempData = response.data;
}
this.$refs.routeGuide.doShow(operate.operation, this.selected, tempData);
}
});
},
//取消进路
cancelTrainRoute() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//总人解
humanTrainRoute() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.humanTrainRoute.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//信号重开
reopenSignal() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.reopenSignal.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//信号封锁
lock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//信号解封
unlock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//进路交人工控
humanControl() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.humanControl.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = null;
if (response) {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected, tempData);
}
});
},
//进路交自动控
atsAutoControl() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = null;
if (response) {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected, tempData);
}
});
},
// //设置联锁自动进路
// setAutoInterlock() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Signal.type,
// label: MapDeviceType.Signal.label,
// operation: OperationEvent.Signal.setAutoInterlock.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.routeControl.doShow(operate, this.selected);
// }
// });
// },
// //取消联锁自动进路
// cancelAutoInterlock() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Signal.type,
// label: MapDeviceType.Signal.label,
// operation: OperationEvent.Signal.cancelAutoInterlock.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.routeControl.doShow(operate, this.selected);
// }
// });
// },
// //设置联锁自动触发
// setAutoTrigger() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Signal.type,
// label: MapDeviceType.Signal.label,
// operation: OperationEvent.Signal.setAutoTrigger.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.routeControl.doShow(operate, this.selected);
// }
// });
// },
// //取消联锁自动触发
// cancelAutoTrigger() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Signal.type,
// label: MapDeviceType.Signal.label,
// operation: OperationEvent.Signal.cancelAutoTrigger.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.routeControl.doShow(operate, this.selected);
// }
// });
// },
// //信号关灯
// signalClose() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Signal.type,
// label: MapDeviceType.Signal.label,
// operation: OperationEvent.Signal.signalClose.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.routeControl.doShow(operate, this.selected);
// }
// });
// },
//查询进路状态
detail() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.detail.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeDetail.doShow(operate, this.selected, response.data);
}
});
}
}
}
</script>