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

333 lines
11 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`">
<!-- 地图错误判断 -->
<!-- 设备视图 -->
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视图 -->
2020-11-13 18:31:48 +08:00
<el-button v-if="cctvShow && !isContest && project !== 'bjd'" size="small" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
2020-11-04 10:34:33 +08:00
<!-- 客流规划视图 -->
2020-11-13 18:31:48 +08:00
<el-button v-if="trafficplanShow && !isContest" size="small" @click="jumpjl3dtrafficplan">{{ jl3dtrafficplan }}</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-18 16:02:22 +08:00
<!-- <el-button v-if="isContest" size="small" @click=" fieldTeach">实操教学</el-button> -->
<!-- <el-button v-if="isContest" size="small" @click=" fieldExam">实操测验</el-button> -->
2020-09-17 09:50:52 +08:00
<el-button v-if="isContest" size="small" @click="goTheoryQuiz">理论考试</el-button>
2020-08-28 10:59:44 +08:00
<el-button v-if="isContest" size="small" @click="viewChangeMap">切换地图</el-button>
2020-11-16 19:26:23 +08:00
<el-button size="small" @click="messageBoardShow">留言板</el-button>
2020-11-13 13:31:44 +08:00
<template v-if="project === 'bjd'">
<el-button v-if="running" size="small" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- 运行图加载 -->
<el-button size="small" @click="distribute">权限分发</el-button>
</template>
2020-08-20 20:27:19 +08:00
</el-button-group>
</div>
<Jl3d-Device
v-if="deviceShow"
ref="Jl3dDevice"
:panel-show="deviceShow"
@closedevice3dview="jumpjlmap3dmodel"
/>
2020-11-13 13:31:44 +08:00
<distribute-draft ref="distribute" @QrCodeShow="QrCodeShow" />
2020-08-20 20:27:19 +08:00
<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" />
2020-08-27 11:33:37 +08:00
<change-map v-if="isContest" ref="changeMap" @changeMap="changeMap" />
2020-11-13 13:31:44 +08:00
<qr-code ref="qrCode" />
2020-11-16 19:26:23 +08:00
<message-board ref="messageBoard" />
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';
2020-08-27 14:02:27 +08:00
import ChangeMap from './dispatherContest/changeMap';
2020-08-20 20:27:19 +08:00
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';
2020-11-13 13:31:44 +08:00
import DistributeDraft from '@/views/components/limits/distribute';
import QrCode from '@/components/QrCode';
2020-11-16 19:26:23 +08:00
import MessageBoard from './demon/messageBoard';
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,
2020-11-13 13:31:44 +08:00
ChangeMap,
DistributeDraft,
2020-11-16 19:26:23 +08:00
QrCode,
MessageBoard
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-08-20 20:27:19 +08:00
deviceShow: false,
drivingShow: 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')
};
},
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;
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;
});
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.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,
lineCode:this.lineCode
2020-08-20 20:27:19 +08:00
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
2020-11-04 10:34:33 +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');
},
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
}
});
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();
}
2020-08-27 11:33:37 +08:00
},
viewChangeMap() {
this.$refs.changeMap.doShow();
},
changeMap(query) {
this.$emit('changeMap', query);
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
},
2020-11-13 13:31:44 +08:00
viewRunPlan() {
const routeData = this.$router.resolve({
path:'/planSchedule/window',
query:{
mapId:this.$route.query.mapId,
group:this.$route.query.group,
lineCode: this.$route.query.lineCode,
project: this.$route.query.project,
noPreLogout: true,
initTime: this.$store.state.training.initTime
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
loadRunPlan() {
this.$emit('runPlanLoadShow');
},
2020-09-17 09:50:52 +08:00
goTheoryQuiz() {
this.$emit('goTheoryQuiz');
2020-11-13 13:31:44 +08:00
},
QrCodeShow(data) {
if (this.$refs && data) {
this.$refs.qrCode.doShow(data);
}
},
distribute() {
if (this.$refs) {
this.$refs.distribute.doShow({PermissionType:'03', mapId: this.$route.query.mapId, prdType: this.$route.query.prdType});
}
2020-11-16 19:26:23 +08:00
},
messageBoardShow() {
this.$refs.messageBoard.doShow();
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>