This commit is contained in:
fan 2019-12-23 13:32:58 +08:00
commit 907881eb7a
14 changed files with 149 additions and 27 deletions

View File

@ -44,9 +44,9 @@ deviceRender[deviceType.StationControl] = {
zlevel: 1
};
/** ImageControl渲染配置*/
deviceRender[deviceType.ImageControl] = {
_type: deviceType.ImageControl,
/** Resource渲染配置*/
deviceRender[deviceType.Resource] = {
_type: deviceType.Resource,
zlevel: 1
};

View File

@ -5,7 +5,7 @@ const deviceType = {
ZcControl: 'ZcControl',
LcControl: 'LcControl',
LimitControl: 'LimitControl',
ImageControl: 'ImageControl',
Resource: 'Resource',
Station: 'Station',
StationStand: 'StationStand',
Esp: 'Esp',

View File

@ -4,7 +4,7 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
export default class ImageControl extends Group {
export default class Resource extends Group {
constructor(model, style) {
super();
this._code = model.code;

View File

@ -2,7 +2,7 @@ import deviceType from '../constant/deviceType';
import Section from './Section/index.js';
import Signal from './Signal/index.js';
import Station from './Station/index.js';
import ImageControl from './ImageControl/index.js';
import Resource from './Resource/index.js';
import LcControl from './LcControl/index.js';
import LimitControl from './LimitControl/index.js';
import Switch from './Switch/index.js';
@ -22,7 +22,7 @@ const mapShape = {};
mapShape[deviceType.Section] = Section;
mapShape[deviceType.Signal] = Signal;
mapShape[deviceType.Station] = Station;
mapShape[deviceType.ImageControl] = ImageControl;
mapShape[deviceType.Resource] = Resource;
mapShape[deviceType.LcControl] = LcControl;
mapShape[deviceType.LimitControl] = LimitControl;
mapShape[deviceType.Switch] = Switch;

View File

@ -100,7 +100,7 @@ export function parser(data, skinCode) {
}, this);
zrUtil.each(data.resourceList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ImageControl, elem, propConvert);
mapDevice[elem.code] = createDevice(deviceType.Resource, elem, propConvert);
}, this);
zrUtil.each(data.trainList || [], elem => {
@ -198,7 +198,7 @@ export function updateMapData(state, model) {
case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break;
case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break;
case deviceType.Resource: updateForList(model, state, 'resourceList'); break;
case deviceType.Train: updateForList(model, state, 'trainList'); break;
case deviceType.TrainWindow: updateForList(model, state, 'trainWindowList'); break;
case deviceType.Line: updateForList(model, state, 'lineList'); break;

View File

@ -72,6 +72,7 @@ const PlanMonitorDetail = () => import('@/views/planMonitor/detail');
const DesignPlatformHome = () => import('@/views/designPlatform/home');
const DesignPlatform = () => import('@/views/designPlatform/index');
const MapPreview = () => import('@/views/designPlatform/mapPreview');
const MapPreviewNew = () => import('@/views/designPlatform/mapPreviewNew');
const DesignPlatformUser = () => import('@/views/designUser/index');
@ -171,7 +172,8 @@ export const UrlConfig = {
runPlan: '/design/runPlan/detail',
scriptHome: '/design/script/home',
display: '/design/display',
mapPreview: '/design/mapPreview'
mapPreview: '/design/mapPreview',
mapPreviewNew: '/design/mapPreviewNew'
},
designUser: {
prefix: '/design/userlist/home',
@ -397,6 +399,11 @@ export const asyncRouter = [
component: MapPreview,
hidden: true
},
{ // 新版地图预览
path: 'mapPreviewNew/:mapId',
component: MapPreviewNew,
hidden: true
}
]
}

View File

@ -108,7 +108,11 @@ export default {
break;
}
case 'mapPreview': {
this.$router.push({ path: `${UrlConfig.design.mapPreview}/${obj.mapId}` });
if (obj.drawWay) {
this.$router.push({ path: `${UrlConfig.design.mapPreviewNew}/${obj.mapId}` });
} else {
this.$router.push({ path: `${UrlConfig.design.mapPreview}/${obj.mapId}` });
}
break;
}
}
@ -131,7 +135,8 @@ export default {
name: this.$t('designPlatform.mapPreview'),
type: 'mapPreview',
mapId: elem.id,
cityCode: elem.cityCode
cityCode: elem.cityCode,
drawWay: elem.drawWay
}
];
this.isAdministrator() ? elem.children.push({id: '2', name: this.$t('designPlatform.lessonDesign'), type: 'lessonDesign', mapId: elem.id, cityCode: elem.cityCode}) : '';

View File

@ -0,0 +1,108 @@
<template>
<div class="map-view">
<jlmap-visual ref="jlmapVisual" />
</div>
</template>
<script>
import JlmapVisual from '@/views/newMap/jlmapNew/index';
import { loadMapDataById } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'MapPreview',
components: {
JlmapVisual
},
props: {
widthLeft: {
type: Number,
required: true
}
},
data() {
return {
size: {
width: document.documentElement.clientWidth - 400,
height: document.documentElement.clientHeight - 80
}
};
},
computed: {
mapId() {
return this.$route.params.mapId;
},
height() {
return this.$store.state.app.height - 50 - 30;
}
},
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);
}
},
async beforeDestroy() {
await this.$store.dispatch('map/mapClear');
},
async mounted() {
await this.setWindowSize();
await this.initLoadData();
},
methods: {
async initLoadData() { //
if (parseInt(this.mapId)) {
await this.loadMapDataById(this.mapId);
} else {
this.endViewLoading();
}
},
// id
async loadMapDataById(mapId) {
try {
await this.$store.dispatch('training/changeMode', { mode: null });
loadMapDataById(mapId).then(()=>{
this.$store.dispatch('training/over');
this.$store.dispatch('training/setMapDefaultState');
this.$store.dispatch('map/clearJlmapTrainView');
});
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
//
endViewLoading(isSuccess) {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
setWindowSize() {
this.$nextTick(() => {
const width = this.$store.state.app.width - (this.widthLeft || 450);
const height = this.height;
this.$store.dispatch('config/resize', { width, height });
});
}
}
};
</script>
<style lang="scss" scoped>
.map-view {
float: left;
width: auto;
}
</style>

View File

@ -79,9 +79,10 @@ export default {
try {
if (val) {
this.setMap(val);
} else {
this.mapViewLoaded(false);
}
// else {
// this.mapViewLoaded(false);
// }
} catch (error) {
console.log('[ERROR] ', error);
this.mapViewLoaded(false);

View File

@ -91,9 +91,10 @@ export default {
try {
if (val) {
this.setMap(val);
} else {
this.mapViewLoaded(false);
}
// } else {
// this.mapViewLoaded(false);
// }
} catch (error) {
console.log('[ERROR] ', error);
this.mapViewLoaded(false);

View File

@ -23,12 +23,12 @@
</el-radio-group>
</el-form-item>
<!-- 是否先锁闭 -->
<el-form-item :label="$t('map.lockFirst') + ':'" prop="lockFirst">
<!-- <el-form-item :label="$t('map.lockFirst') + ':'" prop="lockFirst">
<el-radio-group v-model="addModel.lockFirst">
<el-radio :label="true">{{ $t('map.are') }}</el-radio>
<el-radio :label="false">{{ $t('map.deny') }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form-item> -->
<el-form-item :label="$t('map.delayUnlockingTime') + ':'" prop="delayReleaseTime">
<el-input-number v-model="addModel.delayReleaseTime" :min="0" />
<span>s</span>

View File

@ -36,7 +36,7 @@ import ConfigData from './config/data';
import { deepAssign } from '@/utils/index';
export default {
name: 'ImageControlDraft',
name: 'ResourceDraft',
components: {
ConfigList,
ConfigData
@ -185,7 +185,7 @@ export default {
deviceSelect(selected) {
this.$refs.form.resetFields();
this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'ImageControl'.toUpperCase()) {
if (selected && selected._type.toUpperCase() === 'Resource'.toUpperCase()) {
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
}
@ -193,9 +193,9 @@ export default {
create() {
this.$refs.make.validate((valid) => {
if (valid) {
const uid = getUID('ImageControl', this.resourceList);
const uid = getUID('Resource', this.resourceList);
const model = {
_type: 'ImageControl',
_type: 'Resource',
code: uid,
name: uid,
width: this.addModel.width,
@ -216,7 +216,7 @@ export default {
edit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'ImageControl'}, this.editModel);
const data = Object.assign({_type: 'Resource'}, this.editModel);
this.$emit('updateMapModel', data);
}
});
@ -224,7 +224,7 @@ export default {
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'ImageControl'.toUpperCase()) {
if (selected && selected._type.toUpperCase() === 'Resource'.toUpperCase()) {
const _that = this;
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('map.confirm'),

View File

@ -149,9 +149,9 @@
/>
</el-tab-pane> -->
<el-tab-pane :label="$t('map.image')" class="tab_pane_box" name="ImageControl">
<el-tab-pane :label="$t('map.image')" class="tab_pane_box" name="Resource">
<Image-control-draft
ref="ImageControl"
ref="Resource"
:selected="selected"
@updateMapModel="updateMapModel"
@setCenter="setCenter"

View File

@ -221,7 +221,7 @@ export default {
}
// console.log(jsonData, '');
if (!jsonData[0].downTrack && !jsonData[0].upTrack) {
if (that.$route.query.lineCode == '02') {
that.loadingDig.close();
that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`);
} else {