2019-12-26 11:01:54 +08:00
|
|
|
|
<template>
|
2020-08-20 20:27:19 +08:00
|
|
|
|
<div class="main" :style="{width: canvasWidth+'px',height:'100%',position:'absolute',overflow:'hidden'}">
|
|
|
|
|
<template>
|
2019-12-26 11:01:54 +08:00
|
|
|
|
<transition name="el-zoom-in-bottom">
|
|
|
|
|
<map-system-draft ref="mapCanvas" @back="back" />
|
|
|
|
|
</transition>
|
2021-03-18 11:12:31 +08:00
|
|
|
|
<menu-demon v-if="isDemon" ref="menuDemon" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" @start="start" @end="end" />
|
|
|
|
|
<menu-lesson v-if="isLesson" ref="lessonMenu" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" :tip-bottom="tipBottom" />
|
|
|
|
|
<menu-exam v-if="isExam" ref="menuExam" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" />
|
|
|
|
|
<menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :offset="offset" :text-status-height="textStatusHeight" :data-error="dataError" @start="start" @end="end" />
|
|
|
|
|
<menu-dispather-contest v-if="isContest" ref="menuDispatherContest" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" @start="start" @end="end" />
|
2020-07-14 18:14:39 +08:00
|
|
|
|
</template>
|
2020-11-30 16:12:24 +08:00
|
|
|
|
<menu-train-list v-if="isDemon||isContest||isScript" />
|
2022-05-25 14:18:55 +08:00
|
|
|
|
<menu-system-time v-if="$route.query.lineCode !== '16'" ref="menuSystemTime" :offset="offset" :group="group" />
|
2019-12-26 11:01:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2020-08-20 20:39:38 +08:00
|
|
|
|
import { getSessionStorage } from '@/utils/auth';
|
2020-08-20 20:27:19 +08:00
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
|
import { OperateMode } from '@/scripts/ConstDic';
|
|
|
|
|
import { timeFormat } from '@/utils/date';
|
2020-11-09 15:17:11 +08:00
|
|
|
|
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
|
2020-08-26 13:21:47 +08:00
|
|
|
|
import MenuLesson from './lesson/index';
|
2020-11-09 15:17:11 +08:00
|
|
|
|
import MenuDemon from './menuDemon';
|
|
|
|
|
import MenuExam from './exam/index';
|
2020-08-27 14:02:27 +08:00
|
|
|
|
import MenuScript from './scriptDisplay/scriptRecord/index';
|
|
|
|
|
import MenuDispatherContest from './dispatherContest/index';
|
2020-06-29 15:55:31 +08:00
|
|
|
|
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
|
2020-08-20 20:27:19 +08:00
|
|
|
|
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
|
2020-11-16 14:37:35 +08:00
|
|
|
|
import { clearSimulation, getSimulationInfoNew, ranAsPlan, exitRunPlan } from '@/api/simulation';
|
2020-11-27 17:37:13 +08:00
|
|
|
|
import { loadMapDataById } from '@/utils/loaddata';
|
2020-08-20 20:27:19 +08:00
|
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
2020-11-09 15:17:11 +08:00
|
|
|
|
|
2019-12-26 11:01:54 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: 'DisplayDraft',
|
|
|
|
|
components: {
|
|
|
|
|
MapSystemDraft,
|
2020-08-20 20:27:19 +08:00
|
|
|
|
MenuDemon,
|
2020-06-29 15:55:31 +08:00
|
|
|
|
MenuExam,
|
|
|
|
|
MenuLesson,
|
2020-08-20 20:27:19 +08:00
|
|
|
|
MenuSystemTime,
|
2020-08-20 20:39:38 +08:00
|
|
|
|
MenuTrainList,
|
2020-08-26 13:21:47 +08:00
|
|
|
|
MenuDispatherContest,
|
2020-11-13 14:14:18 +08:00
|
|
|
|
MenuScript
|
2019-12-26 11:01:54 +08:00
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
offset: 15,
|
2020-03-30 16:15:35 +08:00
|
|
|
|
offsetBottom: 15,
|
2020-06-24 17:37:09 +08:00
|
|
|
|
tipBottom: 0,
|
2020-08-20 20:27:19 +08:00
|
|
|
|
textStatusHeight: 0,
|
2020-08-07 14:09:00 +08:00
|
|
|
|
planRunning:false,
|
2020-08-20 20:27:19 +08:00
|
|
|
|
dataError: false,
|
|
|
|
|
group:''
|
2019-12-26 11:01:54 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
2020-06-29 15:55:31 +08:00
|
|
|
|
computed:{
|
2019-12-26 11:01:54 +08:00
|
|
|
|
...mapGetters([
|
|
|
|
|
'canvasWidth'
|
2020-07-29 18:26:58 +08:00
|
|
|
|
]),
|
2020-06-29 15:55:31 +08:00
|
|
|
|
mode() {
|
|
|
|
|
return this.$route.params.mode;
|
|
|
|
|
},
|
2020-08-26 13:21:47 +08:00
|
|
|
|
project() {
|
|
|
|
|
return getSessionStorage('project');
|
|
|
|
|
},
|
2020-06-29 15:55:31 +08:00
|
|
|
|
isDemon() {
|
2021-10-29 10:37:02 +08:00
|
|
|
|
return this.mode === 'demon' && !this.project.includes('drts');
|
2020-08-26 13:21:47 +08:00
|
|
|
|
},
|
|
|
|
|
isContest() {
|
2021-10-29 10:37:02 +08:00
|
|
|
|
return this.mode === 'demon' && this.project.includes('drts');
|
2020-06-29 15:55:31 +08:00
|
|
|
|
},
|
|
|
|
|
isExam() {
|
|
|
|
|
return this.mode === 'exam';
|
|
|
|
|
},
|
|
|
|
|
isLesson() {
|
|
|
|
|
return (this.mode === 'teach' || this.mode === 'manage');
|
|
|
|
|
},
|
|
|
|
|
isScript() {
|
|
|
|
|
return this.mode === 'script';
|
|
|
|
|
},
|
2019-12-26 11:01:54 +08:00
|
|
|
|
mapId() {
|
|
|
|
|
return this.$route.query.mapId;
|
|
|
|
|
},
|
2020-08-20 20:27:19 +08:00
|
|
|
|
width() {
|
|
|
|
|
return this.$store.state.app.width;
|
2019-12-26 11:01:54 +08:00
|
|
|
|
},
|
2020-08-20 20:27:19 +08:00
|
|
|
|
height() {
|
|
|
|
|
return this.$store.state.app.height;
|
2019-12-26 11:01:54 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-08-20 20:27:19 +08:00
|
|
|
|
watch:{
|
2020-06-29 15:55:31 +08:00
|
|
|
|
'$store.state.socket.permissionOver': function () {
|
|
|
|
|
this.$alert('用户权限已被收回', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
callback: action => {
|
|
|
|
|
this.back();
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-02-25 11:18:59 +08:00
|
|
|
|
},
|
2021-09-08 14:38:48 +08:00
|
|
|
|
// 此处代码似乎没什么用,之前从menuSchema复制过来的
|
2021-09-27 10:45:08 +08:00
|
|
|
|
// '$store.state.training.prdType':function(val) {
|
|
|
|
|
// if (val == '01') { this.switchModeInner('01'); } else { this.switchModeInner('02'); }
|
|
|
|
|
// },
|
2020-08-20 20:27:19 +08:00
|
|
|
|
'$store.state.config.menuBarLoadedCount': function (val) { // menuBar加载完成
|
|
|
|
|
this.setPosition();
|
|
|
|
|
},
|
|
|
|
|
'$store.state.app.windowSizeCount': function() { // 窗口缩放
|
|
|
|
|
this.setWindowSize();
|
|
|
|
|
},
|
2021-09-08 14:38:48 +08:00
|
|
|
|
'$store.state.training.prdType': function (val) { // 根据权限类型计算高度
|
|
|
|
|
this.setPosition();
|
|
|
|
|
},
|
2020-06-29 15:55:31 +08:00
|
|
|
|
'$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始加载默认状态
|
|
|
|
|
if (this.planRunning) {
|
|
|
|
|
this.$store.dispatch('training/simulationStart');
|
|
|
|
|
}
|
2020-08-20 20:27:19 +08:00
|
|
|
|
},
|
|
|
|
|
$route() {
|
2020-11-27 14:05:10 +08:00
|
|
|
|
if (!this.isLesson && !this.isExam) {
|
2020-11-24 19:17:10 +08:00
|
|
|
|
this.initLoadData();
|
|
|
|
|
}
|
2019-12-26 11:01:54 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-06-19 18:58:55 +08:00
|
|
|
|
beforeDestroy() {
|
2020-11-09 15:17:11 +08:00
|
|
|
|
clearSimulation(this.group);
|
2021-09-26 18:11:13 +08:00
|
|
|
|
this.$store.dispatch('training/setSimulationUserList', []);
|
2020-06-19 18:58:55 +08:00
|
|
|
|
this.$store.dispatch('training/reset');
|
2020-11-24 16:53:13 +08:00
|
|
|
|
// this.$store.dispatch('map/mapClear');
|
2019-12-26 11:01:54 +08:00
|
|
|
|
},
|
2020-08-20 20:27:19 +08:00
|
|
|
|
async mounted() {
|
2020-11-11 09:13:41 +08:00
|
|
|
|
this.setWindowSize();
|
2020-08-20 20:27:19 +08:00
|
|
|
|
this.initLoadData();
|
|
|
|
|
},
|
2020-06-29 15:55:31 +08:00
|
|
|
|
methods:{
|
2020-08-20 20:27:19 +08:00
|
|
|
|
// 结束加载状态
|
|
|
|
|
endViewLoading(isSuccess) {
|
|
|
|
|
if (!isSuccess) {
|
|
|
|
|
this.$store.dispatch('map/mapClear');
|
2020-07-23 17:09:29 +08:00
|
|
|
|
}
|
2020-08-20 20:27:19 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
EventBus.$emit('viewLoading', false);
|
|
|
|
|
});
|
|
|
|
|
},
|
2020-06-29 15:55:31 +08:00
|
|
|
|
// 仿真错误时,被动退出时调用
|
|
|
|
|
async back() {
|
|
|
|
|
if (this.isExam) {
|
|
|
|
|
await this.$refs.menuExam.back();
|
|
|
|
|
} else if (this.isLesson) {
|
|
|
|
|
await this.$refs.lessonMenu.back();
|
|
|
|
|
} else if (this.isDemon) {
|
|
|
|
|
await this.$refs.menuDemon.back();
|
|
|
|
|
} else if (this.isScript) {
|
|
|
|
|
await this.$refs.menuScript.back();
|
2020-08-27 14:02:27 +08:00
|
|
|
|
} else if (this.isContest) {
|
|
|
|
|
await this.$refs.menuDispatherContest.back();
|
2020-06-29 15:55:31 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-11-05 13:17:40 +08:00
|
|
|
|
// 设置各个按钮的定位
|
2020-08-20 20:27:19 +08:00
|
|
|
|
setPosition() {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.offset = 10;
|
|
|
|
|
this.offsetBottom = 15;
|
|
|
|
|
const menuBar = document.getElementById('menuBar');
|
|
|
|
|
const menuTool = document.getElementById('menuTool');
|
|
|
|
|
const menuBottom = document.getElementById('menuButton');
|
|
|
|
|
const menuButtonsBox = document.getElementById('menuButtons_box');
|
|
|
|
|
const textStatus = document.getElementById('textStatus');
|
|
|
|
|
if (menuBar) {
|
|
|
|
|
this.offset = (menuBar.offsetHeight || 0) + 15;
|
|
|
|
|
}
|
|
|
|
|
if (menuTool) {
|
|
|
|
|
this.offset = (menuTool.offsetHeight || 0) + 15;
|
|
|
|
|
}
|
|
|
|
|
const buttonWidth = this.width - 1200; // B box widht
|
|
|
|
|
if (menuBottom && buttonWidth < 780) {
|
|
|
|
|
this.offsetBottom = (menuBottom.offsetHeight || 0) + 15;
|
|
|
|
|
}
|
|
|
|
|
if (menuButtonsBox) {
|
|
|
|
|
this.tipBottom = (menuButtonsBox.offsetHeight || 0) + 15;
|
|
|
|
|
}
|
|
|
|
|
if (textStatus) {
|
|
|
|
|
this.textStatusHeight = textStatus.offsetHeight || 0;
|
|
|
|
|
textStatus.style.top = this.offset - 15 + 'px';
|
|
|
|
|
}
|
2022-06-09 18:06:47 +08:00
|
|
|
|
if (this.$route.query.ctc) {
|
2022-06-17 14:16:54 +08:00
|
|
|
|
this.offset = 65;
|
2022-06-17 11:26:03 +08:00
|
|
|
|
this.offsetBottom = 2;
|
|
|
|
|
}
|
2020-08-20 20:27:19 +08:00
|
|
|
|
});
|
2020-06-29 15:55:31 +08:00
|
|
|
|
},
|
|
|
|
|
// 缩放设置
|
|
|
|
|
setWindowSize() {
|
|
|
|
|
const width = this.width;
|
2020-07-29 18:26:58 +08:00
|
|
|
|
const height = this.height;
|
2020-06-29 15:55:31 +08:00
|
|
|
|
this.$store.dispatch('config/resize', { width, height });
|
2020-07-27 18:04:47 +08:00
|
|
|
|
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
|
2019-12-26 11:01:54 +08:00
|
|
|
|
},
|
2020-08-20 20:27:19 +08:00
|
|
|
|
// 初始化
|
|
|
|
|
initLoadData() {
|
2020-08-26 14:08:50 +08:00
|
|
|
|
this.group = this.$route.query.group;
|
2020-08-20 20:27:19 +08:00
|
|
|
|
this.$store.dispatch('training/reset');
|
|
|
|
|
this.loadSimulationInfo();
|
|
|
|
|
this.loadMapData();
|
2019-12-26 11:01:54 +08:00
|
|
|
|
},
|
2020-07-31 15:24:44 +08:00
|
|
|
|
// 新版地图根据仿真group获取仿真基础信息
|
2020-06-29 15:55:31 +08:00
|
|
|
|
async loadSimulationInfo() {
|
|
|
|
|
const resp = await getSimulationInfoNew(this.group);
|
2020-11-09 15:17:11 +08:00
|
|
|
|
if (resp && resp.code == 200 && resp.data) {
|
|
|
|
|
if (!resp.data.dataError) {
|
|
|
|
|
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); // 是否暂停判断
|
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
|
2021-05-19 15:45:49 +08:00
|
|
|
|
// this.$store.dispatch('training/countTime');
|
2022-06-28 13:06:21 +08:00
|
|
|
|
if (resp.data.prodType === '03') {
|
|
|
|
|
this.$store.dispatch('training/setPrdType', this.$router.query.prdType);
|
|
|
|
|
} else {
|
|
|
|
|
this.$store.dispatch('training/setPrdType', resp.data.prodType);
|
|
|
|
|
}
|
2020-12-15 18:15:48 +08:00
|
|
|
|
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
|
2020-11-09 15:17:11 +08:00
|
|
|
|
this.planRunning = resp.data.planRunning;
|
|
|
|
|
if (resp.data.planRunning) {
|
|
|
|
|
this.$store.commit('training/start');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.$messageBox('此地图数据正在维护中,无法运行!');
|
2020-06-29 15:55:31 +08:00
|
|
|
|
}
|
2020-11-09 15:17:11 +08:00
|
|
|
|
this.dataError = resp.data.dataError;
|
2019-12-26 11:01:54 +08:00
|
|
|
|
}
|
2021-02-25 11:18:59 +08:00
|
|
|
|
},
|
2022-06-28 13:06:21 +08:00
|
|
|
|
// 通过showMode切换显示效果 11
|
2021-09-27 10:45:08 +08:00
|
|
|
|
// switchModeInner(swch) {
|
|
|
|
|
// let showMode = '03';
|
|
|
|
|
// if (swch == '01') {
|
|
|
|
|
// showMode = '03';
|
|
|
|
|
// } else if (swch == '02') {
|
|
|
|
|
// showMode = '02';
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// const list = [];
|
|
|
|
|
// const mapDevice = this.$store.state.map.mapDevice;
|
|
|
|
|
// for (const key in mapDevice) {
|
|
|
|
|
// list.push(mapDevice[key]);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (swch == '01') {
|
|
|
|
|
// this.$jlmap.updateShowStation(list, this.$store.state.training.centerStationCode); // 显示全部元素
|
|
|
|
|
// } else {
|
|
|
|
|
// this.$jlmap.updateShowStation(list, ''); // 显示全部元素
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// this.$jlmap.updateShowMode(list, showMode); // 二次过滤
|
|
|
|
|
// },
|
2020-08-20 20:27:19 +08:00
|
|
|
|
// 加载地图数据
|
|
|
|
|
loadMapData() {
|
2020-06-29 15:55:31 +08:00
|
|
|
|
if (parseInt(this.mapId)) {
|
2020-08-20 20:27:19 +08:00
|
|
|
|
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // 默认为正常模式
|
2020-12-24 15:33:06 +08:00
|
|
|
|
loadMapDataById(this.mapId, 'simulation');
|
|
|
|
|
} else {
|
2019-12-26 11:01:54 +08:00
|
|
|
|
this.endViewLoading();
|
|
|
|
|
}
|
2020-11-16 14:37:35 +08:00
|
|
|
|
},
|
|
|
|
|
start(model) { // 开始仿真
|
|
|
|
|
const data = {
|
|
|
|
|
time: model.initTime
|
|
|
|
|
};
|
|
|
|
|
if (this.$route.query.prdType === '04') {
|
|
|
|
|
data.loadNumber = model.loadNum;
|
|
|
|
|
}
|
|
|
|
|
ranAsPlan(data, this.group).then(res => {
|
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
let message = '';
|
|
|
|
|
switch (error.code) {
|
|
|
|
|
case '5001':
|
|
|
|
|
message = this.$t('error.mapDataError');
|
|
|
|
|
break;
|
|
|
|
|
case '5002':
|
|
|
|
|
message = this.$t('error.runningChartDataError');
|
|
|
|
|
break;
|
|
|
|
|
case '5003':
|
|
|
|
|
message = this.$t('error.runningChartIsNotLoaded');
|
|
|
|
|
break;
|
|
|
|
|
case '5004':
|
|
|
|
|
message = this.$t('error.runningDataError');
|
|
|
|
|
break;
|
|
|
|
|
case '5000':
|
|
|
|
|
message = this.$t('error.systemError');
|
|
|
|
|
break;
|
|
|
|
|
case '4000':
|
|
|
|
|
message = this.$t('error.simulationDoesNotExist');
|
|
|
|
|
break;
|
|
|
|
|
case '4001':
|
|
|
|
|
message = this.$t('error.simulationOperationIsNotDefined');
|
|
|
|
|
break;
|
|
|
|
|
case '4002':
|
|
|
|
|
message = this.$t('error.simulationOperationProcessingMethodNotFound');
|
|
|
|
|
break;
|
|
|
|
|
case '4003':
|
|
|
|
|
message = this.$t('error.simulationOperationFailed');
|
|
|
|
|
break;
|
|
|
|
|
case '4004':
|
|
|
|
|
message = this.$t('error.operationConflict');
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
message = '按计划行车异常,请退出重试!';
|
|
|
|
|
// this.$messageBox('按计划行车异常,请退出重试!');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
this.$messageBox(message + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
end() {
|
|
|
|
|
exitRunPlan(this.group).then(() => {
|
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
|
this.$store.dispatch('training/setMapDefaultState').then(() => {
|
|
|
|
|
this.$store.dispatch('map/clearJlmapTrainView');
|
|
|
|
|
this.$store.dispatch('map/resetActiveTrainList', false);
|
|
|
|
|
this.$store.dispatch('map/setTrainWindowShow', false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$messageBox(this.$t('display.demon.endSimulationFail'));
|
|
|
|
|
});
|
2019-12-26 11:01:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|