rt-sim-training-client/src/views/newMap/displayNew/demonMenu.vue

228 lines
6.8 KiB
Vue
Raw Normal View History

2020-08-20 20:27:19 +08:00
<template>
<!-- {} -->
<div>
<div v-if="isAllShow" 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" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
<!-- 三维视图 -->
<el-button v-if="jl3dnameShow" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
<!-- cctv视图 -->
<el-button v-if="cctvShow" size="small" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
<!-- 故障设备视图 -->
<el-button v-if="jlmap3dFaultShow" size="small" @click="jumpjlmap3dFault">故障设备</el-button>
<!-- 司机视角 -->
<el-button v-if="driverShow" size="small" type="jumpjlmap3d" @click="jumpjlmap3dDriver">{{ $t('joinTraining.driverPerspective') }}</el-button>
<!-- 排班计划 -->
<el-button v-if="scheduleLoadShow" type="primary" size="small" @click="jumpScheduling">派班计划加载</el-button>
<el-button v-if="schedulePreviewShow" type="primary" size="small" @click="schedulingView">派班计划预览</el-button>
</el-button-group>
</div>
<Jl3d-Device
v-if="deviceShow"
ref="Jl3dDevice"
:panel-show="deviceShow"
@closedevice3dview="jumpjlmap3dmodel"
/>
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<scheduling v-if="scheduleLoadShow" ref="scheduling" :group="group" />
<scheduling-view v-if="schedulePreviewShow" ref="schedulingView" :group="group" />
</div>
</template>
<script>
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import { getToken } from '@/utils/auth';
import { getSessionStorage } from '@/utils/auth';
2020-08-21 14:16:44 +08:00
import Scheduling from '@/views/newMap/displayNew/demon/scheduling';
import SchedulingView from '@/views/newMap/displayNew/demon/schedulingView';
2020-08-20 20:27:19 +08:00
export default {
name:'DemonMenu',
components:{
Jl3dDevice,
2020-08-21 14:16:44 +08:00
Jl3dDrive,
Scheduling,
SchedulingView
2020-08-20 20:27:19 +08:00
},
props:{
isAllShow:{
type:Boolean,
require:true
},
jl3dmodelShow:{
type:Boolean,
require:true
},
jl3dnameShow:{
type:Boolean,
require:true
},
cctvShow:{
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:'',
deviceShow: false,
drivingShow: false,
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');
}
},
mounted() {
this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId;
},
methods:{
menuClick() {
this.hoverBtn = !this.hoverBtn;
if (this.hoverBtn) {
// this.$refs.button_group_box.$el.clientWidth ||
this.btnWidth = 500; // 默认宽度
} else {
// button_group_box
this.btnWidth = 0;
}
},
jumpjlmap3dmodel() {
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
},
showdriving() {
this.drivingShow = false;
},
jumpjlmap3d() {
const routeData = this.$router.resolve({
path:'/jlmap3d/sandbox',
query:{
mapid:this.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
jumpjl3dpassflow() {
const routeData = this.$router.resolve({
path:'/jlmap3d/passengerflow',
query:{
mapid:this.mapId,
group:this.group,
project: this.project,
noPreLogout: true
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
jumpjlmap3dFault() {
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
},
jumpjlmap3dDriver() {
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId, this.group);
},
jumpScheduling() {
this.$refs.scheduling.doShow();
},
schedulingView() {
this.$refs.schedulingView.doShow();
},
hideScheduling(running) {
if (running) {
this.$refs.scheduling && this.$refs.scheduling.doClose();
} else {
this.$refs.schedulingView && this.$refs.schedulingView.doClose();
}
}
}
};
</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;
2020-08-26 15:16:47 +08:00
display: block;
2020-08-20 20:27:19 +08:00
cursor: pointer;
float: left;
height: 32px;
}
.button_group_box{
float: left;
transition: all 0.5s;
overflow: hidden;
margin-left: -700px;
// transform: translateX(0px);
}
}
</style>