2020-01-06 18:39:44 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
2020-04-23 17:13:11 +08:00
|
|
|
|
<chat-box :group="group" />
|
2020-03-20 17:56:20 +08:00
|
|
|
|
<div class="display-draft" :class="{'display-type-hb': $route.query.lineCode == '07' && $store.state.training.prdType=='01'}">
|
2020-01-06 18:39:44 +08:00
|
|
|
|
<el-button-group>
|
2020-05-09 20:24:59 +08:00
|
|
|
|
<el-button v-if="isProject && !dataError " type="primary" @click="setRelDevice">{{ $t('joinTraining.connectRealDevices') }}</el-button>
|
|
|
|
|
<el-button v-if="isDriver && !dataError" type="jumpjlmap3d" @click="jumpjlmap3d">{{ $t('joinTraining.driverPerspective') }}</el-button>
|
2020-01-06 18:39:44 +08:00
|
|
|
|
<template v-if="isAdmin">
|
2020-05-09 20:24:59 +08:00
|
|
|
|
<el-button type="success" :disabled="isDisable || dataError" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button>
|
2020-01-06 18:39:44 +08:00
|
|
|
|
<el-button type="danger" :disabled="!isDisable" @click="end">{{ $t('joinTraining.exitPlan') }}</el-button>
|
|
|
|
|
</template>
|
2020-05-25 10:45:56 +08:00
|
|
|
|
<el-button type="primary" :loading="backLoading" @click="back">{{ $t('global.back') }}</el-button>
|
2020-01-06 18:39:44 +08:00
|
|
|
|
</el-button-group>
|
|
|
|
|
</div>
|
|
|
|
|
<qr-code ref="qrCode" />
|
|
|
|
|
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
|
|
|
|
<real-device ref="realDevice" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import QrCode from '@/components/QrCode';
|
2020-04-23 17:13:11 +08:00
|
|
|
|
import ChatBox from './chatBox';
|
2020-03-17 14:54:03 +08:00
|
|
|
|
import SetTime from '@/views/newMap/displayNew/demon/setTime';
|
2020-03-23 16:00:28 +08:00
|
|
|
|
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
import { exitFullscreen } from '@/utils/screen';
|
2020-03-17 10:07:02 +08:00
|
|
|
|
import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
|
|
|
|
import { getSessionStorage } from '@/utils/auth';
|
|
|
|
|
import RealDevice from './menuDraft/realDevice';
|
2020-05-21 10:43:32 +08:00
|
|
|
|
import { prefixIntrger } from '@/utils/date';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'MenuDemonJoint',
|
|
|
|
|
components: {
|
2020-04-21 17:28:13 +08:00
|
|
|
|
// ChartView,
|
|
|
|
|
// ChartWindow,
|
2020-04-23 17:13:11 +08:00
|
|
|
|
ChatBox,
|
2020-01-06 18:39:44 +08:00
|
|
|
|
QrCode,
|
|
|
|
|
SetTime,
|
|
|
|
|
RealDevice
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
group: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
userRole: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
deviceCode: {
|
|
|
|
|
type: String,
|
|
|
|
|
default() {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2020-05-09 20:24:59 +08:00
|
|
|
|
},
|
|
|
|
|
dataError: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isDisable: false,
|
2020-04-21 17:28:13 +08:00
|
|
|
|
backLoading:false,
|
2020-01-06 18:39:44 +08:00
|
|
|
|
chatShow: true,
|
|
|
|
|
offset: 10,
|
|
|
|
|
userId: '',
|
|
|
|
|
stationList: [],
|
2020-05-25 10:45:56 +08:00
|
|
|
|
stationLists: []
|
2020-01-06 18:39:44 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
lineCode() {
|
|
|
|
|
return this.$route.query.lineCode;
|
|
|
|
|
},
|
|
|
|
|
isSpeaking() {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
return this.userRole != 'DRIVER' && this.userRole != '';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
},
|
|
|
|
|
isDriver() {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
return this.userRole == 'DRIVER';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
},
|
|
|
|
|
isAdmin() {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
return this.userRole == 'ADMIN';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
},
|
|
|
|
|
isProject() {
|
2020-04-16 15:52:56 +08:00
|
|
|
|
return getSessionStorage('project').endsWith('gzb') && this.userRole === 'CI';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
'$store.state.config.menuBarLoadedCount': function (val) {
|
|
|
|
|
this.setPosition();
|
|
|
|
|
},
|
|
|
|
|
'$store.state.map.map.stationList': function (val) { // 执行一次 以后不会有变化
|
|
|
|
|
if (val && val.length) {
|
|
|
|
|
this.stationList = val;
|
|
|
|
|
this.stationLists = val;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'$store.state.socket.roleList': function (val) {
|
|
|
|
|
if (val && val.length) {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.addrolesList(val);
|
|
|
|
|
this.$store.dispatch('config/updateMenuBar');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'$store.state.socket.simulationStart': async function (val) {
|
|
|
|
|
if (val) {
|
|
|
|
|
this.$store.dispatch('training/simulationStart', { start: true });
|
|
|
|
|
}
|
2020-05-19 17:05:23 +08:00
|
|
|
|
},
|
|
|
|
|
'$store.state.map.runPlanStatus': function (val) {
|
|
|
|
|
this.isDisable = val;
|
2020-05-21 10:43:32 +08:00
|
|
|
|
},
|
2020-05-22 09:32:48 +08:00
|
|
|
|
'$store.state.socket.simulationOver':function(val) {
|
|
|
|
|
if (val && this.project === 'refereeJsxt') {
|
|
|
|
|
this.$router.go(-1);
|
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async mounted() {
|
|
|
|
|
this.userId = this.$store.state.user.id;
|
2020-04-21 17:28:13 +08:00
|
|
|
|
this.backLoading = false;
|
2020-01-06 18:39:44 +08:00
|
|
|
|
await this.initLoadPage();
|
2020-05-19 17:05:23 +08:00
|
|
|
|
this.isDisable = this.$store.state.map.runPlanStatus;
|
2020-01-06 18:39:44 +08:00
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
this.$store.dispatch('training/setGroup', '');
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async initLoadPage() {
|
|
|
|
|
try {
|
2020-03-17 10:07:02 +08:00
|
|
|
|
// const resp = await runDiagramIsStart(this.group);
|
|
|
|
|
// if (resp && resp.data) {
|
|
|
|
|
// this.isDisable = true;
|
|
|
|
|
// this.$store.dispatch('training/simulationStart');
|
|
|
|
|
// } else {
|
|
|
|
|
// this.isDisable = false;
|
|
|
|
|
// this.$store.dispatch('training/over');
|
|
|
|
|
// }
|
2020-01-06 18:39:44 +08:00
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.offset != offset) {
|
|
|
|
|
this.offset = offset;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2020-03-17 18:44:49 +08:00
|
|
|
|
// 设置用户角色 Admin 管理员 Instructor 教员 Dispatcher 行调 Attendant 车站 Audience 观众 Driver 司机 MAINTAINER 通号
|
2020-01-06 18:39:44 +08:00
|
|
|
|
addrolesList(list) {
|
|
|
|
|
list.forEach(item => {
|
|
|
|
|
if (this.userId == item.id) {
|
|
|
|
|
switch (item.userRole) {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
case 'INSTRUCTOR':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
2020-03-17 14:54:03 +08:00
|
|
|
|
case 'DISPATCHER':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
2020-03-17 14:54:03 +08:00
|
|
|
|
case 'STATION_SUPERVISOR':
|
2020-01-06 18:39:44 +08:00
|
|
|
|
if (!item['deviceCode']) {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
2020-03-17 14:54:03 +08:00
|
|
|
|
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
2020-04-16 15:52:56 +08:00
|
|
|
|
case 'CI':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'CI');
|
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
2020-03-17 14:54:03 +08:00
|
|
|
|
case 'DRIVER':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
2020-03-17 18:44:49 +08:00
|
|
|
|
case 'MAINTAINER':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
|
|
|
|
case 'IBP':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP');
|
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
2020-03-17 14:54:03 +08:00
|
|
|
|
case 'BIGSCREEN':
|
|
|
|
|
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2020-03-17 14:54:03 +08:00
|
|
|
|
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE');
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$emit('getUserRole');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (this.$refs.chatView) {
|
|
|
|
|
this.$refs.chatView.getUserRole();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
selectBeginTime() {
|
|
|
|
|
this.$refs.setTime.doShow();
|
|
|
|
|
},
|
|
|
|
|
start(model) {
|
|
|
|
|
this.isDisable = true;
|
2020-01-17 11:31:53 +08:00
|
|
|
|
const data = {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
time: model.initTime
|
2020-01-17 11:31:53 +08:00
|
|
|
|
};
|
|
|
|
|
ranAsPlan(data, this.group).then(res => {
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$store.dispatch('training/simulationStart').then(() => {
|
2020-05-19 14:47:47 +08:00
|
|
|
|
this.$store.dispatch('map/setRunPlanStatus', true);
|
2020-05-25 10:32:14 +08:00
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
|
2020-01-06 18:39:44 +08:00
|
|
|
|
});
|
2020-01-17 11:31:53 +08:00
|
|
|
|
}).catch((error) => {
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.isDisable = false;
|
2020-01-17 13:17:12 +08:00
|
|
|
|
if (error.code == '5001') {
|
|
|
|
|
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '5002') {
|
|
|
|
|
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '5003') {
|
|
|
|
|
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
|
2020-02-28 11:25:36 +08:00
|
|
|
|
} else if (error.code == '5004') {
|
|
|
|
|
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '5000') {
|
|
|
|
|
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4000') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4001') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4002') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4003') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4004') {
|
|
|
|
|
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
|
2020-01-17 13:17:12 +08:00
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
end() {
|
|
|
|
|
this.isDisable = false;
|
|
|
|
|
EventBus.$emit('trainView');
|
2020-05-19 14:47:47 +08:00
|
|
|
|
exitRunPlan(this.group).then(()=>{
|
|
|
|
|
this.$store.dispatch('map/setRunPlanStatus', false);
|
|
|
|
|
}).catch(() => {
|
2020-01-06 18:39:44 +08:00
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
|
this.isDisable = true;
|
|
|
|
|
this.$messageBox(this.$t('error.endSimulationFailed'));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
back() {
|
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
2020-04-21 17:28:13 +08:00
|
|
|
|
this.backLoading = true;
|
2020-05-20 14:46:26 +08:00
|
|
|
|
putJointTrainingSimulationUserNew(this.group).then(() => {
|
|
|
|
|
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.lineCode, group: this.group, drawWay: true } });
|
|
|
|
|
exitFullscreen();
|
|
|
|
|
this.backLoading = false;
|
|
|
|
|
});
|
2020-01-06 18:39:44 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
jumpjlmap3d() {
|
|
|
|
|
this.$emit('hidepanel');
|
|
|
|
|
},
|
|
|
|
|
setRelDevice() {
|
|
|
|
|
this.$refs.realDevice.doShow();
|
2020-05-20 14:46:26 +08:00
|
|
|
|
},
|
2020-05-21 10:43:32 +08:00
|
|
|
|
formatTime(initTime) {
|
|
|
|
|
const hh = prefixIntrger(initTime.getHours(), 2);
|
|
|
|
|
const mm = prefixIntrger(initTime.getMinutes(), 2);
|
|
|
|
|
const ss = prefixIntrger(initTime.getSeconds(), 2);
|
|
|
|
|
return `${hh}:${mm}:${ss}`;
|
2020-01-06 18:39:44 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
.tabs-roles {
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
border-bottom: 1px solid #e4e7ed;
|
|
|
|
|
height: 40px;
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
-webkit-box-sizing: border-box;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
.roles {
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
height: 41px;
|
|
|
|
|
list-style: none;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #303133;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
border-left: 1px solid #e4e7ed;
|
|
|
|
|
border-right: 1px solid #e4e7ed;
|
|
|
|
|
float: left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.roles-first {
|
|
|
|
|
border-right: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.roles-active {
|
|
|
|
|
border-bottom-color: #fff;
|
|
|
|
|
color: #409EFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tabs-content {
|
|
|
|
|
height: 300px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.display-score {
|
|
|
|
|
background-color: black;
|
|
|
|
|
display: -moz-inline-box;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
text-align: left;
|
|
|
|
|
height: 32px;
|
|
|
|
|
line-height: 24px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
padding-left: 2px;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
font-family: "Microsoft" !important;
|
|
|
|
|
font-size: 18px !important;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.reminder-drag {
|
|
|
|
|
position: absolute;
|
|
|
|
|
float: left;
|
|
|
|
|
left: 10px;
|
|
|
|
|
bottom: 10px;
|
|
|
|
|
width: 500px;
|
|
|
|
|
height: 340px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
|
|
|
|
/deep/ {
|
|
|
|
|
.el-tabs__header {
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.title-bar {
|
|
|
|
|
height: 40px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
height: 300px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.display-draft {
|
|
|
|
|
position: absolute;
|
|
|
|
|
float: right;
|
|
|
|
|
right: 40px;
|
|
|
|
|
bottom: 28px;
|
|
|
|
|
}
|
2020-03-20 17:56:20 +08:00
|
|
|
|
.display-type-hb{
|
|
|
|
|
bottom: 105px;
|
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
|
</style>
|