rt-sim-training-client/src/views/newMap/displayBaSiDi/tro.vue

195 lines
5.9 KiB
Vue
Raw Normal View History

2021-05-24 11:29:59 +08:00
<template>
<el-dialog
:modal="false"
:title="title"
:visible.sync="show"
:fullscreen="true"
:before-close="doClose"
:z-index="2003"
>
<div>
2021-05-26 15:46:29 +08:00
<map-system-draft ref="mapCanvas" :no-menu="true" @back="back" />
2021-05-24 11:29:59 +08:00
</div>
</el-dialog>
</template>
<script>
import MapSystemDraft from '@/views/newMap/mapsystemNew/common/index';
import { mapGetters } from 'vuex';
import ButtonDbupIcon from '@/assets/baSiDi/dbup.png';
import ButtonRightIcon from '@/assets/baSiDi/right.png';
import ButtonLeftIcon from '@/assets/baSiDi/left.png';
2021-05-26 17:18:20 +08:00
import Vue from 'vue';
2021-05-24 11:29:59 +08:00
export default {
name: 'TRO',
components: {
MapSystemDraft
},
props: {
stationList: {
type: Array,
required: true
},
trainList: {
type: Array,
required: true
}
},
data() {
return {
dialogShow: false,
mapData: null,
deviceCode: '',
2021-05-26 17:18:20 +08:00
selfJmap: null,
2021-05-24 11:29:59 +08:00
buttonDbup: ButtonDbupIcon,
buttonRight: ButtonRightIcon,
buttonLeft: ButtonLeftIcon
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
title() {
2021-05-26 15:46:29 +08:00
return '轨道总览';
2021-05-24 11:29:59 +08:00
},
width() {
2021-05-25 16:05:45 +08:00
return this.$store.state.app.width - 5;
2021-05-24 11:29:59 +08:00
},
height() {
return this.$store.state.app.height - 50;
},
...mapGetters('map', [
'bigScreenConfig'
])
},
watch: {
'$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始加载默认状态
2021-05-26 15:46:29 +08:00
if (this.dialogShow) {
2021-05-24 11:29:59 +08:00
this.showTroMode();
2021-05-25 16:05:45 +08:00
this.$refs.mapCanvas && this.$refs.mapCanvas.mapViewLoaded(false);
2021-05-24 11:29:59 +08:00
}
},
2021-05-26 15:46:29 +08:00
'$store.state.app.windowSizeCount': function() { // 窗口缩放
this.$store.dispatch('config/resize', { width:this.width, height: this.height });
2021-05-24 11:29:59 +08:00
}
},
2021-05-28 10:10:54 +08:00
beforeDestroy() {
if (!this.dialogShow) {
this.destroy();
}
2021-05-26 14:04:36 +08:00
},
2021-05-24 11:29:59 +08:00
methods: {
doShow() {
this.dialogShow = true;
2021-05-31 14:15:09 +08:00
this.$jlmap && this.$jlmap.clearTrainView();
2021-05-26 17:18:20 +08:00
if (this.selfJmap) { Vue.prototype.$jlmap = this.selfJmap; }
2021-05-25 16:05:45 +08:00
this.$store.dispatch('config/resize', { width:this.width, height: this.height });
2021-05-24 11:29:59 +08:00
this.$nextTick(function() {
2021-05-31 14:15:09 +08:00
this.$refs.mapCanvas.setMap(this.$store.state.map.map);
const mapDevice = this.$store.state.map.mapDevice;
const list = [];
for (const key in mapDevice) {
list.push(mapDevice[key]);
2021-05-26 14:04:36 +08:00
}
2021-05-31 14:15:09 +08:00
this.$jlmap.updateShowMode(list, '05');
this.$store.dispatch('training/updateMapState', list);
2021-05-24 11:29:59 +08:00
});
},
2021-05-26 17:18:20 +08:00
destroy() {
if (this.selfJmap) {
this.selfJmap.dispose();
}
},
2021-05-24 11:29:59 +08:00
showTroMode() {
2021-05-28 10:10:54 +08:00
// const nameList = Object.keys(this.$store.state.map.map || {});
// let list = [];
// nameList.forEach(item => {
// if (item !== 'skinVO') {
// const data = this.$store.state.map.map[item];
// if (data && data.constructor === Array) {
// list = [...list, ...data];
// }
// }
// });
// const trainList = [];
// this.trainList.forEach(item => {
// trainList.push({ code: item.groupNumber, deviceType:'TRAIN' });
// });
const mapDevice = this.$store.state.map.mapDevice;
const list = [];
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
2021-05-26 15:46:29 +08:00
this.handleUpdateScreen();
this.$jlmap.updateShowMode(list, '05'); // 二次过滤
2021-05-28 10:10:54 +08:00
// this.$store.dispatch('training/updateMapState', trainList);
2021-05-24 11:29:59 +08:00
},
handleUpdateScreen() {
this.maskOpen = false;
if (this.bigScreenConfig.bigScreenSplitConfig && this.bigScreenConfig.bigScreenSplitConfig.length) {
const offsetList = this.bigScreenConfig.offsetList;
const width = this.bigScreenConfig.width;
const height = this.bigScreenConfig.height;
const size = {
width: (this.$store.state.app.width - 2) * width,
height: this.$store.state.app.height * height,
list: this.bigScreenConfig.bigScreenSplitConfig.map(ele => ele.position),
offsetList: offsetList
};
this.$jlmap.setUpdateScreen(size);
} else {
this.maskOpen = true;
// this.$messageBox('该线路没有大屏切割位置信息, 请前往地图绘制编辑');
}
},
back() {},
doClose() {
this.loading = false;
this.dialogShow = false;
2021-05-26 17:18:20 +08:00
this.selfJmap = Vue.prototype.$jlmap;
2021-05-24 11:29:59 +08:00
}
}
};
</script>
<style scoped>
/deep/ .el-dialog {
background: rgba(100, 100, 100, 1);
position: relative;
2021-05-28 10:10:54 +08:00
border: 2px solid rgba(144, 144, 144, 0.8);
2021-05-24 11:29:59 +08:00
border-radius: 6px;
font-size: 14px;
}
/deep/ .el-dialog .el-dialog__body{
background: rgba(100, 100, 100, 1);
border: 0;
padding: 0;
}
/deep/ .el-dialog .el-dialog__header {
padding: 5px;
height: 30px;
}
/deep/ .el-dialog .el-dialog__title {
color: #fff;
}
/deep/ .el-dialog .el-dialog__headerbtn {
background: linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
border: 1px solid #fff;
border-radius: 4px;
top: 4px;
right: 5px;
line-height: 16px;
}
/deep/ .el-dialog__headerbtn .el-dialog__close{
color: #fff;
}
.arrow-button{
width: 45px;
height: 30px;
cursor: pointer;
background-size: 45px 30px;
background-repeat: no-repeat;
}
</style>