铁科院 大铁线路 道岔右键菜单添加

This commit is contained in:
joylink_cuiweidong 2022-06-24 13:59:23 +08:00
parent 985180eba7
commit 3e13058b3a
3 changed files with 191 additions and 1 deletions

View File

@ -0,0 +1,37 @@
<template>
<div class="menus" :style="{width: width + 'px'}">
<menu-switch ref="menuSwitch" :selected="selected" />
<menu-signal ref="menuSignal" :selected="selected" />
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import MenuSignal from './menuSignal';
import MenuSwitch from './menuSwitch';
export default {
name: 'Menus',
components: {
MenuSignal,
MenuSwitch
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
computed: {
...mapGetters('config', [
'width'
])
},
mounted() {
},
methods: {
}
};
</script>

View File

@ -1,15 +1,20 @@
<template> <template>
<div> <div>
<pop-menu ref="popMenu" :menu="menu" /> <pop-menu ref="popMenu" :menu="menu" />
<notice-info ref="noticeInfo" pop-class="chengdou-03__systerm" />
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
// OperateMode
import { DeviceMenu } from '@/scripts/ConstDic';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
export default { export default {
name: 'SignalMenu', name: 'SignalMenu',
components: { components: {
PopMenu PopMenu,
NoticeInfo
}, },
props: { props: {
selected: { selected: {
@ -71,6 +76,15 @@ export default {
return this.$route.query.group; return this.$route.query.group;
} }
}, },
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: { methods: {
initMenu() { initMenu() {
// //
@ -106,6 +120,11 @@ export default {
// //
seal() { seal() {
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
} }
} }
}; };

View File

@ -0,0 +1,134 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<notice-info ref="noticeInfo" pop-class="chengdou-03__systerm" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
// OperateMode
import { DeviceMenu } from '@/scripts/ConstDic';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default {
name: 'SwitchMenu',
components: {
PopMenu,
NoticeInfo
},
props: {
selected: {
type: Object,
default: () => {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: '总定',
handler: this.locate,
cmdType: CMD.Switch.CMD_SWITCH_NORMAL_POSITION
},
{
label: '总反',
handler: this.reverse,
cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION
},
{
type: 'separator'
},
{
label: '单锁',
handler: this.lock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
},
{
label: '单解',
handler: this.unlock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
},
{
type: 'separator'
},
{
label: '封闭',
handler: this.block,
cmdType: CMD.Switch.CMD_SWITCH_BLOCK
},
{
label: '解封',
handler: this.unblock,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK
}
],
Center: [
]
}
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods:{
locate() {
},
reverse() {
},
lock() {
},
unlock() {
},
block() {
},
unblock() {
},
doShow(point) {
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();
}
},
initMenu() {
//
// this.menu = MenuContextHandler.covert(this.menuNormal);
this.menu = this.menuNormal.Local;
//
// if (this.operatemode === OperateMode.FAULT) {
// if (!this.$store.state.scriptRecord.bgSet) {
// const menuHook = [{
// label: '',
// handler: this.hookLock
// }];
// this.menu = [...this.menuForce, ...menuHook];
// } else {
// this.menu = this.menuForce;
// }
// }
}
}
};
</script>