2020-05-06 16:57:07 +08:00
|
|
|
<template>
|
2021-04-22 10:52:48 +08:00
|
|
|
<div class="bigScreen">
|
|
|
|
<div v-show="maskOpen" class="bigScreenMask" />
|
2020-05-06 16:57:07 +08:00
|
|
|
<jlmap-visual ref="jlmapVisual" />
|
2022-09-14 13:26:59 +08:00
|
|
|
<wh-train-list v-if="prdType=== '10'" ref="whTrainList" />
|
2021-04-22 10:52:48 +08:00
|
|
|
<div v-show="disPlay" class="bigScreenBack">
|
2020-05-11 17:36:21 +08:00
|
|
|
<el-button-group>
|
2021-04-22 10:52:48 +08:00
|
|
|
<el-button type="primary" @click="back">返回</el-button>
|
2020-05-11 17:36:21 +08:00
|
|
|
</el-button-group>
|
|
|
|
</div>
|
2020-05-06 16:57:07 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import JlmapVisual from '@/views/newMap/jlmapNew/index';
|
2020-11-27 17:37:13 +08:00
|
|
|
import {loadMapDataById } from '@/utils/loaddata';
|
2020-05-13 17:34:38 +08:00
|
|
|
import { clearSimulation } from '@/api/simulation';
|
2020-05-06 16:57:07 +08:00
|
|
|
import { mapGetters } from 'vuex';
|
2020-05-11 18:15:49 +08:00
|
|
|
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
|
|
|
|
import { getToken } from '@/utils/auth';
|
2022-08-31 17:54:57 +08:00
|
|
|
import { TrainingMode } from '@/scripts/ConstDic';
|
2022-09-14 13:26:59 +08:00
|
|
|
import WhTrainList from './whTrainList';
|
2020-05-06 16:57:07 +08:00
|
|
|
|
|
|
|
export default {
|
2021-04-22 10:52:48 +08:00
|
|
|
name: 'BigScreen',
|
2020-05-06 16:57:07 +08:00
|
|
|
components: {
|
2022-09-14 13:26:59 +08:00
|
|
|
JlmapVisual,
|
|
|
|
WhTrainList
|
2020-05-06 16:57:07 +08:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
widthLeft: {
|
|
|
|
type: Number,
|
2020-05-09 20:13:32 +08:00
|
|
|
default: 0
|
2020-05-06 16:57:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2020-05-13 16:29:10 +08:00
|
|
|
maskOpen: false,
|
2020-05-13 17:34:38 +08:00
|
|
|
disPlay: false
|
2020-05-06 16:57:07 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
mapId() {
|
|
|
|
return this.$route.params.mapId;
|
|
|
|
},
|
|
|
|
height() {
|
2020-07-06 17:02:13 +08:00
|
|
|
return this.$store.state.app.height - 50 - 40;
|
2020-05-06 16:57:07 +08:00
|
|
|
},
|
2020-05-13 16:29:10 +08:00
|
|
|
...mapGetters('map', [
|
2020-07-06 17:02:13 +08:00
|
|
|
'bigScreenConfig'
|
2020-05-13 16:29:10 +08:00
|
|
|
]),
|
2020-05-06 16:57:07 +08:00
|
|
|
...mapGetters('config', [
|
|
|
|
'canvasId'
|
2022-09-14 13:26:59 +08:00
|
|
|
]),
|
|
|
|
prdType() {
|
|
|
|
return this.$route.query.prdType;
|
|
|
|
}
|
2020-05-06 16:57:07 +08:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
widthLeft(val) {
|
|
|
|
this.setWindowSize();
|
|
|
|
},
|
|
|
|
$route() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.initLoadData();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'$store.state.app.windowSizeCount': function() {
|
|
|
|
this.setWindowSize();
|
|
|
|
},
|
|
|
|
'$store.state.map.mapViewLoadedCount':function() {
|
|
|
|
this.$store.dispatch('map/setTrainWindowShow', false);
|
2021-09-06 16:10:27 +08:00
|
|
|
// this.$jlmap.off('zoom');
|
2020-05-07 09:04:28 +08:00
|
|
|
this.handleUpdateScreen();
|
2020-12-28 11:20:36 +08:00
|
|
|
if (this.$route.query.group && !this.$route.path.includes('displayIscs')) {
|
2020-05-13 17:34:38 +08:00
|
|
|
this.subscribe();
|
|
|
|
}
|
2020-05-11 18:15:49 +08:00
|
|
|
},
|
|
|
|
'$store.state.socket.equipmentStatus': function (val) {
|
2020-05-12 19:07:48 +08:00
|
|
|
if (val.length && this.$route.query.group) {
|
2020-05-11 18:15:49 +08:00
|
|
|
this.statusMessage(val);
|
|
|
|
}
|
2020-07-22 14:59:00 +08:00
|
|
|
},
|
|
|
|
'$store.state.socket.simulationOver':function(val) {
|
|
|
|
this.backOut();
|
2022-09-14 13:26:59 +08:00
|
|
|
},
|
|
|
|
'$store.state.socket.whTrainInfo': function(val) {
|
|
|
|
|
2020-05-06 16:57:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async beforeDestroy() {
|
|
|
|
await this.$store.dispatch('map/mapClear');
|
2021-10-14 09:35:32 +08:00
|
|
|
this.$store.dispatch('training/setPrdType', '');
|
2020-05-06 16:57:07 +08:00
|
|
|
},
|
|
|
|
async mounted() {
|
2022-09-08 15:37:30 +08:00
|
|
|
this.$store.dispatch('training/setPrdType', this.$route.query.prdType || '07');
|
2020-05-06 16:57:07 +08:00
|
|
|
await this.setWindowSize();
|
|
|
|
await this.initLoadData();
|
2020-05-13 17:34:38 +08:00
|
|
|
this.disPlay = true;
|
2021-04-22 10:52:48 +08:00
|
|
|
if (this.$route.path.includes('design/bigScreen') || this.$route.query.noPreLogout || this.$route.query.projectDevice) {
|
2020-05-13 17:34:38 +08:00
|
|
|
this.disPlay = false;
|
|
|
|
}
|
2020-05-06 16:57:07 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2020-12-24 15:33:06 +08:00
|
|
|
initLoadData() { // 加载地图数据
|
2020-05-11 18:15:49 +08:00
|
|
|
if (this.$route.query.group) {
|
2020-12-24 15:33:06 +08:00
|
|
|
loadMapDataById(this.$route.query.mapId, 'simulation');
|
2020-05-06 16:57:07 +08:00
|
|
|
} else {
|
2022-08-31 17:54:57 +08:00
|
|
|
this.$store.dispatch('training/changeMode', { mode: TrainingMode.NORMAL });
|
2020-12-24 15:33:06 +08:00
|
|
|
loadMapDataById(this.$route.params.mapId, 'preview');
|
2020-05-06 16:57:07 +08:00
|
|
|
}
|
2020-05-13 17:34:38 +08:00
|
|
|
},
|
|
|
|
async statusMessage(list) {
|
|
|
|
await this.$store.dispatch('training/updateMapState', list);
|
|
|
|
await this.$store.dispatch('socket/setEquipmentStatus');
|
2020-05-06 16:57:07 +08:00
|
|
|
},
|
|
|
|
setWindowSize() {
|
|
|
|
this.$nextTick(() => {
|
2020-05-09 20:13:32 +08:00
|
|
|
if (this.widthLeft) {
|
2020-09-09 10:28:56 +08:00
|
|
|
const width = this.$store.state.app.width - (this.widthLeft) - 2;
|
2020-05-09 20:13:32 +08:00
|
|
|
const height = this.height;
|
|
|
|
this.$store.dispatch('config/resize', { width, height });
|
|
|
|
} else {
|
|
|
|
const width = this.$store.state.app.width - 2;
|
|
|
|
const height = this.$store.state.app.height;
|
|
|
|
this.$store.dispatch('config/resize', { width, height });
|
|
|
|
}
|
2020-05-13 17:58:39 +08:00
|
|
|
this.handleUpdateScreen();
|
2020-05-06 16:57:07 +08:00
|
|
|
});
|
2020-05-07 09:04:28 +08:00
|
|
|
},
|
|
|
|
handleUpdateScreen() {
|
2020-05-13 16:29:10 +08:00
|
|
|
this.maskOpen = false;
|
2022-08-25 15:10:26 +08:00
|
|
|
let picture;
|
|
|
|
if (this.$store.state.map.map && this.$store.state.map.map.pictureList) {
|
|
|
|
picture = this.$store.state.map.map.pictureList.find(picture => picture.type === 'bigScreen');
|
|
|
|
}
|
|
|
|
if (picture) {
|
|
|
|
this.$store.dispatch('map/setPictureDeviceMap', picture.deviceMap);
|
|
|
|
const deviceList = [];
|
|
|
|
const mapDevice = this.$store.state.map.mapDevice;
|
|
|
|
for (const deviceCode in mapDevice) {
|
|
|
|
deviceList.push(deviceCode);
|
|
|
|
}
|
|
|
|
this.$jlmap.updatePicture(deviceList);
|
|
|
|
this.$jlmap.updateTransform(picture.scaling, picture.origin);
|
|
|
|
} else if (this.bigScreenConfig.bigScreenSplitConfig && this.bigScreenConfig.bigScreenSplitConfig.length) {
|
2020-07-06 17:02:13 +08:00
|
|
|
const offsetList = this.bigScreenConfig.offsetList;
|
|
|
|
const width = this.bigScreenConfig.width;
|
|
|
|
const height = this.bigScreenConfig.height;
|
2020-05-13 16:29:10 +08:00
|
|
|
if (this.widthLeft) {
|
|
|
|
const size = {
|
2020-07-06 17:02:13 +08:00
|
|
|
width: (this.$store.state.app.width - (this.widthLeft || 450) - 2) * width,
|
|
|
|
height: this.height * height,
|
|
|
|
list: this.bigScreenConfig.bigScreenSplitConfig.map(ele => ele.position),
|
|
|
|
offsetList: offsetList
|
2020-05-13 16:29:10 +08:00
|
|
|
};
|
|
|
|
this.$jlmap.setUpdateScreen(size);
|
|
|
|
} else {
|
|
|
|
const size = {
|
2020-07-06 17:02:13 +08:00
|
|
|
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
|
2020-05-13 16:29:10 +08:00
|
|
|
};
|
|
|
|
this.$jlmap.setUpdateScreen(size);
|
|
|
|
}
|
|
|
|
this.$refs.jlmapVisual.handleStateLoaded();
|
2020-05-09 20:13:32 +08:00
|
|
|
} else {
|
2020-05-13 16:29:10 +08:00
|
|
|
this.maskOpen = true;
|
2020-05-13 18:00:37 +08:00
|
|
|
// this.$messageBox('该线路没有大屏切割位置信息, 请前往地图绘制编辑');
|
2020-05-09 20:13:32 +08:00
|
|
|
}
|
2020-05-11 17:36:21 +08:00
|
|
|
},
|
2020-05-13 17:34:38 +08:00
|
|
|
async back() {
|
|
|
|
if (this.$route.query.group) {
|
|
|
|
await clearSimulation(this.$route.query.group);
|
|
|
|
this.clearSubscribe();
|
|
|
|
}
|
2020-05-11 17:36:21 +08:00
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
history.go(-1);
|
|
|
|
});
|
2020-05-11 18:15:49 +08:00
|
|
|
},
|
2020-07-22 14:59:00 +08:00
|
|
|
backOut() {
|
|
|
|
if (this.$route.query.projectDevice) {
|
|
|
|
this.$store.dispatch('LogOut').then(() => {
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2020-05-11 18:15:49 +08:00
|
|
|
async subscribe() {
|
|
|
|
this.clearSubscribe();
|
|
|
|
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
|
|
|
|
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
|
2022-09-14 13:26:59 +08:00
|
|
|
if (this.prdType === '10') {
|
|
|
|
creatSubscribe(`/topic/yjddzh/trainPosition`, header);
|
|
|
|
}
|
2020-11-30 10:23:32 +08:00
|
|
|
// await this.$store.dispatch('training/setHasSubscribed');
|
2020-05-11 18:15:49 +08:00
|
|
|
},
|
|
|
|
clearSubscribe() {
|
|
|
|
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
|
2022-09-14 13:26:59 +08:00
|
|
|
if (this.prdType === '10') {
|
|
|
|
clearSubscribe(`/topic/yjddzh/trainPosition`);
|
|
|
|
}
|
2020-05-06 16:57:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
2021-04-22 10:52:48 +08:00
|
|
|
.bigScreen {
|
|
|
|
width: 100%;
|
2020-07-06 17:02:13 +08:00
|
|
|
overflow: hidden;
|
2021-04-22 10:52:48 +08:00
|
|
|
position: relative;
|
2020-05-13 16:29:10 +08:00
|
|
|
}
|
2021-04-22 10:52:48 +08:00
|
|
|
.bigScreenMask{
|
2020-05-13 16:29:10 +08:00
|
|
|
opacity: 1;
|
|
|
|
background: #000;
|
|
|
|
position: absolute;
|
|
|
|
right: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
z-index: 9;
|
2020-05-06 16:57:07 +08:00
|
|
|
}
|
2021-04-22 10:52:48 +08:00
|
|
|
.bigScreenBack {
|
2020-05-11 17:36:21 +08:00
|
|
|
position: absolute;
|
|
|
|
float: right;
|
|
|
|
right: 15px;
|
|
|
|
bottom: 15px;
|
2020-05-13 17:34:38 +08:00
|
|
|
z-index: 19;
|
2020-05-11 17:36:21 +08:00
|
|
|
}
|
2020-05-06 16:57:07 +08:00
|
|
|
</style>
|