2019-11-29 12:51:58 +08:00
|
|
|
<template>
|
2020-07-06 17:02:13 +08:00
|
|
|
<div ref="jlmapCanvas" class="jlmap-canvas" :style="{ width: width+'px', height: height+'px' }" @mousemove="mousemove">
|
2020-01-07 10:52:44 +08:00
|
|
|
<div v-show="maskOpen" class="mask" />
|
2019-12-30 14:06:42 +08:00
|
|
|
<div :id="canvasId" style="background: #000;" class="display_canvas" />
|
2019-11-29 12:51:58 +08:00
|
|
|
<progress-bar ref="progressBar" />
|
2020-07-31 18:49:35 +08:00
|
|
|
<!-- <zoom-box v-if="!showZoom && !isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" /> -->
|
2020-08-03 17:30:01 +08:00
|
|
|
<show-mode v-show="isDesign" :draft-show="draftShow" :local-station-show="localStationShow" @setShowMode="setShowMode" />
|
|
|
|
<switch-station v-show="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :draft-show="draftShow" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" />
|
2020-05-07 09:03:10 +08:00
|
|
|
<div v-if="show && !isScreen" class="zoom-view" :style="{ width: width +'px'}">
|
2020-08-03 17:30:01 +08:00
|
|
|
<el-form :model="dataZoom" label-width="60px" size="mini" inline>
|
|
|
|
<el-form-item label="偏 移:">
|
2019-12-10 16:09:45 +08:00
|
|
|
<el-input v-model="dataZoom.offsetX" :disabled="true" style="width: 95px" />
|
2019-11-29 12:51:58 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
2019-12-10 16:09:45 +08:00
|
|
|
<el-input v-model="dataZoom.offsetY" :disabled="true" style="width: 95px" />
|
2019-12-10 15:44:46 +08:00
|
|
|
</el-form-item>
|
2019-12-10 16:09:45 +08:00
|
|
|
<div style="display: inline-block">
|
2020-08-03 17:30:01 +08:00
|
|
|
<span class="title" style="width: 90px; height: 28px; line-height: 30px;">鼠标偏移:</span>
|
2019-12-10 16:09:45 +08:00
|
|
|
<el-form-item label="x" label-width="12px">
|
2020-03-31 14:41:17 +08:00
|
|
|
<el-input ref="offsetX" v-model="offset.x" :disabled="true" style="width: 95px" />
|
2019-12-10 16:09:45 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="y" label-width="12px">
|
|
|
|
<el-input v-model="offset.y" :disabled="true" style="width: 95px" />
|
|
|
|
</el-form-item>
|
|
|
|
</div>
|
2020-08-03 17:30:01 +08:00
|
|
|
<el-form-item label="缩 放:">
|
2019-11-29 12:51:58 +08:00
|
|
|
<el-input v-model="dataZoom.scaleRate" :disabled="true" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Vue from 'vue';
|
|
|
|
import localStore from 'storejs';
|
|
|
|
import Jlmap from '@/jmapNew/map';
|
2020-07-31 18:49:35 +08:00
|
|
|
// import ZoomBox from './pendant/zoom';
|
2020-03-11 10:53:09 +08:00
|
|
|
import ShowMode from './pendant/showMode';
|
2020-03-13 13:01:58 +08:00
|
|
|
import SwitchStation from './pendant/switchStation';
|
2019-11-29 12:51:58 +08:00
|
|
|
import ProgressBar from '@/views/components/progressBar/index';
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { TrainingMode } from '@/scripts/ConstDic';
|
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
2019-12-31 15:36:49 +08:00
|
|
|
import Theme from '@/jmapNew/theme/factory';
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'JlmapVisual',
|
|
|
|
components: {
|
2020-07-31 18:49:35 +08:00
|
|
|
// ZoomBox,
|
2020-03-11 10:53:09 +08:00
|
|
|
ProgressBar,
|
2020-03-13 13:01:58 +08:00
|
|
|
ShowMode,
|
|
|
|
SwitchStation
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
2020-08-03 17:30:01 +08:00
|
|
|
props: {
|
|
|
|
draftShow: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-11-29 12:51:58 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
loading: true,
|
|
|
|
dataZoom: {
|
|
|
|
offsetX: '0',
|
|
|
|
offsetY: '0',
|
|
|
|
scaleRate: '1'
|
|
|
|
},
|
2019-12-10 16:09:45 +08:00
|
|
|
offset: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
},
|
2019-11-29 12:51:58 +08:00
|
|
|
sectionActive: false,
|
2020-03-13 13:01:58 +08:00
|
|
|
operate: null,
|
|
|
|
concentrationStationList: [],
|
|
|
|
showMode: '03',
|
2020-03-13 16:35:03 +08:00
|
|
|
localStationShow: false,
|
2020-04-07 14:40:24 +08:00
|
|
|
previewOrMapDraw: false,
|
|
|
|
trainingSetStation: false // 现地实训是否根据设备仅显示设备集中站设备
|
2019-11-29 12:51:58 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('training', [
|
2020-07-27 18:04:47 +08:00
|
|
|
'mode'
|
|
|
|
// 'offsetStationCode'
|
2019-11-29 12:51:58 +08:00
|
|
|
]),
|
|
|
|
canvasId() {
|
|
|
|
const canvasId = ['map', (Math.random().toFixed(5)) * 100000].join('_');
|
|
|
|
this.$store.dispatch('config/setCurrentCancasId', { id: canvasId });
|
|
|
|
return canvasId;
|
|
|
|
},
|
|
|
|
width() {
|
|
|
|
return this.$store.state.config.width;
|
|
|
|
},
|
|
|
|
height() {
|
|
|
|
return this.$store.state.config.height;
|
|
|
|
},
|
|
|
|
show() {
|
|
|
|
if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2020-07-06 18:16:49 +08:00
|
|
|
showZoom() {
|
|
|
|
return this.$route.path.includes('bigSplitScreen');
|
|
|
|
},
|
2019-11-29 12:51:58 +08:00
|
|
|
isScreen() {
|
2020-06-10 16:56:52 +08:00
|
|
|
return this.$route.path.includes('displayBigScreen') || this.$route.path.includes('bigScreen') || this.$store.state.training.prdType === '07';
|
2020-01-07 10:52:44 +08:00
|
|
|
},
|
|
|
|
maskOpen() {
|
|
|
|
return this.$store.state.config.maskOpen;
|
2020-03-11 10:53:09 +08:00
|
|
|
},
|
|
|
|
isDesign() {
|
|
|
|
return this.$route.path.indexOf('mapPreviewNew') !== -1 || this.$route.path.indexOf('map/draw') !== -1;
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.map.map': function (val, old) {
|
|
|
|
try {
|
|
|
|
if (val) {
|
|
|
|
this.setMap(val);
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log('[ERROR] ', error);
|
|
|
|
this.mapViewLoaded(false);
|
|
|
|
}
|
|
|
|
},
|
2020-07-27 18:04:47 +08:00
|
|
|
'$store.state.training.rezoomCount': function () {
|
2020-07-28 16:28:55 +08:00
|
|
|
let code = this.$store.state.training.offsetStationCode; // 偏移集中站坐标
|
2020-07-27 18:04:47 +08:00
|
|
|
if (code && code.includes('TurnedAround')) { // 单独处理 自动折返
|
|
|
|
const cycleButtonList = this.$store.state.map.map.cycleButtonList;
|
|
|
|
if (cycleButtonList && cycleButtonList.length > 0) {
|
|
|
|
cycleButtonList.forEach(element => {
|
2020-04-10 10:41:41 +08:00
|
|
|
if (code == element.cycleCode) {
|
|
|
|
code = element.code;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setCenter(code);
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
|
|
|
'$store.state.config.canvasSizeCount': function (val) {
|
|
|
|
this.resetSize();
|
|
|
|
},
|
|
|
|
'$store.state.menuOperation.magnifyCount': function () {
|
|
|
|
this.setMagnify();
|
|
|
|
},
|
|
|
|
'$store.state.menuOperation.shrinkCount': function () {
|
|
|
|
this.setShrink();
|
|
|
|
},
|
|
|
|
$route() {
|
|
|
|
this.mapViewLoaded(true);
|
2020-03-20 17:36:07 +08:00
|
|
|
},
|
2020-03-23 13:52:50 +08:00
|
|
|
'$store.state.training.prdType': function (val) {
|
2020-05-14 15:19:07 +08:00
|
|
|
if (val) {
|
|
|
|
this.changePrdType(val);
|
|
|
|
}
|
2020-04-07 14:40:24 +08:00
|
|
|
},
|
2020-04-09 17:37:27 +08:00
|
|
|
'$store.state.map.showCentralizedStationNum': function (val) {
|
2020-06-01 13:36:26 +08:00
|
|
|
if (this.$store.state.map.showCentralizedStationCode) {
|
|
|
|
this.setShowStation(this.$store.state.map.showCentralizedStationCode);
|
|
|
|
}
|
2020-04-07 14:40:24 +08:00
|
|
|
},
|
|
|
|
'$store.state.training.offsetStationCode': function(code) {
|
|
|
|
if (code && this.localStationShow && this.$store.state.training.prdType === '01') {
|
|
|
|
const deviceModel = this.$store.getters['map/getDeviceByCode'](code);
|
|
|
|
if (deviceModel._type == 'Section' || deviceModel._type == 'Switch' || deviceModel._type == 'Signal' || deviceModel._type == 'Switch') {
|
|
|
|
const stationModel = this.$store.getters['map/getDeviceByCode'](deviceModel.stationCode);
|
|
|
|
this.setShowStation(stationModel.code, true);
|
2020-04-13 14:54:35 +08:00
|
|
|
this.$store.dispatch('training/setCenterStationCode', stationModel.code);
|
2020-04-10 11:05:20 +08:00
|
|
|
} else if (deviceModel._type === 'StationStand') {
|
|
|
|
const stationModel = this.$store.getters['map/getDeviceByCode'](deviceModel.deviceStationCode);
|
|
|
|
this.setShowStation(stationModel.code, true);
|
2020-04-13 14:54:35 +08:00
|
|
|
this.$store.dispatch('training/setCenterStationCode', stationModel.code);
|
2020-04-07 14:40:24 +08:00
|
|
|
} else if (deviceModel._type === 'Station') {
|
|
|
|
let stationModel = '';
|
|
|
|
if (deviceModel.centralized) {
|
|
|
|
stationModel = deviceModel;
|
|
|
|
} else {
|
|
|
|
this.$store.state.map.map.stationList || [].forEach(item => {
|
|
|
|
item.chargeStationCodeList || [].forEach(it => {
|
|
|
|
if (it === deviceModel.code) {
|
|
|
|
stationModel = item;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
this.setShowStation(stationModel.code, true);
|
2020-04-13 14:54:35 +08:00
|
|
|
this.$store.dispatch('training/setCenterStationCode', stationModel.code);
|
2020-04-07 14:40:24 +08:00
|
|
|
}
|
|
|
|
this.setCenter(code);
|
|
|
|
}
|
2020-07-10 10:52:31 +08:00
|
|
|
},
|
2020-07-10 17:23:17 +08:00
|
|
|
'$store.state.socket.simulationReset': function (val) { // 仿真结束标识
|
2020-07-10 10:52:31 +08:00
|
|
|
if (val) {
|
|
|
|
this.simulationReset(val);
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
EventBus.$on('viewLoading', (loading) => {
|
|
|
|
this.mapViewLoaded(loading);
|
|
|
|
});
|
|
|
|
EventBus.$on('viewProgressAt', (percentage) => {
|
|
|
|
this.mapViewProgressAt(percentage);
|
|
|
|
});
|
|
|
|
EventBus.$on('refresh', () => {
|
|
|
|
this.refresh(this.$store.state.map.map);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.initLoadPage();
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
EventBus.$off('refresh');
|
|
|
|
EventBus.$off('viewLoading');
|
|
|
|
EventBus.$off('viewProgressAt');
|
|
|
|
this.$store.dispatch('map/mapClear');
|
|
|
|
if (this.$jlmap) {
|
|
|
|
this.$jlmap.dispose();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 初始化jlmap
|
|
|
|
initLoadPage() {
|
|
|
|
document.getElementById(this.canvasId).oncontextmenu = function (e) {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
// 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作
|
|
|
|
const path = window.location.href;
|
2020-03-12 14:41:53 +08:00
|
|
|
const mouseWheelFlag = true;
|
2020-03-13 16:35:03 +08:00
|
|
|
this.previewOrMapDraw = false;
|
2020-03-11 15:10:08 +08:00
|
|
|
if (path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1) {
|
2020-03-13 16:35:03 +08:00
|
|
|
this.previewOrMapDraw = true;
|
2020-03-11 15:10:08 +08:00
|
|
|
}
|
2020-03-20 17:36:07 +08:00
|
|
|
const prdType = this.$store.state.training.prdType;
|
2019-12-31 15:36:49 +08:00
|
|
|
Vue.prototype.$theme = new Theme();
|
2019-11-29 12:51:58 +08:00
|
|
|
Vue.prototype.$jlmap = new Jlmap({
|
|
|
|
dom: document.getElementById(this.canvasId),
|
|
|
|
config: {
|
|
|
|
renderer: 'canvas',
|
|
|
|
width: this.width,
|
|
|
|
height: this.height
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
scaleRate: 1,
|
|
|
|
offsetX: 0,
|
|
|
|
offsetY: 0,
|
|
|
|
zoomOnMouseWheel: mouseWheelFlag
|
|
|
|
},
|
2020-03-11 15:10:08 +08:00
|
|
|
showConfig: {
|
|
|
|
prdType: prdType,
|
2020-03-13 16:35:03 +08:00
|
|
|
previewOrMapDraw: this.previewOrMapDraw,
|
2020-03-11 15:10:08 +08:00
|
|
|
showMode: '03'
|
|
|
|
},
|
2019-11-29 12:51:58 +08:00
|
|
|
methods: {
|
|
|
|
dataLoaded: this.handleDataLoaded,
|
|
|
|
viewLoaded: this.handleViewLoaded,
|
|
|
|
stateLoaded: this.handleStateLoaded
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$jlmap.on('dataZoom', this.onDataZoom, this);
|
|
|
|
this.$jlmap.on('selected', this.onSelected, this);
|
|
|
|
this.$jlmap.on('contextmenu', this.onContextMenu, this);
|
2019-12-06 10:11:29 +08:00
|
|
|
if (this.$route.path.startsWith('/design/usermap/map/draw')) {
|
|
|
|
this.$jlmap.on('keyboard', this.onKeyboard, this);
|
2020-07-28 16:28:55 +08:00
|
|
|
} else {
|
|
|
|
this.$jlmap.on('keyboard', this.onSimulationKeyboard, this);
|
2019-12-06 10:11:29 +08:00
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
window.document.oncontextmenu = function () {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
},
|
|
|
|
// 重置jlmap宽高
|
|
|
|
resetSize() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$jlmap && this.$jlmap.resize({ width: this.width, height: this.height });
|
|
|
|
setTimeout(() => {
|
|
|
|
this.$store.dispatch('config/resetCanvasOffset');
|
|
|
|
this.$store.dispatch('training/emitTipFresh');
|
|
|
|
}, 100);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 设置显示图层
|
|
|
|
setLevelVisible(levels) {
|
|
|
|
this.$jlmap && this.$jlmap.setLevelVisible(levels);
|
|
|
|
},
|
|
|
|
// 设置显示中心
|
|
|
|
setCenter(deviceCode) {
|
|
|
|
this.$jlmap && this.$jlmap.setCenter(deviceCode);
|
|
|
|
},
|
|
|
|
// 地图数据加载完成
|
|
|
|
handleDataLoaded() {
|
|
|
|
this.$store.dispatch('map/mapDataLoaded');
|
2020-03-13 13:01:58 +08:00
|
|
|
const concentrationStationList = [];
|
|
|
|
this.$store.state.map.map.stationList.forEach(item => {
|
|
|
|
if (item.centralized) {
|
|
|
|
concentrationStationList.push({value: item.code, name: item.name});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.concentrationStationList = concentrationStationList;
|
|
|
|
const lineCode = this.$store.state.map.map.skinVO.code;
|
|
|
|
if (Vue.prototype.$theme) {
|
|
|
|
this.localStationShow = Vue.prototype.$theme._localShowMode[lineCode] === 'ecStation';
|
|
|
|
}
|
2020-03-13 16:35:03 +08:00
|
|
|
this.$store.dispatch('map/setTrainWindowShow', this.previewOrMapDraw);
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
|
|
|
// 地图视图加载完成
|
|
|
|
handleViewLoaded() {
|
|
|
|
this.$store.dispatch('map/mapViewLoaded');
|
|
|
|
if (!this.$store.state.training.prdType) {
|
|
|
|
this.mapViewLoaded(false);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 地图状态加载完成
|
|
|
|
handleStateLoaded() {
|
|
|
|
this.mapViewLoaded(false);
|
|
|
|
},
|
|
|
|
// 地图视图更新
|
|
|
|
handleViewUpdate() {
|
|
|
|
},
|
|
|
|
// 地图状态更新
|
|
|
|
handleStateUpdate() {
|
|
|
|
},
|
|
|
|
// 视图参数改变
|
|
|
|
handleOptionsUpdate(options) {
|
|
|
|
},
|
|
|
|
// 键盘快捷键事件
|
|
|
|
onKeyboard(hook) {
|
|
|
|
switch (hook) {
|
2019-12-06 10:05:14 +08:00
|
|
|
case 'Ctrl_Z': this.$store.dispatch('map/setRevocation');
|
2019-11-29 12:51:58 +08:00
|
|
|
break;
|
2019-12-06 10:05:14 +08:00
|
|
|
case 'Ctrl_Y': this.$store.dispatch('map/setRecover');
|
2019-11-29 12:51:58 +08:00
|
|
|
break;
|
2019-12-06 10:05:14 +08:00
|
|
|
case 'Delete': this.$store.dispatch('map/setDeleteCount');
|
2019-12-05 18:53:06 +08:00
|
|
|
break;
|
2020-03-31 14:41:17 +08:00
|
|
|
case 'Update':
|
|
|
|
this.$refs.offsetX.focus();
|
|
|
|
this.$store.dispatch('map/setUpdateCount');
|
2019-12-06 15:12:22 +08:00
|
|
|
break;
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
},
|
2020-07-28 16:28:55 +08:00
|
|
|
onSimulationKeyboard(hook) {
|
|
|
|
switch (hook) {
|
|
|
|
case 'Update': this.$store.dispatch('map/setKeyboardEnter');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
2020-07-10 10:52:31 +08:00
|
|
|
async simulationReset() {
|
|
|
|
await this.$store.dispatch('map/clearJlmapTrainView');
|
|
|
|
await this.$store.dispatch('map/setTrainWindowShow', false);
|
|
|
|
await this.$store.dispatch('training/over');
|
|
|
|
await this.$store.dispatch('socket/setSimulationReset'); // 清空
|
|
|
|
await this.$store.dispatch('socket/setSimulationStart');
|
|
|
|
await this.$store.dispatch('training/setMapDefaultState');
|
|
|
|
},
|
2019-11-29 12:51:58 +08:00
|
|
|
// 视图缩放事件
|
|
|
|
onDataZoom(dataZoom) {
|
|
|
|
this.dataZoom.offsetX = dataZoom.offsetX.toFixed(1) + '';
|
|
|
|
this.dataZoom.offsetY = dataZoom.offsetY.toFixed(1) + '';
|
|
|
|
this.dataZoom.scaleRate = dataZoom.scaleRate + '';
|
2019-12-10 16:09:45 +08:00
|
|
|
this.offset.x = this.dataZoom.offsetX;
|
|
|
|
this.offset.y = this.dataZoom.offsetY;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
const lineCode = this.$store.getters['map/lineCode'];
|
|
|
|
if (lineCode) {
|
|
|
|
const param = {
|
|
|
|
scaleRate: this.dataZoom.scaleRate,
|
|
|
|
offsetY: this.dataZoom.offsetY,
|
|
|
|
offsetX: this.dataZoom.offsetX,
|
|
|
|
lineCode: lineCode
|
|
|
|
};
|
|
|
|
this.$store.dispatch('map/updateZoom', this.dataZoom);
|
|
|
|
localStore.set(`scaleRate_${lineCode}`, JSON.stringify(param)); // 保存缩放倍数
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$store.dispatch('training/emitTipFresh');
|
|
|
|
},
|
|
|
|
// 点击选择事件
|
|
|
|
onSelected(em) {
|
|
|
|
this.$emit('onSelect', em);
|
|
|
|
},
|
|
|
|
// 右键点击事件
|
|
|
|
onContextMenu(em) {
|
|
|
|
this.$emit('onMenu', em);
|
|
|
|
},
|
|
|
|
// 设置地图加载状态
|
|
|
|
mapViewLoaded(loading) {
|
|
|
|
this.loading = loading;
|
|
|
|
if (loading) {
|
|
|
|
this.$refs.progressBar && this.$refs.progressBar.start();
|
|
|
|
} else {
|
|
|
|
this.$refs.progressBar && this.$refs.progressBar.end(true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 设置地图加载进度
|
|
|
|
mapViewProgressAt(percentage) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.progressBar.progressAt(percentage);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 设置新的地图数据
|
|
|
|
setMap(map) {
|
2020-03-20 14:12:02 +08:00
|
|
|
this.$jlmap.setMap(map, this.$store.state.map.mapDevice, {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData});
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
|
|
|
// 刷新地图数据
|
|
|
|
refresh(map) {
|
|
|
|
},
|
|
|
|
// 缩小
|
|
|
|
setShrink() {
|
|
|
|
this.$jlmap.setOptions({type: 'zoom', scale: -1});
|
|
|
|
},
|
|
|
|
// 放大
|
|
|
|
setMagnify() {
|
|
|
|
this.$jlmap.setOptions({type: 'zoom', scale: 1});
|
2019-12-10 16:09:45 +08:00
|
|
|
},
|
|
|
|
mousemove(e) {
|
|
|
|
this.offset = {
|
|
|
|
x: e.offsetX + Number(this.dataZoom.offsetX),
|
|
|
|
y: e.offsetY + Number(this.dataZoom.offsetY)
|
|
|
|
};
|
2019-12-30 14:06:42 +08:00
|
|
|
this.$store.dispatch('map/setMousemove');
|
2020-03-11 15:10:08 +08:00
|
|
|
},
|
2020-03-20 17:36:07 +08:00
|
|
|
// 综合演练切换现地行调模式
|
|
|
|
changePrdType(val) {
|
2020-03-23 13:52:50 +08:00
|
|
|
const nameList = Object.keys(this.$store.state.map.map || {});
|
2020-03-20 17:36:07 +08:00
|
|
|
let list = [];
|
|
|
|
nameList.forEach(item => {
|
|
|
|
if (item !== 'skinVO') {
|
2020-05-15 13:16:55 +08:00
|
|
|
const data = this.$store.state.map.map[item];
|
|
|
|
if (data && data.constructor === Array) {
|
|
|
|
list = [...list, ...data];
|
|
|
|
}
|
2020-03-20 17:36:07 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
this.$jlmap.updatePrdType(val, nameList);
|
|
|
|
},
|
2020-03-11 15:10:08 +08:00
|
|
|
// 切换现地行调显示界面(绘图和预览页面下)
|
|
|
|
setShowMode(showMode) {
|
2020-03-13 13:01:58 +08:00
|
|
|
if (this.showMode !== showMode) {
|
|
|
|
this.setShowStation('');
|
2020-04-28 18:16:04 +08:00
|
|
|
this.localStationShow && this.$refs.switchStation.inintShowStation();
|
2020-03-13 13:01:58 +08:00
|
|
|
}
|
|
|
|
this.showMode = showMode;
|
2020-03-25 15:22:52 +08:00
|
|
|
const nameList = Object.keys(this.$store.state.map.map || {});
|
2020-03-13 13:01:58 +08:00
|
|
|
let list = [];
|
|
|
|
nameList.forEach(item => {
|
2020-05-11 17:43:33 +08:00
|
|
|
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
|
2020-03-13 13:01:58 +08:00
|
|
|
list = [...list, ...this.$store.state.map.map[item]];
|
|
|
|
}
|
|
|
|
});
|
2020-03-11 15:10:08 +08:00
|
|
|
this.$jlmap.updateShowMode(list, showMode);
|
2020-05-12 16:45:45 +08:00
|
|
|
EventBus.$emit('select_DrawType', showMode);
|
2020-03-13 13:01:58 +08:00
|
|
|
},
|
2020-07-24 15:28:45 +08:00
|
|
|
setShowStation(stationCode, setCenter) {
|
2020-03-13 13:01:58 +08:00
|
|
|
const nameList = Object.keys(this.$store.state.map.map);
|
|
|
|
let list = [];
|
|
|
|
nameList.forEach(item => {
|
2020-05-11 17:40:52 +08:00
|
|
|
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
|
2020-06-01 10:57:19 +08:00
|
|
|
if (item === 'trainList') {
|
|
|
|
this.$store.state.map.map[item].forEach(elem => {
|
|
|
|
elem && list.push(elem);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
list = [...list, ...this.$store.state.map.map[item]];
|
|
|
|
}
|
2020-03-13 13:01:58 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
this.$jlmap.updateShowStation(list, stationCode);
|
2020-07-24 15:28:45 +08:00
|
|
|
!setCenter && this.setCenter(stationCode);
|
2020-07-06 17:02:13 +08:00
|
|
|
},
|
|
|
|
setOffset(data, num, sum) {
|
|
|
|
this.$jlmap.switchScreen(data, num, sum);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
2020-01-07 10:52:44 +08:00
|
|
|
.mask{
|
|
|
|
opacity: 0;
|
|
|
|
background: #000;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
z-index: 9;
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
.jlmap-canvas {
|
|
|
|
position: relative;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-o-user-select: none;
|
|
|
|
-khtml-user-select: none;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
user-select: none;
|
2020-07-06 17:02:13 +08:00
|
|
|
background: #000;
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
2019-12-10 16:09:45 +08:00
|
|
|
.title{
|
|
|
|
text-align: right;
|
|
|
|
font-size: 14px;
|
|
|
|
color: #606266;
|
|
|
|
line-height: 32px;
|
|
|
|
-webkit-box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
font-weight: 700;
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
.zoom-view {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
background: #fff;
|
|
|
|
padding-top: 5px;
|
|
|
|
height: 42px;
|
|
|
|
border-bottom: 1px #f3f3f3 solid;
|
|
|
|
border-right: 1px #f3f3f3 solid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/deep/ {
|
|
|
|
.el-form.el-form--inline {
|
|
|
|
height: 28px !important;
|
|
|
|
line-height: 28px !important
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-loading-mask {
|
|
|
|
background-color: rgba(0, 0, 0, 0.3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|