2020-01-06 18:39:44 +08:00
|
|
|
<template>
|
|
|
|
<div class="main" :style="{width: canvasWidth+'px'}" @mousemove="mousemove">
|
|
|
|
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
|
2020-05-21 16:59:36 +08:00
|
|
|
<Jl3d-Maintainer v-if="jl3dmaintainershow" @back="back" />
|
2020-01-06 18:39:44 +08:00
|
|
|
<ibp-plate v-show="ibpShow" ref="ibpPlate" @hideIbp="hideIbp" />
|
|
|
|
<div v-show="panelShow" :panelShow="panelShow">
|
|
|
|
<transition name="el-zoom-in-bottom">
|
|
|
|
<map-system-draft ref="mapCanvas" @back="back" />
|
|
|
|
</transition>
|
2020-06-05 09:38:14 +08:00
|
|
|
<menu-demon-joint
|
|
|
|
ref="demonMenu"
|
|
|
|
:group="group"
|
|
|
|
:data-error="dataError"
|
|
|
|
:user-role="userRole"
|
|
|
|
:device-code="deviceCode"
|
|
|
|
:countdown-time="countdownTime"
|
|
|
|
@getUserRole="getUserRole"
|
2020-06-28 14:27:28 +08:00
|
|
|
@showMembers="showMembers"
|
2020-06-05 09:38:14 +08:00
|
|
|
@hidepanel="hidepanel"
|
|
|
|
@showIbp="showIbp"
|
|
|
|
@startCounting="startCounting"
|
2020-06-08 18:26:30 +08:00
|
|
|
@hidejl3dcctv="hidejl3dcctv"
|
2020-06-05 09:38:14 +08:00
|
|
|
/>
|
2020-01-06 18:39:44 +08:00
|
|
|
<menu-demon-schema
|
|
|
|
ref="menuSchema"
|
|
|
|
:group="group"
|
|
|
|
:offset="offset"
|
|
|
|
:user-role="userRole"
|
2020-03-25 15:22:52 +08:00
|
|
|
:show-station="showStation"
|
|
|
|
:station-list="stationList"
|
|
|
|
:show-select-station="showSelectStation"
|
2020-05-09 20:24:59 +08:00
|
|
|
:data-error="dataError"
|
2020-01-06 18:39:44 +08:00
|
|
|
@runPlanLoadShow="runPlanLoadShow"
|
|
|
|
@runPlanViewShow="runPlanViewShow"
|
|
|
|
@faultChooseShow="faultChooseShow"
|
2020-03-25 15:22:52 +08:00
|
|
|
@switchStationMode="switchStationMode"
|
2020-01-06 18:39:44 +08:00
|
|
|
/>
|
|
|
|
<join-fault-choose ref="faultChoose" :group="group" />
|
|
|
|
<join-run-plan-Load ref="runPlanLoad" :group="group" />
|
|
|
|
<join-run-plan-view ref="runPlanView" :group="group" />
|
|
|
|
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" :right="right" />
|
2020-05-19 14:47:47 +08:00
|
|
|
<menu-train-list v-if="prdType=='02'" @setCenter="setCenter" />
|
2020-06-05 09:38:14 +08:00
|
|
|
<js-question v-if="project==='jsxt'" :offset="offset" :question-list="questionList" />
|
2020-06-28 14:27:28 +08:00
|
|
|
<members-manage ref="membersManage" />
|
2020-01-06 18:39:44 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-03-17 14:54:03 +08:00
|
|
|
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
|
2020-01-06 18:39:44 +08:00
|
|
|
import MenuDemonJoint from './menuDemon';
|
|
|
|
import MenuDemonSchema from './menuSchema';
|
2020-06-28 14:27:28 +08:00
|
|
|
import MembersManage from './membersManage';
|
2020-06-05 09:38:14 +08:00
|
|
|
import JsQuestion from './jsQuestion';
|
2020-03-17 14:54:03 +08:00
|
|
|
import JoinFaultChoose from '@/views/newMap/displayNew/demon/faultChoose';
|
|
|
|
import JoinRunPlanLoad from '@/views/newMap/displayNew/demon/runPlanLoad';
|
|
|
|
import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
|
|
|
|
import menuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
|
2020-03-16 14:47:59 +08:00
|
|
|
import IbpPlate from '@/views/ibp/ibpsystem/index';
|
2020-05-19 14:47:47 +08:00
|
|
|
import MenuTrainList from './menuTrainList';
|
2020-01-06 18:39:44 +08:00
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
|
|
|
|
import { checkLoginLine } from '@/api/login';
|
2020-03-17 14:54:03 +08:00
|
|
|
import { loadNewMapDataByGroup } from '@/utils/loaddata';
|
2020-03-16 15:29:26 +08:00
|
|
|
import { getUserRolesNew, deljointTrainRoomNew} from '@/api/jointTraining';
|
2020-03-17 14:54:03 +08:00
|
|
|
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
|
2020-06-05 09:38:14 +08:00
|
|
|
import {getRaceUserById, getTestPaperDatail} from '@/api/competition';
|
2020-05-25 13:40:25 +08:00
|
|
|
import { getSessionStorage } from '@/utils/auth';
|
2020-01-06 18:39:44 +08:00
|
|
|
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
|
2020-05-19 16:49:56 +08:00
|
|
|
import Jl3dMaintainer from '@/views/jlmap3d/maintainer/jl3dmaintainer';
|
2020-01-06 18:39:44 +08:00
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
|
|
|
import ibpData from '@/ibp/constant/ibpData';
|
2020-03-17 14:54:03 +08:00
|
|
|
import { timeFormat } from '@/utils/date';
|
2020-01-06 18:39:44 +08:00
|
|
|
import { Message } from 'element-ui';
|
2020-05-19 13:41:48 +08:00
|
|
|
import Vue from 'vue';
|
2020-06-05 09:38:14 +08:00
|
|
|
import localStore from 'storejs';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'JointTrainingDraft',
|
|
|
|
components: {
|
|
|
|
MapSystemDraft,
|
|
|
|
MenuDemonJoint,
|
|
|
|
MenuDemonSchema,
|
|
|
|
JoinFaultChoose,
|
|
|
|
JoinRunPlanLoad,
|
|
|
|
JoinRunPlanView,
|
2020-05-19 14:47:47 +08:00
|
|
|
MenuTrainList,
|
2020-01-06 18:39:44 +08:00
|
|
|
menuSystemTime,
|
|
|
|
Jl3dDrive,
|
2020-05-19 16:49:56 +08:00
|
|
|
Jl3dMaintainer,
|
2020-06-05 09:38:14 +08:00
|
|
|
IbpPlate,
|
2020-06-28 14:27:28 +08:00
|
|
|
JsQuestion,
|
|
|
|
MembersManage
|
2020-01-06 18:39:44 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
trainingObj: {},
|
|
|
|
checkLine: null,
|
|
|
|
timeDemonNum: 0,
|
|
|
|
offset: 10,
|
|
|
|
mouseNum: 1,
|
|
|
|
ierval: null,
|
|
|
|
mouseNumTime: 0,
|
|
|
|
mapBoxP: null,
|
|
|
|
userRole: '',
|
|
|
|
deviceCode: '',
|
|
|
|
group: '',
|
|
|
|
mapId: '',
|
|
|
|
lineCode: '',
|
|
|
|
simulationShow: false,
|
|
|
|
drivingShow: false,
|
2020-05-19 16:49:56 +08:00
|
|
|
jl3dmaintainershow:false,
|
2020-01-06 18:39:44 +08:00
|
|
|
ibpShow: false,
|
|
|
|
panelShow: true,
|
2020-03-25 15:22:52 +08:00
|
|
|
ibpPart: '',
|
|
|
|
showStation: '',
|
2020-04-21 11:26:07 +08:00
|
|
|
stationList: [],
|
2020-03-25 15:22:52 +08:00
|
|
|
showSelectStation: false,
|
2020-05-09 20:24:59 +08:00
|
|
|
mapViewLoadedOver: false,
|
2020-06-05 09:38:14 +08:00
|
|
|
dataError: false,
|
|
|
|
countdownTime: '00:00:00',
|
|
|
|
practicalTime: 0,
|
|
|
|
countdown: null,
|
2020-06-05 14:46:37 +08:00
|
|
|
questionList: [],
|
|
|
|
practicalExamTime: 0
|
2020-01-06 18:39:44 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'canvasWidth',
|
|
|
|
'canvasHeight'
|
|
|
|
]),
|
|
|
|
...mapGetters('map', [
|
2020-06-10 16:56:52 +08:00
|
|
|
'map',
|
|
|
|
'bigScreenSplitConfig'
|
|
|
|
|
2020-01-06 18:39:44 +08:00
|
|
|
]),
|
|
|
|
...mapGetters('training', [
|
|
|
|
'offsetStationCode'
|
|
|
|
]),
|
|
|
|
...mapGetters('config', [
|
|
|
|
'canvasId'
|
|
|
|
]),
|
|
|
|
width() {
|
|
|
|
return this.$store.state.app.width;
|
|
|
|
},
|
|
|
|
height() {
|
|
|
|
return this.$store.state.app.height;
|
|
|
|
},
|
|
|
|
right() {
|
|
|
|
return this.$store.state.config.width / 2 - 55;
|
|
|
|
},
|
|
|
|
userId() {
|
|
|
|
return this.$store.state.user ? this.$store.state.user.id : '';
|
2020-05-19 14:47:47 +08:00
|
|
|
},
|
|
|
|
prdType() {
|
|
|
|
return this.$store.state.training.prdType;
|
2020-05-25 13:40:25 +08:00
|
|
|
},
|
|
|
|
project() {
|
|
|
|
return getSessionStorage('project');
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.config.menuBarLoadedCount': function (val) {
|
|
|
|
this.setPosition();
|
|
|
|
},
|
2020-03-20 17:56:20 +08:00
|
|
|
'$store.state.training.prdType': function (val) {
|
|
|
|
this.setPosition();
|
2020-03-25 15:22:52 +08:00
|
|
|
if (val === '01' && this.$route.query.lineCode === '06') {
|
|
|
|
this.showSelectStation = true;
|
2020-05-19 13:41:48 +08:00
|
|
|
this.mapViewLoadedOver && this.setShowStation(this.showStation);
|
2020-06-10 16:56:52 +08:00
|
|
|
this.cancelBigScreenMode();
|
2020-03-25 15:22:52 +08:00
|
|
|
} else if (val === '02' && this.$route.query.lineCode === '06') {
|
|
|
|
this.showSelectStation = false;
|
2020-05-19 13:41:48 +08:00
|
|
|
this.mapViewLoadedOver && this.setShowStation('');
|
2020-06-10 16:56:52 +08:00
|
|
|
this.cancelBigScreenMode();
|
|
|
|
} else if (val === '07') { // 大屏
|
|
|
|
this.setBigScreenMode();
|
|
|
|
} else {
|
|
|
|
this.cancelBigScreenMode();
|
2020-03-25 15:22:52 +08:00
|
|
|
}
|
2020-03-20 17:56:20 +08:00
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
'$store.state.map.mapViewLoadedCount': function (val) {
|
|
|
|
this.mapBoxP = document.getElementById(this.canvasId).children[0];
|
2020-04-29 14:05:50 +08:00
|
|
|
this.mapBoxP.style.cursor = '';
|
2020-03-25 15:22:52 +08:00
|
|
|
this.mapViewLoadedOver = true;
|
2020-05-19 13:41:48 +08:00
|
|
|
this.showSelectStation && this.setShowStation(this.showStation);
|
2020-01-06 18:39:44 +08:00
|
|
|
},
|
|
|
|
'$store.state.socket.permissionOver': function () {
|
|
|
|
this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
showClose: false,
|
|
|
|
callback: async (action) => {
|
|
|
|
await this.$store.dispatch('training/over');
|
2020-03-17 14:54:03 +08:00
|
|
|
await clearSimulation(this.group);
|
2020-03-16 15:29:26 +08:00
|
|
|
await deljointTrainRoomNew(this.group);
|
2020-01-06 18:39:44 +08:00
|
|
|
this.$router.go(-1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'$store.state.socket.jointRoomInfo': function (val) { // 综合演练房间信息
|
|
|
|
if (val.creatorId) {
|
|
|
|
this.handleRoomInfo(val);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'$store.state.socket.roleList': function (val) { // 综合演练被踢出房间
|
|
|
|
val.forEach(elem => {
|
|
|
|
if (elem.id == this.userId && !elem.userRole) {
|
|
|
|
this.$router.go(-1);
|
|
|
|
this.messageInfo(this.$t('tip.beKickedOut'), 'warning');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'$store.state.app.windowSizeCount': function() {
|
|
|
|
this.setWindowSize();
|
|
|
|
},
|
|
|
|
$route() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.initLoadData();
|
|
|
|
});
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
'$store.state.map.map': function (val) {
|
|
|
|
this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01';
|
|
|
|
this.setStationList(val);
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async created() {
|
|
|
|
this.group = this.$route.query.group;
|
|
|
|
this.mapId = this.$route.query.mapId;
|
|
|
|
this.lineCode = this.$route.query.lineCode;
|
2020-05-13 13:14:58 +08:00
|
|
|
this.drawWay = this.$route.query.drawWay;
|
2020-01-06 18:39:44 +08:00
|
|
|
Message.closeAll();
|
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
await this.setWindowSize();
|
|
|
|
await this.initLoadData();
|
|
|
|
},
|
|
|
|
async beforeDestroy() {
|
|
|
|
await this.clearAllTimer();
|
|
|
|
await this.$store.dispatch('training/end', null);
|
|
|
|
await this.$store.dispatch('training/reset');
|
|
|
|
await this.$store.dispatch('map/mapClear');
|
|
|
|
await this.$store.dispatch('training/setGroup', '');
|
2020-06-05 09:38:14 +08:00
|
|
|
if (this.countdown) {
|
|
|
|
clearInterval(this.countdown);
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
Message.closeAll();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
mousemove(e) {
|
|
|
|
this.mouseNum = 1;
|
|
|
|
},
|
|
|
|
handleRoomInfo(data) {
|
|
|
|
if (data.state == '03') { // 退出房间
|
|
|
|
this.$router.go(-1);
|
|
|
|
} else if (data.state == '01') { // 进入准备中
|
2020-05-13 13:14:58 +08:00
|
|
|
const query = { group: this.group, lineCode:this.lineCode };
|
|
|
|
if (this.drawWay) {
|
|
|
|
query.drawWay = this.drawWay;
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
this.$router.replace({ path: `/trainroom`, query: query });
|
|
|
|
}
|
|
|
|
this.$store.dispatch('socket/setJointRoomInfo'); // 清空房间信息
|
|
|
|
},
|
|
|
|
// 清除检查在线定时器
|
|
|
|
clearAllTimer() {
|
|
|
|
if (this.ierval) {
|
|
|
|
clearTimeout(this.ierval);
|
|
|
|
this.ierval = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.checkLine) {
|
|
|
|
clearTimeout(this.checkLine);
|
|
|
|
this.checkLine = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 设置检查在线定时器
|
|
|
|
checkLoginLineTimer() {
|
|
|
|
if (this.checkLine) {
|
|
|
|
clearTimeout(this.checkLine);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.checkLine = setInterval(() => {
|
|
|
|
checkLoginLine();
|
|
|
|
}, 5000 * 60);
|
|
|
|
},
|
|
|
|
// 设置手标显示状态
|
|
|
|
checkMouseStatusTimer() {
|
|
|
|
if (this.ierval) {
|
|
|
|
clearTimeout(this.ierval);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.ierval = setInterval(() => {
|
|
|
|
if (this.mouseNum) {
|
|
|
|
this.mouseNum = 0;
|
|
|
|
this.mouseNumTime = 0;
|
2020-04-29 14:05:50 +08:00
|
|
|
if (this.mapBoxP) {
|
|
|
|
this.mapBoxP.style.cursor = this.mapBoxP.style.cursor != 'none' ? this.mapBoxP.style.cursor : '';
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
} else {
|
|
|
|
this.mouseNumTime += 1;
|
|
|
|
}
|
2020-04-29 14:05:50 +08:00
|
|
|
if (this.mapBoxP) {
|
|
|
|
if (this.mouseNumTime >= 12) {
|
|
|
|
this.mapBoxP.style.cursor = 'none';
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 1000);
|
|
|
|
},
|
|
|
|
// 设置菜单和工具栏位置
|
|
|
|
setPosition() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
let offset = 10;
|
|
|
|
const menuBar = document.getElementById('menuBar');
|
|
|
|
const menuTool = document.getElementById('menuTool');
|
|
|
|
if (menuBar) {
|
|
|
|
offset += (menuBar.offsetHeight || 0);
|
|
|
|
}
|
|
|
|
if (menuTool) {
|
|
|
|
offset += (menuTool.offsetHeight || 0);
|
|
|
|
}
|
2020-06-10 16:56:52 +08:00
|
|
|
if (this.$store.state.training.prdType === '07') {
|
|
|
|
offset = 10;
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
if (this.offset != offset) {
|
|
|
|
this.offset = offset;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 结束加载状态
|
|
|
|
endViewLoading(isSuccess) {
|
|
|
|
if (!isSuccess) {
|
|
|
|
this.$store.dispatch('map/mapClear');
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
EventBus.$emit('viewLoading', false);
|
|
|
|
});
|
|
|
|
},
|
2020-05-19 14:47:47 +08:00
|
|
|
setCenter(code) {
|
|
|
|
this.$refs.mapCanvas.setCenter(code);
|
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
// 加载地图数据
|
|
|
|
initLoadData() {
|
|
|
|
const width = document.documentElement.clientWidth;
|
|
|
|
const height = document.documentElement.clientHeight + 200;
|
|
|
|
this.$store.dispatch('config/resize', { width, height });
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.loadSimulationInfo();
|
|
|
|
this.initLoadDemonData();
|
|
|
|
this.checkLoginLineTimer();
|
|
|
|
this.checkMouseStatusTimer();
|
|
|
|
} catch (error) {
|
|
|
|
this.$messageBox( this.$t('error.initializationFailed') + error.message);
|
|
|
|
this.endViewLoading();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async loadSimulationInfo() {
|
2020-03-17 14:54:03 +08:00
|
|
|
const resp = await getSimulationInfoNew(this.group);
|
2020-05-09 19:35:56 +08:00
|
|
|
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
|
2020-01-06 18:39:44 +08:00
|
|
|
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
|
|
|
|
this.questId = Number(resp.data.questId) || 0;
|
2020-05-25 10:32:14 +08:00
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
|
2020-05-19 17:05:23 +08:00
|
|
|
this.$store.dispatch('map/setRunPlanStatus', resp.data.planRunning);
|
2020-03-17 14:54:03 +08:00
|
|
|
if (resp.data.planRunning) {
|
|
|
|
this.$store.dispatch('training/simulationStart');
|
|
|
|
} else {
|
|
|
|
this.$store.dispatch('training/over');
|
|
|
|
}
|
2020-05-19 14:47:47 +08:00
|
|
|
// if (this.isDemon) {
|
|
|
|
// this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
|
|
|
|
// } else if (this.isScript) {
|
|
|
|
// this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
|
|
|
|
// }
|
2020-05-09 19:35:56 +08:00
|
|
|
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
|
|
|
|
this.dataError = true;
|
2020-05-09 20:24:59 +08:00
|
|
|
this.$messageBox('此地图数据正在维护中,无法运行!');
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async getUserRole() {
|
2020-06-24 18:40:48 +08:00
|
|
|
// const res = await getUserRolesNew(this.group);
|
|
|
|
// const data = res.data || {};
|
|
|
|
// this.userRole = data.userRole;
|
|
|
|
// this.deviceCode = data.deviceCode;
|
|
|
|
// this.ibpPart = data.ibpPart;
|
|
|
|
// if (this.userRole === 'IBP') {
|
|
|
|
// this.showIbp(this.deviceCode);
|
|
|
|
// } else {
|
|
|
|
// this.hideIbp();
|
|
|
|
// }
|
|
|
|
// return res;
|
|
|
|
return '';
|
2020-01-06 18:39:44 +08:00
|
|
|
},
|
|
|
|
// 仿真系统
|
|
|
|
async initLoadDemonData() {
|
|
|
|
this.$store.dispatch('training/end', TrainingMode.NORMAL);
|
|
|
|
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // 默认为正常模式
|
|
|
|
|
|
|
|
if (this.lineCode) {
|
|
|
|
// 01 现地 02 行调 '' 观众
|
2020-05-25 16:38:03 +08:00
|
|
|
let resp = {data: {}};
|
2020-05-25 13:40:25 +08:00
|
|
|
if (this.project == 'jsxt' ) {
|
2020-05-25 18:26:05 +08:00
|
|
|
resp = await getRaceUserById(this.$route.query.raceId);
|
2020-05-25 13:40:25 +08:00
|
|
|
resp.data.userRole = resp.data.role;
|
2020-06-05 09:38:14 +08:00
|
|
|
const paperResp = await getTestPaperDatail(this.$route.query.raceId);
|
|
|
|
if (paperResp.data && paperResp.data.practicalQuestions) {
|
|
|
|
this.questionList = [];
|
2020-06-05 14:46:37 +08:00
|
|
|
this.practicalExamTime = paperResp.data.practicalExamTime;
|
2020-06-05 09:38:14 +08:00
|
|
|
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
|
|
|
|
const startTime = localStore.get(storeKey);
|
|
|
|
if (startTime) {
|
|
|
|
const dt = new Date().getTime() - startTime;
|
|
|
|
this.practicalTime = paperResp.data.practicalExamTime * 60 - Math.floor(dt / 1000);
|
|
|
|
} else {
|
2020-06-05 14:46:37 +08:00
|
|
|
this.practicalTime = this.practicalExamTime * 60;
|
2020-06-05 09:38:14 +08:00
|
|
|
}
|
|
|
|
this.countdownTime = this.computationTime(this.practicalTime);
|
|
|
|
paperResp.data.practicalQuestions.forEach(elem => {
|
|
|
|
this.questionList.push({name: elem.question.name, description:elem.question.description});
|
|
|
|
});
|
|
|
|
}
|
2020-05-25 13:40:25 +08:00
|
|
|
} else if (this.project == 'refereeJsxt') {
|
2020-05-25 16:38:03 +08:00
|
|
|
resp['code'] = 200;
|
|
|
|
resp.data['userRole'] = 'ADMIN';
|
2020-05-25 13:40:25 +08:00
|
|
|
} else {
|
|
|
|
resp = await this.getUserRole();
|
|
|
|
}
|
2020-05-25 16:38:03 +08:00
|
|
|
// console.log('/////////////' + resp.data.userRole);
|
2020-01-06 18:39:44 +08:00
|
|
|
if (resp && resp.code == 200) {
|
2020-03-17 18:44:49 +08:00
|
|
|
// Admin 管理员 Instructor 教员 Dispatcher 行调 STATION_SUPERVISOR 车站 Audience 观众 Driver 司机 MAINTAINER 通号 IBP:IBP盘
|
2020-01-06 18:39:44 +08:00
|
|
|
this.userRole = resp.data.userRole;
|
|
|
|
switch (this.userRole) {
|
2020-03-17 14:54:03 +08:00
|
|
|
case 'ADMIN': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'ADMIN'); this.hideIbp(); break;
|
|
|
|
case 'INSTRUCTOR': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR'); this.hideIbp(); break;
|
|
|
|
case 'DISPATCHER': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER'); this.hideIbp(); break;
|
|
|
|
case 'STATION_SUPERVISOR': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR'); this.hideIbp(); break;
|
2020-04-16 15:52:56 +08:00
|
|
|
case 'INTERLOCK': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'INTERLOCK'); this.hideIbp(); break;
|
2020-03-17 14:54:03 +08:00
|
|
|
case 'AUDIENCE': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.hideIbp(); break;
|
|
|
|
case 'DRIVER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER'); this.hideIbp(); break;
|
2020-03-17 18:44:49 +08:00
|
|
|
case 'MAINTAINER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER'); this.hideIbp(); break;
|
2020-01-06 18:39:44 +08:00
|
|
|
case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break;
|
2020-03-17 14:54:03 +08:00
|
|
|
case 'BIGSCREEN': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN'); this.hideIbp(); break;
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
await this.getTrainDetail();
|
|
|
|
} else {
|
|
|
|
this.endViewLoading();
|
|
|
|
}
|
|
|
|
},
|
2020-06-05 09:38:14 +08:00
|
|
|
startCounting() {
|
2020-06-05 14:46:37 +08:00
|
|
|
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
|
|
|
|
const startTime = localStore.get(storeKey);
|
|
|
|
if (!startTime) {
|
|
|
|
const storeValue = new Date().getTime();
|
|
|
|
localStore.set(storeKey, storeValue);
|
|
|
|
}
|
2020-06-05 09:38:14 +08:00
|
|
|
this.countdown = setInterval(() => {
|
|
|
|
if (this.practicalTime <= 0) {
|
|
|
|
if (this.countdown) {
|
|
|
|
clearInterval(this.countdown);
|
|
|
|
}
|
|
|
|
this.$refs.demonMenu.submit();
|
|
|
|
}
|
|
|
|
this.practicalTime--;
|
|
|
|
this.countdownTime = this.computationTime(this.practicalTime);
|
|
|
|
}, 1000);
|
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
async getTrainDetail() {
|
|
|
|
try {
|
2020-03-17 14:54:03 +08:00
|
|
|
await loadNewMapDataByGroup(this.group);
|
2020-01-06 18:39:44 +08:00
|
|
|
await this.$store.dispatch('training/setMapDefaultState');
|
2020-05-21 16:59:36 +08:00
|
|
|
if (this.userRole == 'MAINTAINER') {
|
|
|
|
this.jl3dmaintainershow = true;
|
2020-05-19 16:49:56 +08:00
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
} catch (error) {
|
|
|
|
this.$messageBox(this.$t('error.getMapDataFailed'));
|
|
|
|
this.endViewLoading();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
back() {
|
|
|
|
this.$refs.demonMenu.back();
|
|
|
|
},
|
|
|
|
runPlanViewShow() {
|
|
|
|
this.$refs.runPlanView.doShow();
|
|
|
|
},
|
|
|
|
runPlanLoadShow() {
|
|
|
|
this.$refs.runPlanLoad.doShow();
|
|
|
|
},
|
|
|
|
faultChooseShow() {
|
|
|
|
this.$refs.faultChoose.doShow();
|
|
|
|
},
|
2020-06-05 09:38:14 +08:00
|
|
|
computationTime(time) {
|
|
|
|
let hours = Math.floor(time / 3600);
|
|
|
|
const newTime = time % 3600;
|
|
|
|
let minutes = Math.floor(newTime / 60) + '';
|
|
|
|
let seconds = newTime % 60;
|
|
|
|
if (hours < 0) {
|
|
|
|
hours = '00';
|
|
|
|
} else if (hours < 10) {
|
|
|
|
hours = '0' + hours;
|
|
|
|
}
|
|
|
|
if (minutes < 0) {
|
|
|
|
minutes = '00';
|
|
|
|
} else if (minutes < 10) {
|
|
|
|
minutes = '0' + minutes;
|
|
|
|
}
|
|
|
|
if (seconds < 0) {
|
|
|
|
seconds = '00';
|
|
|
|
} else if (seconds < 10) {
|
|
|
|
seconds = '0' + seconds;
|
|
|
|
}
|
|
|
|
return hours + ':' + minutes + ':' + seconds;
|
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
showdriving() {
|
|
|
|
this.panelShow = true;
|
|
|
|
this.drivingShow = false;
|
|
|
|
this.ibpShow = false;
|
|
|
|
},
|
|
|
|
showIbp(deviceCode) {
|
|
|
|
if (!this.ibpShow) {
|
|
|
|
this.drivingShow = false;
|
|
|
|
this.panelShow = false;
|
|
|
|
this.ibpShow = true;
|
|
|
|
if (!deviceCode || !ibpData[deviceCode]) {
|
|
|
|
Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'});
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
Message.closeAll();
|
|
|
|
}
|
|
|
|
this.$refs.ibpPlate.show(deviceCode, this.ibpPart);
|
|
|
|
}
|
|
|
|
},
|
2020-06-10 16:56:52 +08:00
|
|
|
hidejl3dcctv() {
|
|
|
|
const routeData = this.$router.resolve({
|
|
|
|
path:'/jlmap3d/passengerflow',
|
|
|
|
query:{
|
|
|
|
mapid:this.mapId,
|
|
|
|
group:this.group,
|
|
|
|
project: this.project
|
|
|
|
}
|
|
|
|
});
|
|
|
|
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
2020-06-08 18:22:12 +08:00
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
hidepanel() {
|
|
|
|
this.panelShow = false;
|
|
|
|
this.drivingShow = true;
|
|
|
|
this.ibpShow = false;
|
|
|
|
this.$refs.Jl3dDrive.show(this.mapId, this.group);
|
|
|
|
},
|
2020-06-08 18:22:12 +08:00
|
|
|
|
2020-01-06 18:39:44 +08:00
|
|
|
hideIbp() {
|
|
|
|
Message.closeAll();
|
|
|
|
this.drivingShow = false;
|
|
|
|
this.panelShow = true;
|
|
|
|
this.ibpShow = false;
|
|
|
|
if (this.$refs && this.$refs.ibpPlate) {
|
|
|
|
this.$refs.ibpPlate.ibpDestroy();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
messageInfo(message, type) {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
message: message,
|
|
|
|
type: type
|
|
|
|
});
|
|
|
|
},
|
|
|
|
setWindowSize() {
|
|
|
|
this.$nextTick(() => {
|
2020-06-10 17:59:51 +08:00
|
|
|
if (this.prdType == '07') {
|
|
|
|
const width = this.$store.state.app.width - 2;
|
|
|
|
const height = this.$store.state.app.height;
|
|
|
|
this.$store.dispatch('config/resize', { width, height });
|
|
|
|
this.setBigScreenMode();
|
|
|
|
} else {
|
|
|
|
this.$store.dispatch('config/resize', { width: this.width, height: this.height });
|
|
|
|
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
});
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
switchStationMode(val) {
|
|
|
|
this.showStation = val;
|
2020-05-19 13:41:48 +08:00
|
|
|
this.setShowStation(this.showStation);
|
|
|
|
},
|
|
|
|
setShowStation(val) {
|
|
|
|
const nameList = Object.keys(this.$store.state.map.map);
|
|
|
|
let list = [];
|
|
|
|
nameList.forEach(item => {
|
|
|
|
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
|
|
|
|
list = [...list, ...this.$store.state.map.map[item]];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Vue.prototype.$jlmap.updateShowStation(list, val);
|
|
|
|
Vue.prototype.$jlmap.setCenter(val);
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
setStationList(val) {
|
|
|
|
this.stationList = [];
|
|
|
|
(val.stationList || []).forEach(item => {
|
|
|
|
if (item.centralized) {
|
|
|
|
this.stationList.push({value: item.code, name: item.name});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (this.stationList.length) {
|
|
|
|
this.showStation = this.stationList[0].value;
|
|
|
|
}
|
2020-06-10 16:56:52 +08:00
|
|
|
},
|
|
|
|
setBigScreenMode() {
|
|
|
|
if (this.bigScreenSplitConfig.length) {
|
|
|
|
const size = {
|
|
|
|
width: this.$store.state.app.width - 2,
|
|
|
|
height: this.$store.state.app.height - 60,
|
|
|
|
offsetY: 60,
|
|
|
|
list: this.bigScreenSplitConfig.map(ele => ele.position)
|
|
|
|
};
|
|
|
|
this.$jlmap.off('zoom');
|
|
|
|
this.$jlmap.off('pan');
|
|
|
|
this.$jlmap.setUpdateScreen(size);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cancelBigScreenMode() {
|
|
|
|
this.$jlmap.on('zoom');
|
|
|
|
this.$jlmap.on('pan');
|
|
|
|
this.$jlmap.setRevoverBigScreen();
|
2020-06-28 14:27:28 +08:00
|
|
|
},
|
|
|
|
showMembers() {
|
|
|
|
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.main {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
</style>
|