2020-06-04 10:22:02 +08:00
|
|
|
<template>
|
|
|
|
<div class="main" :style="{width: canvasWidth+'px'}">
|
|
|
|
<transition name="el-zoom-in-bottom">
|
|
|
|
<map-system-draft ref="mapCanvas" @back="back" />
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
|
2020-06-04 11:12:55 +08:00
|
|
|
import { loadNewMapDataByMapId } from '@/utils/loaddata';
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { checkLoginLine } from '@/api/login';
|
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
2020-06-04 10:22:02 +08:00
|
|
|
export default {
|
|
|
|
name:'RefereeDisplay',
|
|
|
|
components: {
|
|
|
|
MapSystemDraft
|
2020-06-04 11:12:55 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
checkLine: null
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'canvasWidth'
|
|
|
|
]),
|
|
|
|
mapId() {
|
|
|
|
return this.$route.query.mapId;
|
|
|
|
},
|
|
|
|
...mapGetters('map', [
|
|
|
|
'map'
|
|
|
|
]),
|
|
|
|
...mapGetters('training', [
|
|
|
|
'offsetStationCode'
|
|
|
|
]),
|
|
|
|
...mapGetters('config', [
|
|
|
|
'canvasId'
|
|
|
|
]),
|
|
|
|
width() {
|
|
|
|
return this.$store.state.app.width;
|
|
|
|
},
|
|
|
|
height() {
|
|
|
|
return this.$store.state.app.height;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始加载默认状态
|
|
|
|
this.mapBoxP = document.getElementById(this.canvasId).children[0];
|
|
|
|
this.mapBoxP.style.cursor = '';
|
|
|
|
},
|
|
|
|
'size.width': function(val) {
|
|
|
|
this.setWindowSize();
|
|
|
|
},
|
|
|
|
'$store.state.app.windowSizeCount': function() {
|
|
|
|
this.setWindowSize();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
await this.setWindowSize();
|
|
|
|
await this.initLoadData();
|
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
// 仿真错误时,被动退出时调用
|
|
|
|
async back() {
|
|
|
|
// await this.$refs.menuScript.back();
|
|
|
|
},
|
|
|
|
// 加载数据
|
|
|
|
async initLoadData() {
|
|
|
|
this.$store.dispatch('training/reset');
|
|
|
|
try {
|
|
|
|
// await this.loadSimulationInfo();
|
|
|
|
await this.initLoadRecordData();
|
|
|
|
this.checkLoginLineTimer();
|
|
|
|
this.checkMouseStatusTimer();
|
|
|
|
} catch (error) {
|
|
|
|
this.$messageBox(`初始化失败: ${error.message}`);
|
|
|
|
this.endViewLoading();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 设置检查在线定时器
|
|
|
|
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;
|
|
|
|
if (this.mapBoxP) {
|
|
|
|
this.mapBoxP.style.cursor = this.mapBoxP.style.cursor != 'none' ? this.mapBoxP.style.cursor : '';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.mouseNumTime += 1;
|
|
|
|
}
|
|
|
|
if (this.mapBoxP) {
|
|
|
|
if (this.mouseNumTime >= 12) {
|
|
|
|
this.mapBoxP.style.cursor = 'none';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 1000);
|
|
|
|
},
|
|
|
|
// 加载地图数据
|
|
|
|
async initLoadRecordData() {
|
|
|
|
this.switchMode('01');
|
|
|
|
if (parseInt(this.mapId)) {
|
|
|
|
await this.loadNewMapDataById(this.mapId);
|
|
|
|
} else {
|
|
|
|
this.endViewLoading();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 结束加载状态
|
|
|
|
endViewLoading(isSuccess) {
|
|
|
|
if (!isSuccess) {
|
|
|
|
this.$store.dispatch('map/mapClear');
|
|
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
|
|
EventBus.$emit('viewLoading', false);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
switchMode(prdType) {
|
|
|
|
this.$store.dispatch('training/setPrdType', prdType);
|
|
|
|
},
|
|
|
|
async loadNewMapDataById(mapId) {
|
|
|
|
try {
|
|
|
|
await loadNewMapDataByMapId(mapId);
|
|
|
|
await this.$store.dispatch('training/setMapDefaultState');
|
|
|
|
} catch (error) {
|
|
|
|
this.$messageBox(`获取地图数据失败: ${error.message}`);
|
|
|
|
this.endViewLoading();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 加载仿真信息
|
|
|
|
// async loadSimulationInfo() {
|
|
|
|
// this.dataError = false;
|
|
|
|
// const resp = await getSimulationInfoNew(this.group);
|
|
|
|
// if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
|
|
|
|
// this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
|
|
|
|
// this.questId = Number(resp.data.questId) || 0;
|
|
|
|
// this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
|
|
|
|
// if (resp.data.planRunning) {
|
|
|
|
// this.planRunning = resp.data.planRunning;
|
|
|
|
// } else {
|
|
|
|
// this.$store.dispatch('training/over');
|
|
|
|
// }
|
|
|
|
// if (this.isDemon) {
|
|
|
|
// this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
|
|
|
|
// } else if (this.isScript) {
|
|
|
|
// this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
|
|
|
|
// }
|
|
|
|
// } else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
|
|
|
|
// this.dataError = true;
|
|
|
|
// this.$messageBox('此地图数据正在维护中,无法运行!');
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
setWindowSize() {
|
|
|
|
// this.$nextTick(() => {
|
|
|
|
const width = this.size ? this.size.width : this.width;
|
|
|
|
const height = this.size ? this.size.height : this.height;
|
|
|
|
|
|
|
|
this.$store.dispatch('config/resize', { width, height });
|
|
|
|
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
|
|
|
|
// });
|
|
|
|
}
|
2020-06-04 10:22:02 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|