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

330 lines
11 KiB
Vue
Raw Normal View History

2020-08-20 20:27:19 +08:00
<template>
<div>
<div v-if="isAllShow&&project != 'bjd'" class="display_top_draft" :style="allStyle">
2020-08-20 20:27:19 +08:00
<div class="btn_hover" @click="menuClick">菜单</div>
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
<!-- 地图错误判断 -->
<!-- 设备视图 -->
2020-11-13 13:31:44 +08:00
<el-button v-if="jl3dmodelShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
2020-10-26 17:05:04 +08:00
<!-- 三维视图/数字沙盘 -->
2020-11-13 13:31:44 +08:00
<el-button v-if="jl3dnameShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
2020-08-20 20:27:19 +08:00
<!-- cctv视图 -->
2021-01-28 16:10:36 +08:00
<el-button v-if="jl3dnameShow && !isContest && project !== 'bjd'" size="small" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
2020-11-04 10:34:33 +08:00
<!-- 客流规划视图 -->
2020-11-24 17:32:37 +08:00
<!-- <el-button v-if="trafficplanShow && project == 'bjd' && !isContest" size="small" @click="jumpjl3dtrafficplan">{{ jl3dtrafficplan }}</el-button>
<el-button v-if="trafficplanShow && project == 'bjd' && !isContest" size="small" @click="jumpjl3dtraffictrain">{{ $t('display.demon.traffictraintext') }}</el-button> -->
2020-08-20 20:27:19 +08:00
<!-- 故障设备视图 -->
<el-button v-if="jlmap3dFaultShow" size="small" @click="jumpjlmap3dFault">故障设备</el-button>
<!-- 司机视角 -->
2020-10-26 15:24:08 +08:00
<el-button v-if="driverShow" size="small" type="jumpjlmap3d" @click="jumpjlmap3dDriver">司机视角</el-button>
2020-08-20 20:27:19 +08:00
<!-- 排班计划 -->
<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 v-if="isContest" size="small" :disabled="practiceDisabled" @click="fieldPractice">实操练习</el-button>
2020-09-17 09:50:52 +08:00
<el-button v-if="isContest" size="small" @click="goTheoryQuiz">理论考试</el-button>
<el-button v-if="messageBoard" size="small" @click="messageBoardShow">留言板</el-button>
<!-- v-if="isContest" -->
<el-button v-if="!isLocal" size="small" @click="contectUs">联系方式</el-button>
2020-08-20 20:27:19 +08:00
</el-button-group>
</div>
<Jl3d-Device
2020-12-07 17:14:06 +08:00
v-if="deviceif"
v-show="deviceShow"
2020-08-20 20:27:19 +08:00
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" />
<contect-us ref="contectUs" />
2020-08-20 20:27:19 +08:00
</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';
import { EventBus } from '@/scripts/event-bus';
import ContectUs from '@/views/newMap/displayNew/dispatherContest/contectUs';
import { getPostByProjectCode } from '@/api/learn';
import { ProjectCode } from '@/scripts/ProjectConfig';
2020-08-20 20:27:19 +08:00
export default {
name:'DemonMenu',
components:{
Jl3dDevice,
2020-08-21 14:16:44 +08:00
Jl3dDrive,
Scheduling,
2020-08-27 11:33:37 +08:00
SchedulingView,
ContectUs
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
},
2020-11-04 10:34:33 +08:00
trafficplanShow:{
2020-11-13 13:31:44 +08:00
type:Boolean,
require:true
2020-11-04 10:34:33 +08:00
},
2020-11-06 18:28:30 +08:00
traffictrainShow:{
2020-11-13 13:31:44 +08:00
type:Boolean,
require:true
2020-11-06 18:28:30 +08:00
},
2020-08-20 20:27:19 +08:00
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,
2020-12-07 17:14:06 +08:00
deviceif:false,
deviceShow: true,
2020-08-20 20:27:19 +08:00
drivingShow: false,
messageBoard: false,
2020-11-06 18:28:30 +08:00
jl3dtrafficplan:this.$t('display.demon.trafficplantext'),
jl3dtraffictrain:this.$t('display.demon.traffictraintext'),
2020-08-20 20:27:19 +08:00
jl3dpassflow:this.$t('display.demon.passengerflow'),
jl3dname: this.$t('display.demon.threeDimensionalView'),
jl3dmodel: this.$t('display.demon.deviceView')
2020-08-20 20:27:19 +08:00
};
},
computed:{
isDrive() {
return this.$route.query.prdType == '04';
},
project() {
return getSessionStorage('project');
2020-08-27 11:33:37 +08:00
},
isContest() {
return this.$route.params.mode === 'demon' && this.project == 'drts';
2020-11-13 13:31:44 +08:00
},
running() {
return this.$store.state.training.started;
},
isLocal() { // 是否为本地项目
return process.env.VUE_APP_PRO === 'local';
2020-08-20 20:27:19 +08:00
}
},
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;
});
getPostByProjectCode(ProjectCode[this.project]).then(resp => {
if (resp.data) {
this.messageBoard = true;
}
}).catch(() => {
this.$message.error('获取留言板信息失败');
});
2020-08-20 20:27:19 +08:00
},
methods:{
menuClick() {
this.hoverBtn = !this.hoverBtn;
if (this.hoverBtn) {
// this.$refs.button_group_box.$el.clientWidth ||
2020-09-18 16:02:22 +08:00
this.btnWidth = 600; // 默认宽度
2020-08-20 20:27:19 +08:00
} else {
// button_group_box
this.btnWidth = 0;
}
},
jumpjlmap3dmodel() {
if (this.deviceif == false) {
this.deviceif = true;
2020-08-20 20:27:19 +08:00
} else {
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
2020-08-20 20:27:19 +08:00
}
2020-12-07 17:14:06 +08:00
2020-08-20 20:27:19 +08:00
},
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');
2020-08-20 20:27:19 +08:00
},
jumpjl3dpassflow() {
const routeData = this.$router.resolve({
path:'/jlmap3d/passengerflow',
query:{
mapid:this.mapId,
group:this.group,
project: this.project,
noPreLogout: true,
lineCode:this.lineCode
2020-08-20 20:27:19 +08:00
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
2020-11-24 17:32:37 +08:00
// jumpjl3dtrafficplan() {
// const routeData = this.$router.resolve({
// path:'/jlmap3d/trafficplan',
// query:{
// mapid:this.mapId,
// group:this.group,
// project: this.project,
// noPreLogout: true,
// lineCode:this.lineCode
// }
// });
// window.open(routeData.href, '_blank', 'noopener noreferrer');
// },
// jumpjl3dtraffictrain() {
// const routeData = this.$router.resolve({
// path:'/jlmap3d/traffictrain',
// query:{
// mapid:this.mapId,
// group:this.group,
// project: this.project,
// noPreLogout: true,
// lineCode:this.lineCode
// }
// });
// window.open(routeData.href, '_blank', 'noopener noreferrer');
// },
2020-08-20 20:27:19 +08:00
jumpjlmap3dFault() {
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
window.open(routeData.href);
2020-08-20 20:27:19 +08:00
},
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();
}
2020-08-27 11:33:37 +08:00
},
2020-08-28 10:59:44 +08:00
fieldPractice() {
2020-09-18 16:02:22 +08:00
this.$emit('fieldPractice');
2020-09-17 09:50:52 +08:00
},
goTheoryQuiz() {
this.$emit('goTheoryQuiz');
2020-11-13 13:31:44 +08:00
},
2020-11-16 19:26:23 +08:00
messageBoardShow() {
const routeData = this.$router.resolve({
path:'/messageBoard',
query:{
2020-12-18 13:38:13 +08:00
project: this.$route.query.project || getSessionStorage('project'),
noPreLogout: true
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
contectUs() {
this.$refs.contectUs.doShow();
}
2021-01-29 15:28:51 +08:00
2020-08-20 20:27:19 +08:00
}
};
</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>