修改ibp盘切换按钮显示问题

This commit is contained in:
dong 2022-12-28 15:01:37 +08:00
parent e92d1664da
commit 17398ffb03
3 changed files with 36 additions and 7 deletions

View File

@ -10,7 +10,8 @@ const ibp = {
ibp: null, // 数据
updateDeviceData: {}, // 修改的数据
rightClickCount: 0, // 右键点击设备
ibpBgDevice: {} // ibp背景设备
ibpBgDevice: {}, // ibp背景设备
moreScreen: false // 切换按钮是否显示
},
getters: {
@ -42,6 +43,9 @@ const ibp = {
setIbpData: (state, ibp) => {
state.ibp = ibp;
},
setMoreScreen: (state, moreScreen) => {
state.moreScreen = moreScreen;
},
setUpdateDeviceData: (state, model) => {
state.rightClickCount++;
state.updateDeviceData = model;
@ -58,6 +62,9 @@ const ibp = {
setIbpData: ({ commit }, ibp) => {
commit('setIbpData', ibp);
},
setMoreScreen: ({ commit }, moreScreen) => {
commit('setMoreScreen', moreScreen);
},
updateIbpDevices: ({ commit }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {

View File

@ -1,11 +1,11 @@
<template>
<div>
<div :id="ibpId" v-loading="loading" :style="{ width: canvasWidth+'px', height: canvasHeight +'px',background:'#000' }" class="ibp-canvas" />
<el-button-group class="ibp-button">
<el-button v-if="moreScreen" type="primary" @click="switchOffset">切换</el-button>
<!-- <el-button v-if="showBackButton" type="primary" @click="back">{{ $t('global.back') }}</el-button>-->
<!-- <el-button v-if="$route.query.noPreLogout" type="primary" @click="quit">退出</el-button>-->
</el-button-group>
<!-- <el-button-group class="ibp-button"> -->
<!-- <el-button v-if="moreScreen" type="primary" @click="switchOffset">切换</el-button> -->
<!-- <el-button v-if="showBackButton" type="primary" @click="back">{{ $t('global.back') }}</el-button>-->
<!-- <el-button v-if="$route.query.noPreLogout" type="primary" @click="quit">退出</el-button>-->
<!-- </el-button-group> -->
<template v-for="alarm in alarmList">
<audio :id="`buzzer_${alarm.code}`" :key="alarm.code" controls loop="loop">
@ -28,6 +28,7 @@ import { getIbpInfoByStation } from '@/api/ibp';
import { getSimulationInfoNew, getIbpInitialState } from '@/api/simulation';
import BuzzerAudio from '@/assets/buzzer.mp3';
import { getStationList } from '@/api/runplan';
import { EventBus } from '@/scripts/event-bus';
const pressedKeys = new Set();
export default {
@ -112,6 +113,7 @@ export default {
await this.setMoveInit(false);
this.showBackButton = false;
}
EventBus.$on('switchOffset', this.switchOffset);
},
beforeDestroy() {
if (this.$route.query.noPreLogout) {
@ -119,6 +121,8 @@ export default {
this.$ibp.setClockStart(false);
}
this.ibpDestroy();
this.$store.dispatch('ibp/setMoreScreen', false);
EventBus.$off('switchOffset');
},
preResetBtn: null,
methods: {
@ -192,6 +196,7 @@ export default {
const data = parser(ibpDatas, {width: this.canvasWidth, height: this.canvasHeight}); // ibp
this.initIbp(this.offsetX);
this.moreScreen = ibpDatas.background && ibpDatas.background.width > 1920;
this.$store.dispatch('ibp/setMoreScreen', this.moreScreen);
this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpDatas);
this.handleBanOpenScreenDoorStatus();

View File

@ -3,7 +3,7 @@
<div class="allSimulationMenu">
<div class="simulationMenu" @click="showMenuList">菜单</div>
<div v-show="isShowMenuList" class="simulationMenuList">
<div v-for="(each, index) in allMenuList" :key="index">
<div v-for="(each, index) in autoMenuList" :key="index">
<div v-if="each.show" class="eachSimulationMenu" :class="{'menuDisabled' :each.disabled}" @click="() => { each.disabled? '' : each.click(); }">{{ each.label }}</div>
</div>
</div>
@ -34,6 +34,7 @@ import DeviceManage from './deviceManage';
import QrCode from '@/components/QrCode';
import { SimulationUserType } from '@/scripts/ConstDic';
import { destroySimulationByAdmin, ranAsPlan} from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'SimulationMenu',
@ -56,6 +57,7 @@ export default {
deviceif: false,
deviceShow: true,
allMenuList: [
{ label: '切换', name: 'switchOffset', click: this.switchOffset, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.ibp.moreScreen; } },
{ label: '设备视图', name: 'jlmap3dmodel', click: this.jlmap3dmodel, isDisabled: () => { return false; }, isShow: () => { return true; } },
{ label: '设备管理', name: 'deviceManage', click: this.deviceManage, isDisabled: () => { return false; }, isShow: () => { return (this.$store.state.training.domConfig.hasDeviceManage && this.$store.state.training.simulationUserType === SimulationUserType.TEACHER) || (this.$route.query.client === 'interlockWork' && this.$route.query.projectDevice === 'ILW'); } },
{ label: '联系方式', name: 'contectUs', click: this.contectUs, isDisabled: () => { return false; }, isShow: () => { return true; } },
@ -81,6 +83,18 @@ export default {
},
mapId() {
return this.$route.query.mapId;
},
autoMenuList() {
const list = [];
this.allMenuList.forEach(item => {
const obj = {
...item,
show: item.isShow(),
disabled: item.isDisabled()
};
list.push(obj);
});
return list;
}
},
watch: {
@ -105,6 +119,9 @@ export default {
window.removeEventListener('click', this.hideMenuList);
},
methods: {
switchOffset() {
EventBus.$emit('switchOffset');
},
generateQrCode() {
this.hideMenuList();
getSimulationQrcode(this.$route.query.group).then(resp => {