rt-sim-training-client/src/views/newMap/displayCity/demonMenu.vue
2022-05-27 09:51:29 +08:00

225 lines
6.5 KiB
Vue

<template>
<div>
<div v-if="isAllShow&&project != 'bjd'" class="display_top_draft" :style="allStyle">
<div class="btn_hover" @click="menuClick">菜单</div>
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
<el-button v-if="jl3dmodelShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
<!-- 司机视角 -->
<!-- <el-button v-if="$route.query.lineCode === '15'" size="small" type="jumpjlmap3d" @click="jumpjlmap3dDriver">司机视角</el-button> -->
<el-button v-if="$route.query.lineCode === '15'" size="small" @click="clCaAnCall">经典案例分析</el-button>
<el-button v-if="$route.query.lineCode === '15'" size="small" @click="normStudy">规范学习</el-button>
<el-button v-if="$route.query.lineCode === '16'" size="small" @click="showLineBoard">占线板</el-button>
</el-button-group>
</div>
<Jl3dRailway-Device
v-if="deviceif"
v-show="deviceShow"
ref="Jl3dRailwayDevice"
:panel-show="deviceShow"
@closedevice3dview="jumpjlmap3dmodel"
/>
<Jl3dRailway-Drive v-show="drivingShow" ref="Jl3dRailwayDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<draw-select ref="drawSelect" />
<line-board ref="lineBoard" />
</div>
</template>
<script>
import Jl3dRailwayDevice from '@/views/jlmap3d/railwaydevice/jl3drailwaydevice';
import Jl3dRailwayDrive from '@/views/jlmap3d/railwaydrive/jl3drailwaydrive';
import { getSessionStorage } from '@/utils/auth';
import { EventBus } from '@/scripts/event-bus';
import { getPostByProjectCode } from '@/api/learn';
import { ProjectCode } from '@/scripts/ProjectConfig';
import DrawSelect from '@/jmapNew/theme/datie_01/menus/dialog/drawSelect';
import LineBoard from './lineBoard';
export default {
name:'DemonMenu',
components:{
Jl3dRailwayDevice,
Jl3dRailwayDrive,
DrawSelect,
LineBoard
},
props:{
isAllShow:{
type:Boolean,
require:true
},
jl3dmodelShow:{
type:Boolean,
require:true
},
jl3dnameShow:{
type:Boolean,
require:true
},
cctvShow:{
type:Boolean,
require:true
},
trafficplanShow:{
type:Boolean,
require:true
},
traffictrainShow:{
type:Boolean,
require:true
},
scheduleLoadShow:{
type:Boolean,
require:true
},
driverShow:{
type:Boolean,
require:true
},
schedulePreviewShow:{
type:Boolean,
require:true
},
jlmap3dFaultShow:{
type:Boolean,
require:true
},
allStyle:{
type:String,
default() {
return '';
}
}
},
data() {
return {
hoverBtn: false,
btnWidth: 0,
group:'',
mapId:'',
lineCode:'',
practiceDisabled:false,
deviceif:false,
deviceShow: true,
drivingShow: false,
messageBoard: false,
jl3dtrafficplan:this.$t('display.demon.trafficplantext'),
jl3dtraffictrain:this.$t('display.demon.traffictraintext'),
jl3dpassflow:this.$t('display.demon.passengerflow'),
jl3dname: this.$t('display.demon.threeDimensionalView'),
jl3dmodel: this.$t('display.demon.deviceView')
};
},
computed:{
isDrive() {
return this.$route.query.prdType == '04';
},
project() {
return getSessionStorage('project');
},
isContest() {
return this.$route.params.mode === 'demon' && this.project.includes('drts');
},
running() {
return this.$store.state.training.started;
},
isLocal() { // 是否为本地项目
return process.env.VUE_APP_PRO === 'local';
}
},
mounted() {
this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId;
this.lineCode = this.$route.query.lineCode;
EventBus.$on('loadScene', () => {
this.practiceDisabled = true;
});
EventBus.$on('quitScene', () => {
this.practiceDisabled = false;
});
if (this.project) {
getPostByProjectCode(ProjectCode[this.project]).then(resp => {
if (resp.data) {
this.messageBoard = true;
}
}).catch(() => {
console.log('获取留言板信息失败');
});
}
if(this.$route.query.project == "zzww"){
this.jumpjlmap3dDriver();
}
},
methods:{
menuClick() {
this.hoverBtn = !this.hoverBtn;
if (this.hoverBtn) {
this.btnWidth = 600;
} else {
this.btnWidth = 0;
}
},
clCaAnCall() {
this.$refs.drawSelect.doShow(null, 'clCaAn');
},
normStudy() {
this.$refs.drawSelect.doShow(null, 'normStudy');
},
showLineBoard() {
this.$refs.lineBoard.doShow();
},
jumpjlmap3dmodel() {
if (this.deviceif == false) {
this.deviceif = true;
} else {
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
}
},
showdriving() {
this.drivingShow = false;
},
jumpjlmap3dDriver() {
this.drivingShow = true;
this.$refs.Jl3dRailwayDrive.show(this.mapId, this.group);
},
}
};
</script>
<style lang="scss" scoped>
.display_top_draft{
position: absolute;
left: 5px;
top: 15px;
height: 32px;
overflow: hidden;
padding-left: 44px;
z-index: 35;
.btn_hover{
position: absolute;
left: 0;
top: 0;
z-index: 2;
color: #4e4d4d;
font-size: 14px;
background: #fff;
padding: 8px;
border-radius: 5px;
display: block;
cursor: pointer;
float: left;
height: 32px;
}
.button_group_box{
float: left;
transition: all 0.5s;
overflow: hidden;
margin-left: -700px;
// transform: translateX(0px);
}
}
</style>