This commit is contained in:
joylink_cuiweidong 2019-12-04 13:01:22 +08:00
commit f97bd74c39
19 changed files with 325 additions and 345 deletions

View File

@ -558,4 +558,5 @@ export default {
chargeStationList:'Managed station list', chargeStationList:'Managed station list',
createModel: 'Create model:', createModel: 'Create model:',
startingPoint: 'Starting point:', startingPoint: 'Starting point:',
endingPoint: 'Ending point:'
}; };

View File

@ -551,5 +551,6 @@ export default {
rightAssociatedSection: '右关联区段:', rightAssociatedSection: '右关联区段:',
chargeStationList:'管理车站列表', chargeStationList:'管理车站列表',
createModel: '创建方式:', createModel: '创建方式:',
startingPoint: '起点:' startingPoint: '起点:',
endingPoint: '终点:'
}; };

View File

@ -150,10 +150,6 @@ class Jlmap {
} }
} }
setLayerVisible(layer) {
this.$painter.setLayerVisible(layer);
}
setLevelVisible(list) { setLevelVisible(list) {
this.$painter.setLevelVisible(list); this.$painter.setLevelVisible(list);
} }

View File

@ -241,7 +241,7 @@ class MouseController extends Eventful {
deviceList.forEach( item =>{ deviceList.forEach( item =>{
if (item.instance && item.instance._type == deviceType.Section) { if (item.instance && item.instance._type == deviceType.Section) {
let deviceBoundingRect = {}; let deviceBoundingRect = {};
if (item.type == '03') { if (item.type == '04') {
deviceBoundingRect = { deviceBoundingRect = {
x1: item.namePosition.x, x1: item.namePosition.x,
y1: item.namePosition.y, y1: item.namePosition.y,

View File

@ -27,11 +27,6 @@ class Painter {
* @param {*} config * @param {*} config
*/ */
initLevels() { initLevels() {
// 图层分级策略
this.layerBranch = {};
this.layerBranch['01'] = (type) => { return type == deviceType.Link; }; // 逻辑图层级
this.layerBranch['02'] = (type) => { return type != deviceType.Link; }; // 物理图层级
this.layerBranch['03'] = (type) => { return true; }; // 混合图层级
// 添加父级图层 // 添加父级图层
this.parentLevel = new Group({ name: '__parent__' }); this.parentLevel = new Group({ name: '__parent__' });
@ -43,9 +38,6 @@ class Painter {
this.mapInstanceLevel[type] = level; this.mapInstanceLevel[type] = level;
this.parentLevel.add(level); this.parentLevel.add(level);
}); });
// 设置默认显示图级
this.setLayerVisible('02');
} }
/** /**
@ -193,21 +185,6 @@ class Painter {
} }
} }
/**
* 设置逻辑和物理图层
* @param {*} layer
*/
setLayerVisible(layer) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.mapInstanceLevel[type];
if (this.layerBranch[layer](type)) {
level.show();
} else {
level.hide();
}
}, this);
}
/** /**
* 设置图层可见 * 设置图层可见
* @param {*} code * @param {*} code

View File

@ -9,8 +9,8 @@ import { EAxle } from './EAxle'; // 创建计轴 (私有)
import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头 import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头
import ELimitName from './ELimitName'; // 成都三号线 限速名称 import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle'; import JTriangle from '../../utils/JTriangle';
import Rect from 'zrender/src/graphic/shape/Rect';
import router from '@/router'; import router from '@/router';
import EHighlight from '../element/EHighlight';
/** 区段*/ /** 区段*/
export default class Section extends Group { export default class Section extends Group {
@ -24,8 +24,8 @@ export default class Section extends Group {
this.style = style; this.style = style;
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.createMouse(); // 框选鼠标移入移事件
this.setState(model); this.setState(model);
this.checkIsDrawMap();
} }
create() { create() {
@ -823,31 +823,6 @@ export default class Section extends Group {
} }
} }
createMouse() {
const rect = this.getBoundingRect();
this.lineBorder = new Rect({
zlevel: this.zlevel,
z: this.z - 1,
shape: rect,
style: {
lineDash: [3, 3],
stroke: '#fff',
fill: this.style.transparentColor
}
});
this.add(this.lineBorder);
this.lineBorder.hide();
}
mouseout() {
this.lineBorder && this.lineBorder.show();
}
mouseover() {
this.lineBorder && this.lineBorder.hide();
}
/** 计算提示位置*/ /** 计算提示位置*/
getShapeTipPoint() { getShapeTipPoint() {
let rect = this.getBoundingRect(); let rect = this.getBoundingRect();
@ -874,4 +849,18 @@ export default class Section extends Group {
return super.getBoundingRect(); return super.getBoundingRect();
} }
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this.section);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }

View File

@ -12,6 +12,7 @@ import ESigName from './ESigName';
import EMouse from './EMouse'; import EMouse from './EMouse';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
import EHighlight from '../element/EHighlight';
class Signal extends Group { class Signal extends Group {
constructor(model, style) { constructor(model, style) {
@ -28,6 +29,7 @@ class Signal extends Group {
this.createMouseEvent(); this.createMouseEvent();
this.transformRotation(this); this.transformRotation(this);
this.setState(model); this.setState(model);
this.checkIsDrawMap();
} }
create() { create() {
@ -510,6 +512,19 @@ class Signal extends Group {
y: rect.y - offsetY y: rect.y - offsetY
}; };
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }
export default Signal; export default Signal;

View File

@ -2,73 +2,88 @@
* 车站 * 车站
*/ */
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import ETextName from '../element/ETextName'; // 名称文字 (共有) import ETextName from '../element/ETextName';
import EHighlight from '../element/EHighlight'; // 名称文字 (共有)
export default class Station extends Group { export default class Station extends Group {
constructor(model, style) { constructor(model, style) {
super(); super();
this._code = model.code; this._code = model.code;
this._type = model._type; this._type = model._type;
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.z = 40; this.z = 40;
this.model = model; this.model = model;
this.style = style; this.style = style;
this.create(); this.create();
this.setState(model); this.setState(model);
} this.checkIsDrawMap();
}
create() { create() {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (model.visible) { if (model.visible) {
// 公里标名称是否显示 // 公里标名称是否显示
this.stationText = new ETextName({ this.stationText = new ETextName({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
position: [0, 0], position: [0, 0],
x: model.position.x, x: model.position.x,
y: model.position.y, y: model.position.y,
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.nameFont || 18, fontSize: model.nameFont || 18,
fontFamily: style.fontFamily, fontFamily: style.fontFamily,
text: model.name, text: model.name,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top', textVerticalAlign: 'top',
textFill: model.nameFontColor textFill: model.nameFontColor
}); });
this.add(this.stationText); this.add(this.stationText);
const path = window.location.href; const path = window.location.href;
if (style.Station.kmPostShow || path.includes('/map/draw')) { if (style.Station.kmPostShow || path.includes('/map/draw')) {
// 公里标是否显示 // 公里标是否显示
let direction = 1; let direction = 1;
if (this.style.Station.kilometerPosition == 'up') { if (this.style.Station.kilometerPosition == 'up') {
direction = -1; direction = -1;
} }
this.mileageText = new ETextName({ this.mileageText = new ETextName({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
position: [0, 0], position: [0, 0],
x: model.position.x, x: model.position.x,
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction), y: model.position.y + ((parseInt(model.nameFont) + 2) * direction),
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.kmPostFont || 18, fontSize: model.kmPostFont || 18,
fontFamily: style.fontFamily, fontFamily: style.fontFamily,
text: model.kmPost, text: model.kmPost,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top', textVerticalAlign: 'top',
textFill: model.kmPostFontColor textFill: model.kmPostFontColor
}); });
this.add(this.mileageText); this.add(this.mileageText);
} }
} }
} }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
setState(model) { setState(model) {
} }
getShapeTipPoint() { getShapeTipPoint() {
return null; return null;
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }

View File

@ -9,6 +9,7 @@ import ESafeStand from './ESafeStand';
import ESafeEmergent from './ESafeEmergent'; import ESafeEmergent from './ESafeEmergent';
import EMouse from './EMouse'; import EMouse from './EMouse';
import EJump from './EJump'; import EJump from './EJump';
import EHighlight from '../element/EHighlight';
class StationStand extends Group { class StationStand extends Group {
constructor(model, style) { constructor(model, style) {
@ -24,6 +25,7 @@ class StationStand extends Group {
this.createMouseEvent(); this.createMouseEvent();
this.setVisible(model.visible); this.setVisible(model.visible);
this.setState(model); this.setState(model);
this.checkIsDrawMap();
} }
create() { create() {
const model = this.model; const model = this.model;
@ -413,5 +415,19 @@ class StationStand extends Group {
} }
return null; return null;
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }
export default StationStand; export default StationStand;

View File

@ -10,6 +10,7 @@ import ESwLocal from './ESwLocal.js';
import ESwLnversion from './ESwLnversion'; import ESwLnversion from './ESwLnversion';
import ELockRect from './ELockRect'; import ELockRect from './ELockRect';
import EMouse from './EMouse'; import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
export default class Switch extends Group { export default class Switch extends Group {
constructor(model, style) { constructor(model, style) {
@ -25,6 +26,7 @@ export default class Switch extends Group {
this.createLockRect(); // 创建单锁矩形框显示 this.createLockRect(); // 创建单锁矩形框显示
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
this.checkIsDrawMap();
} }
createMouseEvent() { createMouseEvent() {
@ -422,4 +424,18 @@ export default class Switch extends Group {
} }
return null; return null;
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }

View File

@ -0,0 +1,47 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
class EHighlight extends Group {
constructor(device) {
super();
this.device = device;
this.selected = false;
this.create();
}
create() {
if (this.device) {
const rect = this.device.getBoundingRect();
this.lineBorder = new Rect({
zlevel: this.device.zlevel,
z: this.device.z + 1,
shape: rect,
style: {
lineDash: [3, 3],
stroke: '#fff',
fill: 'rgba(204,255,255,0.5)'
}
});
this.add(this.lineBorder);
this.lineBorder.hide();
}
}
mouseover() {
this.lineBorder && this.lineBorder.show();
}
mouseout() {
!this.selected && this.lineBorder && this.lineBorder.hide();
}
drawSelected(selected) {
if (selected) {
this.lineBorder.show();
this.selected = true;
} else {
this.lineBorder.hide();
this.selected = false;
}
}
}
export default EHighlight;

View File

@ -84,110 +84,110 @@ function saveMapDeviceDefaultRelations(state) {
const map = state.map; const map = state.map;
const deviceMap = Vue.prototype.$jlmap.mapDevice; const deviceMap = Vue.prototype.$jlmap.mapDevice;
// 是否集中站 // 是否集中站
if (map.stationControlList && map.stationControlList.length) { // if (map.stationControlList && map.stationControlList.length) {
map.stationControlList.forEach(elem => { // map.stationControlList.forEach(elem => {
const station = deviceMap[elem.stationCode]; // const station = deviceMap[elem.stationCode];
if (station) { // if (station) {
station.centralized = true; // station.centralized = true;
} // }
}); // });
} // }
// 设置区段关联 // 设置区段关联
if (map.sectionList && map.sectionList.length) { if (map.sectionList && map.sectionList.length) {
map.sectionList.forEach(elem => { // map.sectionList.forEach(elem => {
if (elem.type !== '03') { // if (elem.type !== '03') {
const station = deviceMap[elem.parentCode]; // const station = deviceMap[elem.parentCode];
if (station) { // if (station) {
elem.stationCode = station.stationCode; // elem.stationCode = station.stationCode;
} // }
} else { // } else {
elem.parentCode = ''; // elem.parentCode = '';
} // }
if (elem.type === '01') { // if (elem.type === '01') {
elem.nameShow == true; // elem.nameShow == true;
} // }
}); // });
} }
// 站台轨设置 // 站台轨设置
if (map.stationStandList && map.stationStandList.length && map.sectionList && map.sectionList.length) { // if (map.stationStandList && map.stationStandList.length && map.sectionList && map.sectionList.length) {
map.stationStandList.forEach((stand) => { // map.stationStandList.forEach((stand) => {
const stopPoint = deviceMap[stand.stopPointCode]; // const stopPoint = deviceMap[stand.stopPointCode];
if (stopPoint) { // if (stopPoint) {
map.sectionList.forEach(section => { // map.sectionList.forEach(section => {
if (section.type === '01' && // if (section.type === '01' &&
stopPoint.linkCode === section.linkCode && // stopPoint.linkCode === section.linkCode &&
stopPoint.offset >= section.offsetLeft && // stopPoint.offset >= section.offsetLeft &&
stopPoint.offset <= section.offsetRight) { // stopPoint.offset <= section.offsetRight) {
section.isStandTrack = true; // section.isStandTrack = true;
if (!section.standTrackName) { // if (!section.standTrackName) {
section.standTrackName = section.name.replace(section.name.slice(0, 2), 'ZT'); // section.standTrackName = section.name.replace(section.name.slice(0, 2), 'ZT');
} // }
if (!section.standTrackNamePosition) { // if (!section.standTrackNamePosition) {
section.standTrackNamePosition = { x: 0, y: 0 }; // section.standTrackNamePosition = { x: 0, y: 0 };
} // }
} // }
}); // });
} // }
}); // });
} // }
// 折返轨设置 // 折返轨设置
if (map.stopPointList && map.stopPointList.length && map.sectionList && map.sectionList.length) { // if (map.stopPointList && map.stopPointList.length && map.sectionList && map.sectionList.length) {
map.stopPointList.forEach(stopPoint => { // map.stopPointList.forEach(stopPoint => {
if (stopPoint.isTurningPoint) { // if (stopPoint.isTurningPoint) {
map.sectionList.forEach(section => { // map.sectionList.forEach(section => {
if (section.type === '01' && // if (section.type === '01' &&
stopPoint.linkCode === section.linkCode && // stopPoint.linkCode === section.linkCode &&
stopPoint.offset >= section.offsetLeft && // stopPoint.offset >= section.offsetLeft &&
stopPoint.offset <= section.offsetRight) { // stopPoint.offset <= section.offsetRight) {
section.isReentryTrack = true; // section.isReentryTrack = true;
if (!section.reentryTrackName) { // if (!section.reentryTrackName) {
section.reentryTrackName = section.name.replace(section.name.slice(0, 2), 'ZF'); // section.reentryTrackName = section.name.replace(section.name.slice(0, 2), 'ZF');
} // }
if (!section.reentryTrackNamePosition) { // if (!section.reentryTrackNamePosition) {
section.reentryTrackNamePosition = { x: 0, y: 0 }; // section.reentryTrackNamePosition = { x: 0, y: 0 };
} // }
} // }
}); // });
} // }
}); // });
} // }
// 设置道岔区段 // 设置道岔区段
if (map.switchList && map.switchList.length && map.sectionList && map.sectionList.length) { if (map.switchList && map.switchList.length && map.sectionList && map.sectionList.length) {
map.switchList.forEach(elem => { map.switchList.forEach(elem => {
const sectiona = deviceMap[elem.sectionACode]; const sectiona = deviceMap[elem.sectionACode];
if (sectiona && sectiona.type !== '03') { if (sectiona && sectiona.type !== '03') {
sectiona.nameShow = false; // sectiona.nameShow = false;
sectiona.isSwitchSection = true; // sectiona.isSwitchSection = true;
sectiona.relSwitchCode = elem.code; // sectiona.relSwitchCode = elem.code;
} }
const sectionb = deviceMap[elem.sectionBCode]; const sectionb = deviceMap[elem.sectionBCode];
if (sectionb && sectionb.type !== '03') { if (sectionb && sectionb.type !== '03') {
sectionb.nameShow = false; // sectionb.nameShow = false;
sectionb.isSwitchSection = true; // sectionb.isSwitchSection = true;
sectionb.relSwitchCode = elem.code; // sectionb.relSwitchCode = elem.code;
} }
const sectionc = deviceMap[elem.sectionCCode]; const sectionc = deviceMap[elem.sectionCCode];
if (sectionc && sectionc.type !== '03') { if (sectionc && sectionc.type !== '03') {
sectionc.nameShow = false; // sectionc.nameShow = false;
sectionc.isSwitchSection = true; // sectionc.isSwitchSection = true;
sectionc.relSwitchCode = elem.code; // sectionc.relSwitchCode = elem.code;
}
let sectionp = '';
if (sectiona && sectiona.parentCode) {
sectionp = deviceMap[sectiona.parentCode];
} else if (sectionb && sectionb.parentCode) {
sectionp = deviceMap[sectionb.parentCode];
} else if (sectionc && sectionc.parentCode) {
sectionp = deviceMap[sectionc.parentCode];
}
if (sectionp) {
sectionp.relSwitchCode = elem.code;
} }
// let sectionp = '';
// if (sectiona && sectiona.parentCode) {
// sectionp = deviceMap[sectiona.parentCode];
// } else if (sectionb && sectionb.parentCode) {
// sectionp = deviceMap[sectionb.parentCode];
// } else if (sectionc && sectionc.parentCode) {
// sectionp = deviceMap[sectionc.parentCode];
// }
// if (sectionp) {
// sectionp.relSwitchCode = elem.code;
// }
}); });
} }

View File

@ -137,7 +137,7 @@ export default {
// //
const path = window.location.href; const path = window.location.href;
let mouseWheelFlag = false; let mouseWheelFlag = false;
if (path.includes('design/userlist/map/draw')) { if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) {
mouseWheelFlag = true; mouseWheelFlag = true;
} }
@ -183,10 +183,6 @@ export default {
}, 100); }, 100);
}); });
}, },
//
setLayerVisible(layer) {
this.$jlmap && this.$jlmap.setLayerVisible(layer);
},
// //
setLevelVisible(levels) { setLevelVisible(levels) {
this.$jlmap && this.$jlmap.setLevelVisible(levels); this.$jlmap && this.$jlmap.setLevelVisible(levels);

View File

@ -2,31 +2,13 @@
<el-dialog v-dialogDrag :title="$t('map.layerDisplay')" :visible.sync="dialogTableVisible" class="view_box" width="460px" :before-close="doClose" :modal-append-to-body="false"> <el-dialog v-dialogDrag :title="$t('map.layerDisplay')" :visible.sync="dialogTableVisible" class="view_box" width="460px" :before-close="doClose" :modal-append-to-body="false">
<el-row type="flex" justify="center" class="content_box"> <el-row type="flex" justify="center" class="content_box">
<el-form label-width="80px" class="demo-ruleForm"> <el-form label-width="80px" class="demo-ruleForm">
<el-form-item :label="$t('map.viewShows')">
<el-checkbox-group v-model="viewSelect" :min="1" @change="handleSelectView">
<el-checkbox :label="ViewMode.LOGIC">{{ $t('map.logicalView') }}</el-checkbox>
<el-checkbox :label="ViewMode.PHYSICAL">{{ $t('map.physicalView') }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item :label="$t('map.contentShows')"> <el-form-item :label="$t('map.contentShows')">
<el-row v-if="ViewMode.LOGIC === viewSelect[0] && viewSelect.length == 1" class="logical-view" type="flex" justify="center" style="width: 100%;"> <el-row class="physical-view" type="flex" justify="center" style="width: 100%;">
<el-checkbox-group v-model="logicalLevelsSelect" @change="handleSelectLogicalView">
<el-checkbox v-for="view in LogicalViewTypeList" :key="view.code" :label="view.code" size="mini">
{{ view.name }}</el-checkbox>
</el-checkbox-group>
</el-row>
<el-row v-if="ViewMode.PHYSICAL === viewSelect[0] && viewSelect.length == 1" class="physical-view" type="flex" justify="center" style="width: 100%;">
<el-checkbox-group v-model="physicalLevelsSelect" @change="handleSelectPhysicalView"> <el-checkbox-group v-model="physicalLevelsSelect" @change="handleSelectPhysicalView">
<el-checkbox v-for="view in PhysicalViewTypeList" :key="view.code" :label="view.code"> <el-checkbox v-for="view in PhysicalViewTypeList" :key="view.code" :label="view.code">
{{ view.name }}</el-checkbox> {{ view.name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-row> </el-row>
<el-row v-if=" viewSelect.length == 2" class="physical-view" type="flex" justify="center" style="width: 100%;">
<el-checkbox-group v-model="hybridLevelsSelect" @change="handleSelectHybridView">
<el-checkbox v-for="view in HybridViewTypeList" :key="view.code" :label="view.code">
{{ view.name }}</el-checkbox>
</el-checkbox-group>
</el-row>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-row> </el-row>
@ -51,22 +33,10 @@ export default {
{ code: 'Signal', name: this.$t('map.signal') }, { code: 'Signal', name: this.$t('map.signal') },
{ code: 'Switch', name: this.$t('map.switch') } { code: 'Switch', name: this.$t('map.switch') }
], ],
HybridViewTypeList: [], // defaultPhysicalSelect: [], //
physicalLevelsSelect: [] // list
defaultLogicalSelect: [],
defaultPhysicalSelect: [],
defaultHybridSelect: [],
logicalLevelsSelect: [],
physicalLevelsSelect: [],
hybridLevelsSelect: [] //
}; };
}, },
watch: {
'$store.state.map.mapDataLoadedCount': function (val) {
this.handleSelectView(this.viewSelect);
}
},
mounted() { mounted() {
this.initPage(); this.initPage();
}, },
@ -78,53 +48,17 @@ export default {
this.dialogTableVisible = false; this.dialogTableVisible = false;
}, },
initPage() { initPage() {
this.$Dictionary.logicalViewType().then(list => {
this.LogicalViewTypeList = list;
list.forEach(v => {
this.HybridViewTypeList.push(v);
this.hybridLevelsSelect.push(v.code);
this.defaultHybridSelect.push(v.code);
});
this.LogicalViewTypeList.forEach(elem => {
this.logicalLevelsSelect.push(elem.code);
this.defaultLogicalSelect.push(elem.code);
});
});
this.$Dictionary.physicalViewType().then(list => { this.$Dictionary.physicalViewType().then(list => {
this.PhysicalViewTypeList = list; this.PhysicalViewTypeList = list;
list.forEach(v => {
this.HybridViewTypeList.push(v);
this.hybridLevelsSelect.push(v.code);
this.defaultHybridSelect.push(v.code);
});
this.PhysicalViewTypeList.forEach(elem => { this.PhysicalViewTypeList.forEach(elem => {
this.physicalLevelsSelect.push(elem.code); this.physicalLevelsSelect.push(elem.code);
this.defaultPhysicalSelect.push(elem.code); // this.defaultPhysicalSelect.push(elem.code);
}); });
}); });
}, },
handleSelectView(value) {
if (value.length == 2) {
this.$emit('handleSelectView', '03');
this.hybridLevelsSelect = this.copyList(this.defaultHybridSelect);
} else {
this.$emit('handleSelectView', value);
if (this.viewSelect[0] == this.ViewMode.LOGIC) {
this.logicalLevelsSelect = this.copyList(this.defaultLogicalSelect);
} else {
this.physicalLevelsSelect = this.copyList(this.defaultPhysicalSelect);
}
}
},
handleSelectLogicalView(handle) {
this.$emit('handleSelectLogicalView', handle);
},
handleSelectPhysicalView(handle) { handleSelectPhysicalView(handle) {
this.$emit('handleSelectPhysicalView', handle); this.$emit('handleSelectPhysicalView', handle);
}, },
handleSelectHybridView(handle) {
this.$emit('handleSelectHybridView', handle);
},
copyList(list) { copyList(list) {
return JSON.parse(JSON.stringify(list)); return JSON.parse(JSON.stringify(list));
} }

View File

@ -76,6 +76,7 @@ export default {
viewDraft: 'draft', viewDraft: 'draft',
autoSaveTask: null, autoSaveTask: null,
selected: null, selected: null,
oldSelected: null,
mapInfo: { name: this.$t('map.pleaseSelectMap') }, mapInfo: { name: this.$t('map.pleaseSelectMap') },
timeDemon: null timeDemon: null
}; };
@ -158,32 +159,17 @@ export default {
this.autoSaveTask = null; this.autoSaveTask = null;
} }
}, },
handleSelectControlPage (model) { handleSelectControlPage (model, oldModel) {
if (this.$refs.mapOperate) { if (this.$refs.mapOperate) {
this.$refs.mapOperate.handleSelectControlPage(model); this.$refs.mapOperate.handleSelectControlPage(model, oldModel);
this.$store.dispatch('menuOperation/setMapDrawSelectCount'); this.$store.dispatch('menuOperation/setMapDrawSelectCount');
} }
}, },
handleSelectView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLayerVisible(handle);
}
},
handleSelectLogicalView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
handleSelectPhysicalView(handle) { handleSelectPhysicalView(handle) {
if (this.$refs.jlmapVisual) { if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle); this.$refs.jlmapVisual.setLevelVisible(handle);
} }
}, },
handleSelectHybridView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
clickEvent(em) { clickEvent(em) {
var device = this.getDeviceByEm(em); var device = this.getDeviceByEm(em);
this.onSelect(device); this.onSelect(device);
@ -200,8 +186,11 @@ export default {
return device; return device;
}, },
onSelect(device) { onSelect(device) {
if (this.selected) {
this.oldSelected = this.selected;
}
this.selected = device || null; this.selected = device || null;
this.selected && this.handleSelectControlPage(device); this.selected && this.handleSelectControlPage(device, this.oldSelected);
}, },
onContextmenu(em) { onContextmenu(em) {
this.point = { this.point = {
@ -235,9 +224,8 @@ export default {
if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) { if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) {
if (this.verifySectionPoint(map)) { if (this.verifySectionPoint(map)) {
this.mapSaveing = true; this.mapSaveing = true;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => { this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => { // 稿
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => { saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
// saveNewMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
this.$message.success(this.$t('tip.saveSuccessfully')); this.$message.success(this.$t('tip.saveSuccessfully'));
this.mapSaveing = false; this.mapSaveing = false;
this.initAutoSaveTask(); this.initAutoSaveTask();

View File

@ -66,7 +66,7 @@
@stationSectionCode="stationEnabledTab" @stationSectionCode="stationEnabledTab"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('map.zcZoneControl')" class="tab_pane_box" name="ZcControl"> <!-- <el-tab-pane :label="$t('map.zcZoneControl')" class="tab_pane_box" name="ZcControl">
<zc-control-draft <zc-control-draft
ref="ZcControl" ref="ZcControl"
:selected="selected" :selected="selected"
@ -105,7 +105,7 @@
@updateMapModel="updateMapModel" @updateMapModel="updateMapModel"
@setCenter="setCenter" @setCenter="setCenter"
/> />
</el-tab-pane> </el-tab-pane> -->
<el-tab-pane :label="$t('map.train')" class="tab_pane_box" name="Train"> <el-tab-pane :label="$t('map.train')" class="tab_pane_box" name="Train">
<train-draft <train-draft
ref="Train" ref="Train"
@ -146,14 +146,14 @@
@setCenter="setCenter" @setCenter="setCenter"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('map.button')" class="tab_pane_box" name="ButtonControl"> <!-- <el-tab-pane :label="$t('map.button')" class="tab_pane_box" name="ButtonControl">
<button-draft <button-draft
ref="ButtonControl" ref="ButtonControl"
:selected="selected" :selected="selected"
@updateMapModel="updateMapModel" @updateMapModel="updateMapModel"
@setCenter="setCenter" @setCenter="setCenter"
/> />
</el-tab-pane> </el-tab-pane> -->
<el-tab-pane label="包围框" class="tab_pane_box" name="CheckBox"> <el-tab-pane label="包围框" class="tab_pane_box" name="CheckBox">
<checkbox-draft <checkbox-draft
ref="CheckBox" ref="CheckBox"
@ -175,17 +175,17 @@ import SignalDraft from './signal';
import StationDraft from './station'; import StationDraft from './station';
import StationStandDraft from './stationstand'; import StationStandDraft from './stationstand';
import StationControlDraft from './stationcontrol'; import StationControlDraft from './stationcontrol';
import CounterDraft from './counter'; // import CounterDraft from './counter';
import DelayUnlockDraft from './delayunlock'; // import DelayUnlockDraft from './delayunlock';
import TrainDraft from './train/index'; import TrainDraft from './train/index';
import LineDraft from './line'; import LineDraft from './line';
import TextDraft from './text'; import TextDraft from './text';
import TrainWindowDraft from './trainwindow'; import TrainWindowDraft from './trainwindow';
import ZcControlDraft from './zcControl'; // import ZcControlDraft from './zcControl';
import LimitControlDraft from './limitControl'; // import LimitControlDraft from './limitControl';
import LcControlDraft from './lcControl'; // import LcControlDraft from './lcControl';
import ImageControlDraft from './ImageControl'; import ImageControlDraft from './ImageControl';
import ButtonDraft from './buttonDraft'; // import ButtonDraft from './buttonDraft';
import CheckboxDraft from './checkboxDraft'; import CheckboxDraft from './checkboxDraft';
import { ViewMode } from '@/scripts/ConstDic'; import { ViewMode } from '@/scripts/ConstDic';
@ -193,23 +193,23 @@ import { ViewMode } from '@/scripts/ConstDic';
export default { export default {
name: 'MapOperate', name: 'MapOperate',
components: { components: {
CounterDraft, // CounterDraft,
SectionDraft, SectionDraft,
SwitchDraft, SwitchDraft,
SignalDraft, SignalDraft,
StationDraft, StationDraft,
StationStandDraft, StationStandDraft,
StationControlDraft, StationControlDraft,
DelayUnlockDraft, // DelayUnlockDraft,
TrainWindowDraft, TrainWindowDraft,
TrainDraft, TrainDraft,
LineDraft, LineDraft,
TextDraft, TextDraft,
ZcControlDraft, // ZcControlDraft,
LimitControlDraft, // LimitControlDraft,
LcControlDraft, // LcControlDraft,
ImageControlDraft, ImageControlDraft,
ButtonDraft, // ButtonDraft,
CheckboxDraft CheckboxDraft
}, },
props: { props: {
@ -280,7 +280,7 @@ export default {
}); });
}); });
}, },
handleSelectControlPage(device) { handleSelectControlPage(device, oldDevice) {
const type = device._type; const type = device._type;
if (this.stationType) { if (this.stationType) {
this.enabledTab = 'Station'; this.enabledTab = 'Station';
@ -292,6 +292,12 @@ export default {
this.enabledTab = 'Section'; this.enabledTab = 'Section';
} else { } else {
this.enabledTab = type; this.enabledTab = type;
if ( device && device.instance && typeof device.instance.drawSelected === 'function' ) {
device.instance.drawSelected(true);
}
if ( oldDevice && device.instance && typeof device.instance.drawSelected === 'function') {
oldDevice.instance.drawSelected(false);
}
} }
}, },
stationEnabledTab(type) { stationEnabledTab(type) {

View File

@ -29,7 +29,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div v-if="createModel.type == '01'" class="coordinate"> <div v-if="createModel.type == '01'" class="coordinate">
<span class="title" style="width: 120px">起点:</span> <span class="title" style="width: 120px">{{ this.$t('map.startingPoint') }}</span>
<div class="listWidth"> <div class="listWidth">
<el-form-item label="x" prop="startPoint.x" label-width="25px"> <el-form-item label="x" prop="startPoint.x" label-width="25px">
<el-input-number v-model="createModel.startPoint.x" /> <el-input-number v-model="createModel.startPoint.x" />
@ -41,20 +41,10 @@
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
<div v-if="createModel.type == '01'" class="coordinate"> <el-form-item v-if="createModel.type == '01'" label="距离长度:" prop="length">
<span class="title" style="width: 120px">终点:</span> <el-input-number v-model="createModel.length" />
<div class="listWidth"> </el-form-item>
<el-form-item label="x" prop="endPoint.x" label-width="25px"> <el-form-item v-if="createModel.type == '02'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode">
<el-input-number v-model="createModel.endPoint.x" />
</el-form-item>
</div>
<div class="listWidth">
<el-form-item label="y" prop="endPoint.y" label-width="25px">
<el-input-number v-model="createModel.endPoint.y" />
</el-form-item>
</div>
</div>
<el-form-item v-if="createModel.type == '02'" label="左关联区段:" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable> <el-select v-model="createModel.leftSectionCode" filterable>
<el-option <el-option
v-for="item in PhysicalSectionList" v-for="item in PhysicalSectionList"
@ -69,7 +59,7 @@
@click="hover('getSectionStart')" @click="hover('getSectionStart')"
>{{ $t('map.activate') }}</el-button> >{{ $t('map.activate') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item v-if="createModel.type == '02'" label="右关联区段:" prop="rightSectionCode"> <el-form-item v-if="createModel.type == '02'" :label="$t('map.rightAssociatedSection')" prop="rightSectionCode">
<el-select v-model="createModel.rightSectionCode" filterable> <el-select v-model="createModel.rightSectionCode" filterable>
<el-option <el-option
v-for="item in PhysicalSectionList" v-for="item in PhysicalSectionList"
@ -89,7 +79,7 @@
</div> </div>
<div class="button_box"> <div class="button_box">
<el-button-group class="map-draft-group"> <el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">新建</el-button> <el-button type="primary" size="small" @click="create">{{ this.$t('map.newConstruction') }}</el-button>
</el-button-group> </el-button-group>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -330,7 +320,7 @@ export default {
createModel: { createModel: {
type: '01', type: '01',
startPoint: { x: 0, y: 0 }, startPoint: { x: 0, y: 0 },
endPoint: { x: 0, y: 0 }, length: 0,
leftSectionCode: '', leftSectionCode: '',
rightSectionCode: '' rightSectionCode: ''
}, },
@ -341,11 +331,8 @@ export default {
'startPoint.y': [ 'startPoint.y': [
{ required: true, message: this.$t('rules.destinationCodePointY'), trigger: 'blur' } { required: true, message: this.$t('rules.destinationCodePointY'), trigger: 'blur' }
], ],
'endPoint.x': [ 'length': [
{ required: true, message: this.$t('rules.destinationCodePointX'), trigger: 'blur' } { required: true, message: '请填写距离值', trigger: 'blur' }
],
'endPoint.y': [
{ required: true, message: this.$t('rules.destinationCodePointY'), trigger: 'blur' }
] ]
}, },
typeOptions: [{ typeOptions: [{
@ -518,9 +505,6 @@ export default {
relSwitchCode: [ relSwitchCode: [
{ required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' } { required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' }
], ],
trainPosType: [
{ required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
],
leftSectionCode: [ leftSectionCode: [
{ validator: validateLeftSection, trigger: 'change' } { validator: validateLeftSection, trigger: 'change' }
], ],
@ -825,7 +809,7 @@ export default {
this.editModel.points.splice(index, 1); this.editModel.points.splice(index, 1);
this.logicSectionNums.splice(index, 1); this.logicSectionNums.splice(index, 1);
}, },
// //
create() { create() {
const uid = getUID('Section'); const uid = getUID('Section');
const model = { const model = {
@ -871,7 +855,7 @@ export default {
if (this.createModel.type == '01') { if (this.createModel.type == '01') {
model.points = [ model.points = [
{ x: this.createModel.startPoint.x, y: this.createModel.startPoint.y }, { x: this.createModel.startPoint.x, y: this.createModel.startPoint.y },
{ x: this.createModel.endPoint.x, y: this.createModel.endPoint.y } { x: this.createModel.startPoint.x + this.createModel.length, y: this.createModel.startPoint.y }
]; ];
} else if (this.createModel.type == '02') { } else if (this.createModel.type == '02') {
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode); const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);

View File

@ -527,6 +527,7 @@ export default {
}); });
} }
}); });
console.log(sectiona);
sectiona.relSwitchCode = elem.code; sectiona.relSwitchCode = elem.code;
sectionb.relSwitchCode = elem.code; sectionb.relSwitchCode = elem.code;

View File

@ -27,7 +27,7 @@
<el-table-column :label="this.$t('global.operate')" width="180"> <el-table-column :label="this.$t('global.operate')" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button> <el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button>
<el-button type="text" size="small" @click="editForm(scope.$index, scope.row)">编辑</el-button> <el-button v-if="addModel.type == '01'" type="text" size="small" @click="editForm(scope.$index, scope.row)">编辑</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -228,7 +228,7 @@ export default {
this.permissionPackageId = res.data.permissionId; this.permissionPackageId = res.data.permissionId;
this.permissionGoddsId = res.data.id; this.permissionGoddsId = res.data.id;
this.addModel.name = res.data.name; this.addModel.name = res.data.name;
this.addModel.price = res.data.prdPrice || 0.01; this.addModel.price = res.data.price || 0.01;
this.addModel.remarks = res.data.remarks; this.addModel.remarks = res.data.remarks;
this.addModel.tryUse = res.data.tryUse; this.addModel.tryUse = res.data.tryUse;
this.addModel.tryUseTime = res.data.tryUseTime; this.addModel.tryUseTime = res.data.tryUseTime;
@ -397,8 +397,6 @@ export default {
allPermissionNext(arr) { // allPermissionNext(arr) { //
this.$refs.formData.validate((valid) => { this.$refs.formData.validate((valid) => {
if (valid) { // 使 if (valid) { // 使
// this.addModel['relPermissions'] = arr; // ids
// this.addModel['id'] = this.permissionPackageId;
if (this.isGoods) { // if (this.isGoods) { //
const param = { const param = {
id: this.permissionGoddsId, id: this.permissionGoddsId,