rt-sim-training-client/src/jmapNew/theme/xian_01/menus/menuStationStand.vue
2020-10-16 11:25:07 +08:00

307 lines
11 KiB
Vue

<template>
<div>
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<stand-control ref="standControl" />
<stand-detail ref="standDetail" pop-class="xian-01__systerm" />
<stand-run-level ref="standRunLevel" />
<stand-stop-time ref="standStopTime" />
<stand-detain-train-all ref="standDetainTrainAll" />
<notice-info ref="noticeInfo" pop-class="xian-01__systerm" />
<stand-back-strategy ref="standBackStrategy" />
<set-fault ref="setFault" pop-class="xian-01__systerm" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import StandControl from './dialog/standControl';
import StandBackStrategy from './dialog/standBackStrategy';
import StandDetail from '@/jmapNew/theme/components/menus/dialog/standDetail';
import StandRunLevel from './dialog/standRunLevel';
import StandStopTime from './dialog/standStopTime';
import StandDetainTrainAll from './dialog/standDetainTrainAll';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault';
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 {
name: 'StationStandMenu',
components: {
PopMenu,
StandControl,
StandDetail,
StandRunLevel,
NoticeInfo,
StandBackStrategy,
StandStopTime,
StandDetainTrainAll,
SetFault
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: '设置扣车',
handler: this.setDetainTrain,
cmdType:CMD.Stand.CMD_STAND_SET_HOLD_TRAIN
},
{
label: '取消扣车',
handler: this.cancelDetainTrain,
cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN
},
{
label: '强制取消扣车',
handler: this.cancelDetainTrainForce,
cmdType:CMD.Stand.CMD_STAND_FORCE_CANCEL_HOLD_TRAIN
},
{
label: '查询站台状态',
handler: this.detail,
cmdType:CMD.Stand.CMD_STAND_VIEW_STATUS
}
],
Center: [
{
label: '设置扣车',
handler: this.setDetainTrain,
cmdType: CMD.Stand.CMD_STAND_SET_HOLD_TRAIN
},
{
label: '取消扣车',
handler: this.cancelDetainTrain,
cmdType: CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN
},
{
label: '全线取消扣车',
handler: this.cancelDetainTrainAll,
cmdType: CMD.Stand.CMD_STAND_WHOLE_LINE_CANCEL_HOLD_TRAIN
},
{
label: '设置跳停',
handler: this.setJumpStop,
cmdType: CMD.Stand.CMD_STAND_SET_JUMP_STOP
},
{
label: '取消跳停',
handler: this.cancelJumpStop,
cmdType: CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP
},
{
label: '设置停站时间',
handler: this.setStopTime,
cmdType:CMD.Stand.CMD_STAND_SET_PARK_TIME
},
{
label: '设置运行等级',
handler: this.setRunLevel,
cmdType:CMD.Stand.CMD_STAND_SET_RUN_TIME
},
{
label: '设置提前发车',
handler: this.earlyDeparture,
cmdType:CMD.Stand.CMD_STAND_EARLY_DEPART
},
{
label: '设置折返策略',
handler: this.setBackStrategy,
cmdType:CMD.Stand.CMD_STAND_SET_REENTRY_STRATEGY
},
{
label: '查询站台状态',
handler: this.detail,
cmdType: CMD.Stand.CMD_STAND_VIEW_STATUS
}
]
},
menuForce: [
{
label: '设置故障',
handler: this.setStoppage
},
{
label: '取消故障',
handler: this.cancelStoppage
},
{
label: '触发故障管理',
handler: this.triggerFaultManagement,
cmdType: CMD.Fault.CMD_TRIGGER_FAULT
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
// 编辑模式菜单列表
this.menu = MenuContextHandler.covert(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce];
}
// 故障模式菜单列表
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
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() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
}
});
},
// 取消故障
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
}
});
},
// 设置扣车
setDetainTrain() {
commitOperate(menuOperate.StationStand.setDetainTrain, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 取消扣车
cancelDetainTrain() {
commitOperate(menuOperate.StationStand.cancelDetainTrain, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 强制取消扣车
cancelDetainTrainForce() {
commitOperate(menuOperate.StationStand.cancelDetainTrainForce, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 全线取消扣车
cancelDetainTrainAll() {
commitOperate(menuOperate.StationStand.cancelDetainTrainAll, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standDetainTrainAll.doShow(operate, this.selected);
}
});
},
// 设置跳停
setJumpStop() {
commitOperate(menuOperate.StationStand.setJumpStop, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 取消跳停
cancelJumpStop() {
commitOperate(menuOperate.StationStand.cancelJumpStop, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 设置停站时间
setStopTime() {
commitOperate(menuOperate.StationStand.setStopTime, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standStopTime.doShow(operate, this.selected);
}
});
},
// 设置运行等级
setRunLevel() {
commitOperate(menuOperate.StationStand.setRunLevel, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standRunLevel.doShow(operate, this.selected);
}
});
},
// 设置提前发车
earlyDeparture() {
commitOperate(menuOperate.StationStand.earlyDeparture, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 设置折返策略
setBackStrategy() {
commitOperate(menuOperate.StationStand.setBackStrategy, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standBackStrategy.doShow(operate, this.selected);
}
});
},
// 查询站台状态
detail() {
commitOperate(menuOperate.StationStand.detail, { standCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.standDetail.doShow(operate, this.selected);
}
});
},
triggerFaultManagement() {
this.$store.dispatch('training/setTriggerFaultCount', this.selected);
}
}
};
</script>