rt-sim-training-client/src/views/iscs/iscsDesign/contextMenu.vue

89 lines
2.3 KiB
Vue

<template>
<div>
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="popMenuClass" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import { Notification } from 'element-ui';
import { DeviceMenu } from '@/scripts/ConstDic';
import { exitFullscreen } from '@/utils/screen';
export default {
name: 'CancelMenu',
components: {
PopMenu
},
data() {
return {
menu: [],
menuSystem: [
{
label: '添加系统界面',
handler: this.addInterface,
disabled: false
}
],
menuInterface: [
{
label: '删除系统界面',
handler: this.deleteInterface,
disabled: false
}
]
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.IscsSystem)) {
this.menu = [...this.menuSystem];
this.doShow(this.$store.state.menuOperation.menuPosition);
} else if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.IscsInterface)) {
this.menu = [...this.menuInterface];
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.menu = [];
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
addInterface() {
},
deleteInterface() {
},
doShow(point) {
this.clickEvent();
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();
}
},
// 返回
async back() {
history.go(-1);
Notification.closeAll();
exitFullscreen();
}
}
};
</script>
<style lang="scss" scoped>
.popMenuClass{
background: #fff;
}
</style>