95 lines
2.5 KiB
Vue
95 lines
2.5 KiB
Vue
<template>
|
|
<div>
|
|
<pop-menu ref="popMenu" :menu="menu" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import PopMenu from '@/components/PopMenu';
|
|
import { mapGetters } from 'vuex';
|
|
import { DeviceMenu } from '@/scripts/ConstDic';
|
|
import { exitFullscreen } from '@/utils/screen';
|
|
import { runDiagramQuit } from '@/api/simulation';
|
|
import { EventBus } from '@/scripts/event-bus';
|
|
|
|
export default {
|
|
name: 'CancelMenu',
|
|
components: {
|
|
PopMenu
|
|
},
|
|
data() {
|
|
return {
|
|
menu: [],
|
|
menuScreen: [
|
|
{
|
|
label: '放大地图',
|
|
handler: this.magnifyMap,
|
|
disabled: false
|
|
},
|
|
{
|
|
label: '缩小地图',
|
|
handler: this.shrinkMap,
|
|
disabled: false
|
|
},
|
|
{
|
|
label: '返回',
|
|
handler: this.back,
|
|
disabled: false
|
|
}
|
|
]
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters('map', [
|
|
'stationList'
|
|
]),
|
|
group() {
|
|
return this.$route.query.group;
|
|
}
|
|
},
|
|
watch: {
|
|
'$store.state.menuOperation.menuCount': function (val) {
|
|
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
|
|
this.doShow(this.$store.state.menuOperation.menuPosition);
|
|
} else {
|
|
this.doClose();
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
clickEvent() {
|
|
const self = this;
|
|
window.onclick = function (e) {
|
|
self.doClose();
|
|
};
|
|
},
|
|
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();
|
|
}
|
|
},
|
|
// 放大地图
|
|
magnifyMap() {
|
|
this.$store.dispatch('menuOperation/handleMagnifyCount');
|
|
},
|
|
// 缩小地图
|
|
shrinkMap() {
|
|
this.$store.dispatch('menuOperation/handleShrinkCount');
|
|
},
|
|
// 返回
|
|
async back() {
|
|
await runDiagramQuit(this.group);
|
|
EventBus.$emit('trainingSubscribeStop');
|
|
history.go(-1);
|
|
exitFullscreen();
|
|
}
|
|
}
|
|
};
|
|
</script>
|