Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly1

This commit is contained in:
fan 2022-12-07 14:02:43 +08:00
commit 57b4eedfe6
4 changed files with 167 additions and 71 deletions

View File

@ -3,6 +3,12 @@
<menu-bar ref="menuBar" :selected="selected" /> <menu-bar ref="menuBar" :selected="selected" />
<menu-station-stand ref="menuStationStand" :selected="selected" :work="'dispatchWork'" /> <menu-station-stand ref="menuStationStand" :selected="selected" :work="'dispatchWork'" />
<menu-switch ref="menuSwitch" :selected="selected" :work="'dispatchWork'" /> <menu-switch ref="menuSwitch" :selected="selected" :work="'dispatchWork'" />
<menu-signal ref="menuSignal" :selected="selected" :work="'dispatchWork'" />
<menu-section ref="menuSection" :selected="selected" :work="'dispatchWork'" />
<menu-station ref="menuStation" :selected="selected" :work="'dispatchWork'" />
<menu-train ref="menuTrain" :selected="selected" :work="'dispatchWork'" />
</div> </div>
</template> </template>
<script> <script>
@ -10,12 +16,20 @@ import { mapGetters } from 'vuex';
import MenuBar from './dispatchWorkMenuBar'; import MenuBar from './dispatchWorkMenuBar';
import MenuStationStand from './menuStationStand'; import MenuStationStand from './menuStationStand';
import MenuSwitch from './menuSwitch'; import MenuSwitch from './menuSwitch';
import MenuSignal from './menuSignal';
import MenuSection from './menuSection';
import MenuStation from './menuStation';
import MenuTrain from './menuTrain';
export default { export default {
name: 'DispatchWorkMenu', name: 'DispatchWorkMenu',
components: { components: {
MenuBar, MenuBar,
MenuStationStand, MenuStationStand,
MenuSwitch MenuSwitch,
MenuSignal,
MenuSection,
MenuStation,
MenuTrain
}, },
props: { props: {
selected: { selected: {

View File

@ -0,0 +1,50 @@
<template>
<div class="menus" :style="{width: width + 'px'}">
<menu-station-stand ref="menuStationStand" :selected="selected" :work="'localWork'" />
<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-station ref="menuStation" :selected="selected" :work="'localWork'" />
<menu-train ref="menuTrain" :selected="selected" :work="'localWork'" />
</div>
</template>
<script>
import MenuStationStand from './menuStationStand';
import MenuSwitch from './menuSwitch';
import MenuSignal from './menuSignal';
import MenuSection from './menuSection';
import MenuStation from './menuStation';
import MenuTrain from './menuTrain';
import { mapGetters } from 'vuex';
export default {
name: 'LocalWorkMenu',
components: {
MenuStationStand,
MenuSwitch,
MenuSignal,
MenuSection,
MenuStation,
MenuTrain
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
computed: {
...mapGetters('config', [
'width'
])
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('config/updateMenuBar');
});
}
};
</script>

View File

@ -123,7 +123,7 @@ export default {
label: '设置跳停', label: '设置跳停',
handler: this.setJumpStop, handler: this.setJumpStop,
cmdType:CMD.Stand.CMD_STAND_SET_JUMP_STOP, cmdType:CMD.Stand.CMD_STAND_SET_JUMP_STOP,
isDisabled: (stand, work) => { stand.allSkip === 1; }, isDisabled: (stand, work) => { stand.allSkip === 0; },
isShow: (stand, work) => work === 'dispatchWork' isShow: (stand, work) => work === 'dispatchWork'
}, },
{ {
@ -131,7 +131,7 @@ export default {
handler: this.cancelJumpStop, handler: this.cancelJumpStop,
cmdType:CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP, cmdType:CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP,
// && stand.assignSkip !== 1 // && stand.assignSkip !== 1
isDisabled: (stand, work) => { (stand.allSkip !== 1); }, isDisabled: (stand, work) => { return stand.allSkip !== 1 || stand.assignSkip !== 1; },
isShow: (stand, work) => work === 'dispatchWork' isShow: (stand, work) => work === 'dispatchWork'
}, },
{ {

View File

@ -25,7 +25,6 @@ import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuO
import CMD from '@/scripts/cmdPlugin/CommandEnum'; import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
export default { export default {
name: 'SwitchMenu', name: 'SwitchMenu',
@ -45,77 +44,101 @@ export default {
default() { default() {
return null; return null;
} }
},
work: {
type: String,
default() {
return '';
}
} }
}, },
data() { data() {
return { return {
menu: [], menu: [],
menuNormal: { menuNormal: [
Local: [
// { {
// label: '', label: '道岔总定',
// handler: this.locate, handler: this.locate,
// cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION,
// }, isDisabled: switchDevice => switchDevice.pos === 'N',
// { isShow: (switchDevice, work) => work === 'dispatchWork'
// label: '', },
// handler: this.reverse, {
// cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION label: '道岔总反',
// }, handler: this.reverse,
{ cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION,
label: '区段激活', isDisabled: switchDevice => switchDevice.pos === 'R',
handler: this.active, isShow: (switchDevice, work) => work === 'dispatchWork'
cmdType: CMD.Switch.CMD_SWITCH_ACTIVE },
}, {
{ label: '道岔单锁',
label: '区段切除', handler: this.lock,
handler: this.split, cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK,
cmdType: CMD.Switch.CMD_SWITCH_CUT_OFF isDisabled: switchDevice => switchDevice.singleLock === 1,
}, isShow: (switchDevice, work) => work === 'dispatchWork'
{ },
label: '设置临时限速', {
handler: this.setSpeed, label: '道岔单解',
cmdType: CMD.Switch.CMD_SWITCH_SET_LIMIT_SPEED handler: this.unlock,
}, cmdType:CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK,
{ isDisabled: switchDevice => switchDevice.singleLock !== 1,
label: '全线取消限速', isShow: (switchDevice, work) => work === 'dispatchWork'
handler: this.cancelSpeed, },
cmdType:CMD.LimitControl.CMD_CANCEL_ALL_LIMIT_SPEED {
} label: '道岔封闭',
], handler: this.block,
Center: [ cmdType:CMD.Switch.CMD_SWITCH_BLOCK,
{ isDisabled: switchDevice => switchDevice.blockade === 1,
label: '道岔总定', isShow: (switchDevice, work) => work === 'dispatchWork'
handler: this.locate, },
cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION {
}, label: '道岔解封',
{ handler: this.unblock,
label: '道岔总反', cmdType:CMD.Switch.CMD_SWITCH_UNBLOCK,
handler: this.reverse, isDisabled: switchDevice => switchDevice.blockade !== 1,
cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION isShow: (switchDevice, work) => work === 'dispatchWork'
}, },
{
label: '道岔单锁', {
handler: this.lock, label: '道岔强扳定位',
cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK handler: this.locate,
}, cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION,
{ isDisabled: switchDevice => switchDevice.pos === 'N',
label: '道岔单解', isShow: (switchDevice, work) => work === 'localWork'
handler: this.unlock, },
cmdType:CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK {
}, label: '道岔强扳反位',
{ handler: this.reverse,
label: '道岔封闭', cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION,
handler: this.block, isDisabled: switchDevice => switchDevice.pos === 'R',
cmdType:CMD.Switch.CMD_SWITCH_BLOCK isShow: (switchDevice, work) => work === 'localWork'
}, },
{ {
label: '道岔解封', label: '区段激活',
handler: this.unblock, handler: this.active,
cmdType:CMD.Switch.CMD_SWITCH_UNBLOCK cmdType: CMD.Switch.CMD_SWITCH_ACTIVE,
} isShow: (switchDevice, work) => work === 'localWork'
] },
}, {
label: '区段切除',
handler: this.split,
cmdType: CMD.Switch.CMD_SWITCH_CUT_OFF,
isShow: (switchDevice, work) => work === 'localWork'
},
{
label: '设置临时限速',
handler: this.setSpeed,
cmdType: CMD.Switch.CMD_SWITCH_SET_LIMIT_SPEED,
isShow: (switchDevice, work) => work === 'localWork'
},
{
label: '全线取消限速',
handler: this.cancelSpeed,
cmdType:CMD.LimitControl.CMD_CANCEL_ALL_LIMIT_SPEED,
isShow: (switchDevice, work) => work === 'localWork'
}
],
menuForce: [ menuForce: [
{ {
label: '设置故障', label: '设置故障',
@ -167,7 +190,16 @@ export default {
}, },
initMenu() { initMenu() {
// //
// this.menu = MenuContextHandler.covert(this.menuNormal); this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected, this.work) : 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];
}
// //
if (this.operatemode === OperateMode.FAULT) { if (this.operatemode === OperateMode.FAULT) {
// if (!this.$store.state.scriptRecord.bgSet) { // if (!this.$store.state.scriptRecord.bgSet) {