西安三号线 鼠标右键无法出现菜单快速切换车站 处理

This commit is contained in:
joylink_cuiweidong 2021-05-25 10:36:20 +08:00
parent 8abbe2e05a
commit 60fce71f8a

View File

@ -11,10 +11,12 @@
<passive-alarm ref="passiveAlarm" />
<passive-contorl ref="passiveControl" pop-class="xian-01__systerm" />
<passive-Timeout ref="passiveTimeout" />
<pop-menu ref="popMenu" :menu="menu" pop-class="preview_new_pop" />
</div>
</template>
<script>
import { DeviceMenu } from '@/scripts/ConstDic';
import { mapGetters } from 'vuex';
import MenuSignal from './menuSignal';
import MenuStationStand from './menuStationStand';
@ -27,6 +29,7 @@ import MenuStationTurnBack from './menuStationTurnBack';
import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout';
import PopMenu from '@/components/PopMenu';
export default {
name: 'Menus',
@ -41,7 +44,8 @@ export default {
PassiveAlarm,
MenuStationTurnBack,
PassiveContorl,
PassiveTimeout
PassiveTimeout,
PopMenu
},
props: {
selected: {
@ -51,6 +55,12 @@ export default {
}
}
},
data() {
return {
menu: [],
menuNormal: []
};
},
computed: {
...mapGetters('config', [
'width'
@ -62,6 +72,13 @@ export default {
watch: {
isShowBar(val) {
val && this.$store.dispatch('config/updateMenuBar');
},
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel) && this.$store.state.training.prdType == '02') {
this.popDoShow(this.$store.state.menuOperation.menuPosition);
} else {
this.popDoClose();
}
}
},
mounted() {
@ -84,6 +101,58 @@ export default {
},
beforeDestroy() {
window.onclick = function (e) {};
},
methods:{
popClickEvent() {
const self = this;
window.onclick = function (e) {
self.popDoClose();
};
},
popDoShow(point) {
this.popClickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
initMenu() {
this.menuNormal = [];
this.$store.state.map.map.stationList.forEach(station => {
if (station.chargeStationCodeList && station.chargeStationCodeList.length) {
const node = {
label: station.name,
children: [{
code: station.code,
label: station.name,
handler: this.mapLocation
}]
};
station.chargeStationCodeList.forEach(item => {
const next = this.$store.getters['map/getDeviceByCode'](item);
node.children.push({
code: next.code,
label: next.name,
handler: this.mapLocation
});
});
this.menuNormal.push(node);
}
});
this.menu = [...this.menuNormal];
},
popDoClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
mapLocation(item) {
if (item) {
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
this.popDoClose();
}
}
}
};
</script>