增加 宁波线处理

This commit is contained in:
lVAL 2021-02-05 18:01:16 +08:00
parent d7c17d0935
commit a038ca7040
41 changed files with 790 additions and 322 deletions

View File

@ -574,8 +574,9 @@ class SkinCode extends defaultStyle {
spareColor: '#5b5b5b' // 区段显示颜色 (灰色)
},
core: {
rateOpen: true, // 计算道岔按照区段一半计算
splice: true, // 哈尔滨特殊显示
length: 6 // 道岔单边长度
length: 30 // 道岔单边A长度,
},
trapezoid: { // 直角梯形元素
length: 16, // 默认长度

View File

@ -173,13 +173,30 @@ class Jlmap {
this.$painter.updateScreenNum(opts);
}
setCenterWithOffset(deviceCode, offsetX) {
const arr = Object.keys(this.mapDevice);
if (arr.length != 0) {
const device = this.mapDevice[deviceCode];
if (device && device.instance) {
var rect = createBoundingRect(device.instance);
var dcenter = calculateDCenter(rect, offsetX, { width: this.$zr.getWidth(), height: this.$zr.getHeight() });
this.setOptions(dcenter);
}
} else {
setTimeout(() => {
this.setCenter(deviceCode);
}, 60);
}
}
setCenter(deviceCode) {
const arr = Object.keys(this.mapDevice);
if (arr.length != 0) {
const device = this.mapDevice[deviceCode];
if (device && device.instance) {
var rect = createBoundingRect(device.instance);
var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() });
var dcenter = calculateDCenter(rect, this.$zr.getWidth()/2, { width: this.$zr.getWidth(), height: this.$zr.getHeight() });
this.setOptions(dcenter);
}
} else {
@ -304,8 +321,11 @@ class Jlmap {
return false;
}
setUpdateMapDevice(list = []) {
store.commit('map/updateMapDevice', list);
setUpdateMapDevice(list = [], fetch=true) {
if (fetch) {
store.commit('map/updateMapDevice', list);
}
list.forEach(elem => {
const code = elem.code;
const type = elem._type;
@ -393,8 +413,9 @@ class Jlmap {
this.$painter.updateShowMode(oDevice);
});
}
update(list=[]) {
this.setUpdateMapDevice(list); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
update(list=[], fetch=true) {
this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
const codeList = [];
const controlTransferList = [];
const signalDeviceList = [];

View File

@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
export default class Arrow extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -9,7 +9,7 @@ import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
export default class AutoTurnBack extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;

View File

@ -8,7 +8,7 @@ import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
export default class AutomacticRoute extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;

View File

@ -8,7 +8,7 @@ import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
export default class AxleReset extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;
@ -83,9 +83,18 @@ export default class AxleReset extends Group {
this.add(this.text);
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
// 设置状态
setState(model) {
if (!this.isShowShape) return;
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
}
}
createMouseEvent() {

View File

@ -6,7 +6,7 @@ export default class Cross extends Group {
// code: getUID('Cross', this.crossList),
// position:each.position,
// relatedSwitch:each.relatedSwitch
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -3,7 +3,7 @@ import Polygon from 'zrender/src/graphic/shape/Polygon';
import Text from 'zrender/src/graphic/Text';
export default class DirectionRod extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 5;
this._code = model.code;

View File

@ -5,7 +5,7 @@ import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class FloodGate extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;

View File

@ -8,7 +8,7 @@ import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
export default class GuideLock extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;
@ -86,12 +86,22 @@ export default class GuideLock extends Group {
}
handleSignal() {
this.control.setStyle({ fill: this.style.GuideLock.lamp.lightUpColor });
}
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
// 设置状态
setState(model) {
if (!this.isShowShape) return;
this.recover();
model.totalGuideLock && this.handleSignal();
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
this.recover();
model.totalGuideLock && this.handleSignal();
}
}
createMouseEvent() {

View File

@ -6,7 +6,7 @@ import EControl from '../element/EControl';
import EMouse from './EMouse';
export default class LcControl extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;
@ -53,9 +53,19 @@ export default class LcControl extends Group {
this.add(this.control);
}
setAshShow() {
this.control && this.control.setControlColor('#7F7F7F');
}
// 设置状态
setState(model) {
if (!this.isShowShape) return;
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
}
}
createMouseEvent() {

View File

@ -6,7 +6,7 @@ import EControl from '../element/EControl';
import EMouse from './EMouse';
export default class LimitControl extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.selected = false;
this._code = model.code;
@ -57,9 +57,18 @@ export default class LimitControl extends Group {
this.add(this.control);
}
setAshShow() {
this.control && this.control.setControlColor('#FFF');
}
// 设置状态
setState(model) {
if (!this.isShowShape) return;
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
}
}
createMouseEvent() {

View File

@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
import Polyline from 'zrender/src/graphic/shape/Polyline';
export default class Line2 extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class OutFrame extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.model = model;
this._type = model._type;

View File

@ -3,7 +3,7 @@ import ETextName from '../element/ETextName'; // 名称文字 (共有)
import BoundingRect from 'zrender/src/core/BoundingRect';
export default class OverAp extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -4,7 +4,7 @@ import JTriangle from '../../utils/JTriangle';
import ESeparator from './ESeparator';
export default class Line2 extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -7,7 +7,7 @@ import {traverseLineElements} from '../utils/ShapeStatusCovert';
import ERectDoor from './ERectDoor';
export default class Line2 extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;
@ -42,16 +42,24 @@ export default class Line2 extends Group {
currentTypeList.forEach(element => {
this[element].recover();
});
}
}
setAshShow() {
this.safetyDoorNormal && this.safetyDoorNormal.setColor('#7F7F7F');
}
setState(model) {
this.recover();
if (!this.isShowShape) return;
const currentTypeList = this.style.Psd.elemnetType;
currentTypeList.forEach(element => {
this[element].setState(model);
});
if (model._free) {
this.setAshShow();
} else {
const currentTypeList = this.style.Psd.elemnetType;
currentTypeList.forEach(element => {
this[element].setState(model);
});
}
}
drawSelected(selected) {

View File

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

View File

@ -23,7 +23,7 @@ const defaultStyle = {
}
};
export default class Responder extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -11,7 +11,7 @@ import EUnmanned from './EUnmanned';
import EAxle from './EAxle';
export default class SaidLamp extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;

View File

@ -13,18 +13,18 @@ import ELimitName from './ELimitName'; // 成都三号线 限速名称
import { drawSectionStyle } from '../../config/defaultStyle';
import EStopRouteImg from './EStopRouteImg';
import store from '@/store/index';
import Vue from 'vue';
/** 区段*/
export default class Section extends Group {
constructor(model, style) {
constructor(model, {style, mapDevice}) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.z = 5 + parseInt(model.layer || 0);
this.model = model;
this.style = style;
this.style = style;
this.mapDevice = mapDevice;
this.selected = false; // 绘图选中状态
this.selectedType = ''; // 绘图批量选中状态
this.isShowShape = true;
@ -321,9 +321,9 @@ export default class Section extends Group {
handleSwitchSection(model, flag) {
// 哈尔滨线路 南京二 道岔相关区段设置 默认颜色
if (this.style.Switch.sectionAction.flag && model.relSwitchCode && !flag) {
const switchModel = Vue.prototype.$jlmap.mapDevice[model.relSwitchCode];
const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode];
const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode];
const switchModel = this.mapDevice[model.relSwitchCode];
const sectionB = this.mapDevice[switchModel.sectionBCode];
const sectionC = this.mapDevice[switchModel.sectionCCode];
if (switchModel && switchModel.normalPosition === 1) {
this.setSwitchSectionColor(sectionC, sectionB);// 定位
} else if (switchModel && switchModel.normalPosition === 0 && switchModel.reversePosition === 0 && switchModel.instance && switchModel.instance.switchPosition === 'reverse' && switchModel.fault !== 'SPLIT') {
@ -363,42 +363,51 @@ export default class Section extends Group {
/** 设置状态*/
setState(model, flag = false) {
if (!this.isShowShape) return;
this.recover();
this.handleSwitchSection(model, flag);
// 顺序代表优先级
/** 道岔保护区段锁闭 */
model.overlapLock && this.protectiveLock(model.lockRight);
/** 空闲锁闭或者叫进路锁闭 */
model.routeLock && this.routeLock(model.lockRight);
/** 计轴故障 */
model.invalid && this.invalid();
/** 轨道封锁 */
model.blockade && this.block(model.routeLock);
/** 非通信车占用状态 */
model.nctOccupied && this.unCommunicationOccupied();
/** 通信车占用状态 */
model.ctOccupied && this.communicationOccupied();
// 计轴预复位
model.preReset && this.preReset(model.blockade);
/** 区段切除*/
model.cutOff && this.sectionCutOff();
/** 是否限速*/
model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit);
// 区段计轴预复位状态 (未处理)
// 区段延时解锁
model.delayUnlock && this.delayUnlock();
// 区段故障锁闭 之前是fault 暂时设置为faultLock
model.faultLock && this.faultLock();
// 设置灰显
model.noStatus && this.setAshShow();
/** 道岔区段更新岔心颜色 */
if (model.type === '03' && model.switch) {
const sectionSwitch = store.getters['map/getDeviceByCode'](model.switch.code);
if (sectionSwitch && sectionSwitch.sectionACode === model.code) {
sectionSwitch.instance && sectionSwitch.instance.setState(sectionSwitch);
sectionSwitch.instance && sectionSwitch.instance.setLimitState(model.speedUpLimit > 0, model.speedUpLimit);
}
}
this.recover();
// 只响应前端自定义类型的状态变化
if (model._free) {
// 先初始化为灰色
this.setAshShow()
model.preGreen && this.line.setStyle({stroke: '#00FF00'});
model.preBlue && this.line.setStyle({stroke: '#4A76B7'});
} else {
this.handleSwitchSection(model, flag);
// 顺序代表优先级
/** 道岔保护区段锁闭 */
model.overlapLock && this.protectiveLock(model.lockRight);
/** 空闲锁闭或者叫进路锁闭 */
model.routeLock && this.routeLock(model.lockRight);
/** 计轴故障 */
model.invalid && this.invalid();
/** 轨道封锁 */
model.blockade && this.block(model.routeLock);
/** 非通信车占用状态 */
model.nctOccupied && this.unCommunicationOccupied();
/** 通信车占用状态 */
model.ctOccupied && this.communicationOccupied();
// 计轴预复位
model.preReset && this.preReset(model.blockade);
/** 区段切除*/
model.cutOff && this.sectionCutOff();
/** 是否限速*/
model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit);
// 区段计轴预复位状态 (未处理)
// 区段延时解锁
model.delayUnlock && this.delayUnlock();
// 区段故障锁闭 之前是fault 暂时设置为faultLock
model.faultLock && this.faultLock();
// 设置灰显
model.noStatus && this.setAshShow();
/** 道岔区段更新岔心颜色 */
if (model.type === '03' && model.switch) {
const sectionSwitch = this.mapDevice[model.switch.code];
if (sectionSwitch && sectionSwitch.sectionACode === model.code) {
sectionSwitch.instance && sectionSwitch.instance.setState(sectionSwitch);
sectionSwitch.instance && sectionSwitch.instance.setLimitState(model.speedUpLimit > 0, model.speedUpLimit);
}
}
}
}
/** 计算提示位置*/
@ -434,8 +443,8 @@ export default class Section extends Group {
this.line.setOrignalCross(true);
}
if (this.style.Switch.sectionAction.flag && this.model.relSwitchCode) {
const switchModel = Vue.prototype.$jlmap.mapDevice[this.model.relSwitchCode];
const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode];
const switchModel = this.mapDevice[this.model.relSwitchCode];
const sectionC = this.mapDevice[switchModel.sectionCCode];
if (sectionC.code == this.model.code) {
sectionC && sectionC.instance && sectionC.instance.line.setStyle({ stroke: this.style.Switch.sectionAction.spareColor });
}

View File

@ -22,7 +22,7 @@ import { findDeviceByModelDepType } from '../utils/ShapeDepFind';
// import background from './../../../ibp/shape/background';
class Signal extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;
@ -733,87 +733,92 @@ class Signal extends Group {
const path = window.location.href;
this.recover();
/** 信号机进路按钮显示 */
/** 终端信号机按钮 */
if (model.isRouteActive) {
this.setLowButtonActive();
} else {
this.setLowButtonRecover();
}
model.isRouteSignal && this.setLowButtonShow();
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
/** 信号机进路按钮显示 */
/** 终端信号机按钮 */
if (model.isRouteActive) {
this.setLowButtonActive();
} else {
this.setLowButtonRecover();
}
model.isRouteSignal && this.setLowButtonShow();
/** 设置灯的颜色 */
model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭
model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放
model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放
model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示
/** 设置灯的颜色 */
model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭
model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放
model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放
model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示
/** 信号机封锁 */ // 缺一个功能封锁
model.blockade && this.block();
model.reblockade && this.reblock();
model.remainTime && this.showRemainTime(model.remainTime);
if (!path.includes('/map/draw')) {
// 联锁自动进路通过
model.fleetMode && this.setAutoRouteOpen();
// 联锁自动触发
if (model.ciControl) {
this.setAutoTriggerOpen();
} else {
!model.atsControl && this.setArtificialRouteClose(); /** 进路交人工控或自动控 */
}
}
// 设置点灯类型 必须在最后设置不能放前面 logicLight 0 物理点灯 1 逻辑点灯
if (model.logicLight) {
this.logicalLight(); // 设置逻辑点灯
} else {
this.physicsLight(); // 设置物理点灯
}
if (model.isStartSignal) {
this.insideTriangle && this.insideTriangle.show();
this.lamps.forEach(item => { item.hide(); });
this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.startSignalColor});
} else if (model.isTerminalSignal) {
this.sigPost && this.sigPost.setTerminalOptional();
}
if (model.isCiConfirm) {
this.setCiConfirm();
}
if (model.isRequestLock) {
this.sigBack && this.sigBack.show();
this.sigBack && this.sigBack.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: this.style.Signal.sigBack.fillColor })
.when(2000, { fill: this.style.backgroundColor })
.when(3000, { fill: this.style.Signal.sigBack.fillColor })
.start();
}
if (model.isRequestGuide) {
this.lamps && this.lamps[0] && this.lamps[0].setAnimationStart(this.style.Signal.lamp.yellowColor);
}
if (path.includes('/map/draw')) {
if (model.type == 'PASSING') {
this.lamps && this.lamps.length && this.lamps.forEach(elem => {
elem.setColor(this.style.Signal.lamp.greenColor);
});
} else {
this.lamps && this.lamps.length && this.lamps.forEach(elem => {
elem.setColor(this.style.Signal.lamp.redColor);
});
}
}
if ( model.level === 3 && this.style.Signal.post.mainSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.mainSignalVerColor);
} else if (model.level === 1 && this.style.Signal.post.closeSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.closeSignalVerColor);
} else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.guideSignalVerColor);
}
// 信号机故障
model.fault && this.fault();
// 设置灰显
if (model.noStatus || model.level === 0) {
this.setAshShow();
}
/** 信号机封锁 */ // 缺一个功能封锁
model.blockade && this.block();
model.reblockade && this.reblock();
model.remainTime && this.showRemainTime(model.remainTime);
if (!path.includes('/map/draw')) {
// 联锁自动进路通过
model.fleetMode && this.setAutoRouteOpen();
// 联锁自动触发
if (model.ciControl) {
this.setAutoTriggerOpen();
} else {
!model.atsControl && this.setArtificialRouteClose(); /** 进路交人工控或自动控 */
}
}
// 设置点灯类型 必须在最后设置不能放前面 logicLight 0 物理点灯 1 逻辑点灯
if (model.logicLight) {
this.logicalLight(); // 设置逻辑点灯
} else {
this.physicsLight(); // 设置物理点灯
}
if (model.isStartSignal) {
this.insideTriangle && this.insideTriangle.show();
this.lamps.forEach(item => { item.hide(); });
this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.startSignalColor});
} else if (model.isTerminalSignal) {
this.sigPost && this.sigPost.setTerminalOptional();
}
if (model.isCiConfirm) {
this.setCiConfirm();
}
if (model.isRequestLock) {
this.sigBack && this.sigBack.show();
this.sigBack && this.sigBack.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: this.style.Signal.sigBack.fillColor })
.when(2000, { fill: this.style.backgroundColor })
.when(3000, { fill: this.style.Signal.sigBack.fillColor })
.start();
}
if (model.isRequestGuide) {
this.lamps && this.lamps[0] && this.lamps[0].setAnimationStart(this.style.Signal.lamp.yellowColor);
}
if (path.includes('/map/draw')) {
if (model.type == 'PASSING') {
this.lamps && this.lamps.length && this.lamps.forEach(elem => {
elem.setColor(this.style.Signal.lamp.greenColor);
});
} else {
this.lamps && this.lamps.length && this.lamps.forEach(elem => {
elem.setColor(this.style.Signal.lamp.redColor);
});
}
}
if ( model.level === 3 && this.style.Signal.post.mainSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.mainSignalVerColor);
} else if (model.level === 1 && this.style.Signal.post.closeSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.closeSignalVerColor);
} else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.guideSignalVerColor);
}
// 信号机故障
model.fault && this.fault();
// 设置灰显
if (model.noStatus || model.level === 0) {
this.setAshShow();
}
}
}
getBoundingRect() {

View File

@ -4,7 +4,7 @@ import Polygon from 'zrender/src/graphic/shape/Polygon';
import Text from 'zrender/src/graphic/Text';
export default class SplitStation extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 10;
this._code = model.code;

View File

@ -18,7 +18,7 @@ import { traverseLineElements } from '../utils/ShapeStatusCovert';
import Vue from 'vue';
export default class Station extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -6,7 +6,7 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class StationCounter extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -6,7 +6,7 @@ import Text from 'zrender/src/graphic/Text';
import Group from 'zrender/src/container/Group';
export default class StationDelayUnlock extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -47,7 +47,7 @@ class EDetain extends Group {
}
setColor(color) {
this.detain.setStyle('textFill', color);
this.detain && this.detain.setStyle('textFill', color);
}
recover() {

View File

@ -48,6 +48,10 @@ class EEmergentRhombus extends Group {
this.hideMode();
}
setColor(color) {
this.emergent && this.emergent.setStyle('stroke', color);
}
setState(model) {
// 紧急停车
model.emergencyClosed && this.showMode();

View File

@ -39,7 +39,7 @@ import EStationPlatform from './EStationPlatform';
import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert';
class StationStand extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;
@ -128,7 +128,15 @@ class StationStand extends Group {
} else {
this.eachChild(elem => { elem.hide(); });
}
}
}
setAshShow() {
this.solidStand && this.solidStand.setColor('#7F7F7F');
this.hollowStand && this.hollowStand.setColor('#7F7F7F');
this.gapStand && this.gapStand.setColor('#7F7F7F');
this.emergentRhombus && this.emergentRhombus.setColor('#7F7F7F');
this.detainNormal && this.detainNormal.setColor('#7F7F7F');
}
/** 恢复初始状态*/
recover() {
@ -143,11 +151,16 @@ class StationStand extends Group {
// // 新版地图使用新版状态变更方式
this.recover();
// 更新状态
const currentTypeList = this.style.StationStand.elemnetType;
currentTypeList.forEach(element => {
this[element].setState(model);
});
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
// 更新状态
const currentTypeList = this.style.StationStand.elemnetType;
currentTypeList.forEach(element => {
this[element].setState(model);
});
}
}
getBoundingRect() {

View File

@ -6,14 +6,15 @@ import EFoldbackMode from './EFoldbackMode';
import Vue from 'vue';
export default class StationTurnBack extends Group {
constructor(model, style) {
constructor(model, {style, lineCode}) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.z = 40;
this.model = model;
this.style = style;
this.style = style;
this.lineCode = lineCode;
this.isShowShape = true;
this.create();
this.setState(model);
@ -71,7 +72,7 @@ export default class StationTurnBack extends Group {
});
}
let turnName = '按计划执行';
if (Vue.prototype.$jlmap.lineCode == '03') {
if (this.lineCode == '03') {
turnName = '关闭';
}
this.strategyText = new Text({
@ -144,18 +145,28 @@ export default class StationTurnBack extends Group {
}
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
// 设置状态
setState(model, tbStrategyId = null) {
if (!this.isShowShape) return;
this.recover();
if (tbStrategyId) {
model.tbStrategyId = tbStrategyId;
model.optionList.forEach(item => {
if (item.id == tbStrategyId) {
this.handleStatus(item.label);
}
});
}
this.recover();
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (tbStrategyId) {
model.tbStrategyId = tbStrategyId;
model.optionList.forEach(item => {
if (item.id == tbStrategyId) {
this.handleStatus(item.label);
}
});
}
}
}
getShapeTipPoint() {
const rect = this.control.getBoundingRect();

View File

@ -13,10 +13,9 @@ import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
import ETriangle from './ETriangle';
import store from '@/store/index';
import Vue from 'vue';
export default class Switch extends Group {
constructor(model, style) {
constructor(model, {style, mapDevice}) {
super();
this._code = model.code;
this._type = model._type;
@ -25,7 +24,8 @@ export default class Switch extends Group {
this.zlevel = model.zlevel;
this.z = 6;
this.isShowShape = true;
this.switchPosition = '';
this.switchPosition = '';
this.mapDevice = mapDevice;
this.triangle = new JTriangle(model.intersection, model.skew);
this.create();
this.createLockRect(); // 创建单锁矩形框显示
@ -47,17 +47,19 @@ export default class Switch extends Group {
create() {
const model = this.model;
const style = this.style;
const swPadding = style.Switch.core.length + style.Section.line.width / 2;
const sectionAModel = this.mapDevice[model.sectionACode];
const sectionBModel = this.mapDevice[model.sectionBCode];
const sectionCModel = this.mapDevice[model.sectionCCode];
const rateOpen = style.Switch.core.rateOpen;
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const switchWidth1 = style.Section.line.width / 2;
let directxA = 1;
const sectionAModel = Vue.prototype.$jlmap.mapDevice[model.sectionACode];
const sectionBModel = Vue.prototype.$jlmap.mapDevice[model.sectionBCode];
let sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
let sectionBTriangle = new JTriangle(sectionBModel.points[0], sectionBModel.points[1]);
let sectionCTriangle = new JTriangle(sectionCModel.points[0], sectionCModel.points[1]);
const sectionAPoint = { x: model.intersection.x, y: model.intersection.y };
if (sectionAModel.points[0].x == model.intersection.x && sectionAModel.points[0].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
@ -74,6 +76,17 @@ export default class Switch extends Group {
if (sectionBModel.points[sectionBModel.points.length - 1].x == model.intersection.x && sectionBModel.points[sectionBModel.points.length - 1].y == model.intersection.y) {
sectionBTriangle = new JTriangle(sectionBModel.points[sectionBModel.points.length - 2], sectionBModel.points[sectionBModel.points.length - 1]);
}
if (sectionCModel.points[0].x == model.intersection.x && sectionCModel.points[0].y == model.intersection.y) {
sectionCTriangle = new JTriangle(sectionCModel.points[0], sectionCModel.points[1]);
}
if (sectionCModel.points[sectionCModel.points.length - 1].x == model.intersection.x && sectionCModel.points[sectionCModel.points.length - 1].y == model.intersection.y) {
sectionCTriangle = new JTriangle(sectionCModel.points[sectionCModel.points.length - 2], sectionCModel.points[sectionCModel.points.length - 1]);
}
const swPadding = rateOpen
? sectionCTriangle.getLength() / 2
: style.Switch.core.length + style.Section.line.width / 2;
const drictyyA = sectionATriangle.dricty;
const point1 = [model.intersection.x + directx * this.triangle.getCotRate() * swPadding, model.intersection.y + directy * swPadding];
const point2 = [model.intersection.x, model.intersection.y];
@ -89,7 +102,9 @@ export default class Switch extends Group {
onmouseout: () => { this.name.getArrowText().hide(); }
});
const relocShelterLength = 15;
const relocShelterLength = rateOpen
? sectionBTriangle.getLength() / 2
: 15;
const rpoint1 = [sectionAPoint.x - directxA * (relocShelterLength * sectionBTriangle.getCosRate()), sectionAPoint.y - drictyyA * relocShelterLength * sectionBTriangle.getSinRate()];
const rpoint2 = [sectionAPoint.x, sectionAPoint.y];
const rpoint3 = [sectionAPoint.x + directxA * (switchWidth1 * sectionATriangle.getCosRate()), sectionAPoint.y + drictyyA * switchWidth1 * sectionATriangle.getSinRate()];
@ -308,7 +323,7 @@ export default class Switch extends Group {
this.shapeModelB.hide();
this.shapeModelC.hide();
} else {
this.shapeModelB.show();
this.shapeModelB.show();
this.shapeModelB.setColor(this.style.Section.line.spareColor);
this.shapeModelC.show();
this.shapeModelC.setColor(this.style.backgroundColor);
@ -399,10 +414,10 @@ export default class Switch extends Group {
this.shapeModelC.hide();
} else {
if (this.model.switchFaultCode && fault) {
const switchFault = store.getters['map/getDeviceByCode'](this.model.switchFaultCode);
const switchFault = this.mapDevice[this.model.switchFaultCode];
switchFault.instance.setControlColor('#F00', true);
} else if (this.model.switchFaultCode && !fault) {
const switchFault = store.getters['map/getDeviceByCode'](this.model.switchFaultCode);
const switchFault = this.mapDevice[this.model.switchFaultCode];
switchFault.instance.setControlColor(this.style.backgroundColor, false);
}
// stopAnimation
@ -552,11 +567,11 @@ export default class Switch extends Group {
// 处理岔芯颜色
setSectionState(state) {
const sectionC = store.getters['map/getDeviceByCode'](state.sectionCCode);
const sectionC = this.mapDevice[state.sectionCCode];
if (sectionC && state.reversePosition && !state.blockade) {
this.setSwitchModelStatus(this.shapeModelA, sectionC);
}
const sectionA = store.getters['map/getDeviceByCode'](state.sectionACode);
const sectionA = this.mapDevice[state.sectionACode];
if (sectionA && state.normalPosition && !this.style.Switch.core.graphShow && !state.blockade) {
this.setSwitchModelStatus(this.shapeModelB, sectionA);
}
@ -628,40 +643,60 @@ export default class Switch extends Group {
}
setState(model) {
if (!this.isShowShape) return;
this.recover();
this.setSwitchFault(model.fault, model.normalPosition, model.reversePosition);
if (model.normalPosition) {
this.switchPosition = 'normal';
this.setLocationAction(model); /** 定位*/
} else if (model.reversePosition) {
this.switchPosition = 'reverse';
this.setInversionAction(model); /** 反位*/
} else {
this.setLossAction(model.fault); // 失去
}
model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示
this.recover();
model.singleLock && this.setMonolock(model.normalPosition, model.reversePosition); // 道岔单锁
model.blockade && this.block(model.normalPosition, model.reversePosition); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
const path = window.location.href;
if (!path.includes('/map/draw')) {
this.setSectionState(this.model); // 处理元素颜色
}
model.fpLock && this.handleFpLock(); // 道岔侧防
model.routeLock && this.handleRouteLock(); // 道岔进路锁闭
model.overlapLock && this.handleOverlapLock(); // 道岔进路延续保护
// this.interlockingReserved(); // 联锁预留道岔
model.preReset && this.preReset(model.normalPosition, model.reversePosition); // 道岔预复位
// 只响应前端自定义类型的状态变化
if (model._free) {
if (model.normalPosition) {
this.switchPosition = 'normal';
this.setLocationAction(model); /** 定位*/
if (model.routeLock) {
this.setSectionState(model);
}
} else if (model.reversePosition) {
this.switchPosition = 'reverse';
this.setInversionAction(model); /** 反位*/
if (model.routeLock) {
this.setSectionState(model);
}
} else {
this.setAshShow()
}
} else {
this.setSwitchFault(model.fault, model.normalPosition, model.reversePosition);
if (model.normalPosition) {
this.switchPosition = 'normal';
this.setLocationAction(model); /** 定位*/
} else if (model.reversePosition) {
this.switchPosition = 'reverse';
this.setInversionAction(model); /** 反位*/
} else {
this.setLossAction(model.fault); // 失去
}
model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示
if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色
const switchModel = Vue.prototype.$jlmap.mapDevice[model.code];
const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode];
sectionB && sectionB.instance && sectionB.instance.setState(sectionB);
const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode];
sectionC && sectionC.instance && sectionC.instance.setState(sectionC);
}
model.noStatus && this.setAshShow();
model.singleLock && this.setMonolock(model.normalPosition, model.reversePosition); // 道岔单锁
model.blockade && this.block(model.normalPosition, model.reversePosition); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
const path = window.location.href;
if (!path.includes('/map/draw')) {
this.setSectionState(this.model); // 处理元素颜色
}
model.fpLock && this.handleFpLock(); // 道岔侧防
model.routeLock && this.handleRouteLock(); // 道岔进路锁闭
model.overlapLock && this.handleOverlapLock(); // 道岔进路延续保护
// this.interlockingReserved(); // 联锁预留道岔
model.preReset && this.preReset(model.normalPosition, model.reversePosition); // 道岔预复位
if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色
const switchModel = this.mapDevice[model.code];
const sectionB = this.mapDevice[switchModel.sectionBCode];
sectionB && sectionB.instance && sectionB.instance.setState(sectionB);
const sectionC = this.mapDevice[switchModel.sectionCCode];
sectionC && sectionC.instance && sectionC.instance.setState(sectionC);
}
model.noStatus && this.setAshShow();
}
}
setLimitState(flag, limitValue) {
if (flag) {

View File

@ -1,10 +1,9 @@
import Text from 'zrender/src/graphic/Text';
import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect';
import Vue from 'vue';
export default class Text2 extends Group {
constructor(model, style) {
constructor(model, {style, lineCode}) {
super();
this._code = model.code;
this._type = model._type;
@ -12,7 +11,8 @@ export default class Text2 extends Group {
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.z = 6;
this.z = 6;
this.lineCode = lineCode;
this.isShowShape = true;
this.create();
this.setState(model);
@ -83,7 +83,7 @@ export default class Text2 extends Group {
}
}
screenShow() {
if (Vue.prototype.$jlmap.lineCode == '06') { // 宁波线路隐藏
if (this.lineCode == '06') { // 宁波线路隐藏
this.text && this.text.hide();
} else {
this.text && this.text.show();

View File

@ -8,7 +8,7 @@ import EDirection from './EDirection';
/** 列车 */
export default class Train extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -5,7 +5,7 @@ import EMouse from './EMouse';
import store from '@/store/index';
class TrainWindow extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this._code = model.code;
this._type = model._type;

View File

@ -6,7 +6,7 @@ import EControl from '../element/EControl';
import EMouse from './EMouse';
export default class ZcControl extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.z = 20;
this._code = model.code;
@ -59,11 +59,21 @@ export default class ZcControl extends Group {
}
setAshShow() {
this.control && this.control.setControlColor('#7F7F7F');
}
// 设置状态
setState(model) {
this.recover();
model.fault == 'FAULT' && this.fault();
if (!this.isShowShape) return;
this.recover();
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
model.fault == 'FAULT' && this.fault();
if (!this.isShowShape) return;
}
}
recover() {

View File

@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class checkBox extends Group {
constructor(model, style) {
constructor(model, {style}) {
super();
this.model = model;
this._type = model._type;

View File

@ -87,7 +87,7 @@ function shapefactory(device, jmap) {
const shape = mapShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
return new shape(device, jmap.style);
return new shape(device, jmap);
}
}

View File

@ -0,0 +1,271 @@
<template>
<div
ref="jlmapCanvas"
class="jlmap-canvas"
:style="{ width: width + 'px', height: height + 'px' }"
>
<div :id="canvasId" class="display_canvas" />
</div>
</template>
<script>
import Vue from "vue";
import Jlmap from "@/jmapNew/map";
import { parser } from "@/jmapNew/utils/parser";
import { deepAssign } from "@/utils/index";
import deviceType from "@/jmapNew/constant/deviceType";
export default {
name: "JLocalmapVisual",
props: {
width: {
type: Number,
default: 0,
},
height: {
type: Number,
default: 0,
},
},
data() {
return {
loading: true,
dataZoom: {
offsetX: "0",
offsetY: "0",
scaleRate: "1",
},
offset: {
x: 0,
y: 0,
},
map: null,
mapDevice: {},
routeData: [],
autoReentryData: [],
};
},
computed: {
canvasId() {
return ["map", Math.random().toFixed(5) * 100000].join("_");
},
},
watch: {
"$store.state.config.canvasSizeCount": function (val) {
this.resetSize();
},
"$store.state.training.prdType": function (val) {
if (val) {
this.changePrdType(val);
}
},
},
mounted() {
this.init();
},
beforeDestroy() {
if (this.map) {
this.map.dispose();
this.map = null;
}
},
methods: {
init() {
document.getElementById(this.canvasId).oncontextmenu = function (e) {
return false;
};
const prdType = this.$store.state.training.prdType;
let showMode = "";
if (prdType == "01") {
showMode = "03";
} else if (prdType == "02") {
showMode = "02";
}
if (!this.map) {
this.map = new Jlmap({
dom: document.getElementById(this.canvasId),
config: {
renderer: "canvas",
width: this.width,
height: this.height,
},
options: {
scaleRate: 1,
offsetX: 0,
offsetY: 0,
zoomOnMouseWheel: false,
},
showConfig: {
prdType: prdType,
previewOrMapDraw: true,
showMode: showMode,
},
methods: {},
});
}
window.document.oncontextmenu = function () {
return false;
};
},
loadData(map) {
try {
this.setMap(map);
} catch (error) {
console.log("[ERROR] ", error);
}
},
// jlmap
resetSize() {
this.$nextTick(() => {
this.map && this.map.resize({ width: this.width, height: this.height });
});
},
//
setLevelVisible(levels) {
this.map && this.map.setLevelVisible(levels);
},
//
setMap(map) {
if (map && map.skinVO) {
const showConfig = this.map.getShowConfig();
this.mapDevice = parser(map, map.skinVO.code, showConfig);
this.routeData = this.$store.state.map.routeData;
this.autoReentryData = this.$store.state.map.autoReentryData;
this.map.setMap(map, this.mapDevice, { routeData: this.routeData, autoReentryData: this.autoReentryData });
this.map.setOptions({})
this.setMapFree();
} else {
this.mapDevice = {};
this.map.clear();
}
},
setMapFree() {
const list = [];
Object.values(this.mapDevice).forEach((elem) => {
const code = elem.code;
const type = elem._type;
//
type != deviceType.Train &&
list.push({ code, _type: type, _free: true });
});
this.map.update(list, false);
},
//
setCenterWithOffset(code, offset) {
this.map.setCenterWithOffset(code, offset);
},
//
updateMapDevice(elems) {
const list = [];
elems.forEach((elem) => {
if (elem.code) {
list.push(deepAssign(this.mapDevice[elem.code], elem));
}
});
this.map.update(list, false);
},
getDeviceByCode(code) {
return this.mapDevice[code];
},
//
changePrdType(val) {
const nameList = Object.keys(this.$store.state.map.map || {});
let list = [];
let showMode = "";
nameList.forEach((item) => {
if (item !== "skinVO") {
const data = this.$store.state.map.map[item];
if (data && data.constructor === Array) {
list = [...list, ...data];
}
}
});
if (val === "01") {
showMode = "03";
} else if (val === "02") {
showMode = "02";
}
this.map.updatePrdType(list, val, showMode);
},
setShowStation(stationCode, setCenter) {
const nameList = Object.keys(this.$store.state.map.map);
let list = [];
nameList.forEach((item) => {
if (
this.$store.state.map.map[item] &&
this.$store.state.map.map[item].constructor === Array
) {
if (item === "trainList") {
this.$store.state.map.map[item].forEach((elem) => {
elem && list.push(elem);
});
} else {
list = [...list, ...this.$store.state.map.map[item]];
}
}
});
this.map.updateShowStation(list, stationCode);
!setCenter && this.setCenter(stationCode);
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.mask {
opacity: 0;
background: #000;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9;
}
.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;
background: #000;
float: left;
}
.title {
text-align: right;
font-size: 14px;
color: #606266;
line-height: 32px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-weight: 700;
}
.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>

View File

@ -1,32 +1,39 @@
<template>
<el-dialog v-dialogDrag class="ningbo-01__systerm route-setting" :title="title" :visible.sync="show" width="350px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row class="header">
<el-col :span="11"><span>集中站</span></el-col>
<el-col :span="11" :offset="2"><span>始端信号机</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="stationName" size="small" disabled />
<el-dialog v-dialogDrag class="ningbo-01__systerm route-setting" :title="title" :visible.sync="show" :width="showExpand? '1100px': '300px'" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row :gutter="24">
<el-col :span="showExpand? 6: 24">
<el-row class="header">
<el-col :span="11"><span>集中站</span></el-col>
<el-col :span="11" :offset="2"><span>始端信号机</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="stationName" size="small" disabled />
</el-col>
<el-col :span="11" :offset="2">
<el-input v-model="signalName" size="small" disabled />
</el-col>
</el-row>
<el-row style="margin-top: 10px; line-height: 30px;">
<el-col :span="11"><span>进路列表</span></el-col>
<el-col :span="11" :offset="2">
<el-button class="expand" @click="expandPath">展开进路预览</el-button>
</el-col>
</el-row>
<el-table ref="table" :data="tempData" border :cell-style="tableStyle" style="width: 100%; height: 460px; margin-top:10px" size="mini" highlight-current-row :show-header="false" @row-click="clickEvent">
<el-table-column :id="domIdChoose" prop="name" style="margin-left:30px" />
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="8" :offset="4">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="commitDisabled" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</el-col>
<el-col :span="11" :offset="2">
<el-input v-model="signalName" size="small" disabled />
</el-col>
</el-row>
<el-row style="margin-top: 10px; line-height: 30px;">
<el-col :span="11"><span>进路列表</span></el-col>
<el-col :span="11" :offset="2">
<!-- <el-button class="expand" @click="expandPath">展开进路预览</el-button> -->
</el-col>
</el-row>
<el-table ref="table" :data="tempData" border :cell-style="tableStyle" style="width: 100%; height: 120px; margin-top:10px" size="mini" highlight-current-row :show-header="false" @row-click="clickEvent">
<el-table-column :id="domIdChoose" prop="name" style="margin-left:30px" />
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="8" :offset="4">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="commitDisabled" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
<el-col v-if="showExpand" :span="showExpand? 18: 0">
<map-visual ref="map" :width="780" :height="600" />
</el-col>
</el-row>
<notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" />
@ -36,23 +43,28 @@
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { deepAssign } from '@/utils/index';
import {mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus';
import { mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus';
import { mapGetters } from 'vuex';
import { dbReadData } from '@/utils/indexedDb';
import ConfirmTip from './childDialog/confirmTip';
import MapVisual from './mapVisual';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
export default {
name: 'RouteSelection',
components: {
NoticeInfo,
ConfirmTip
ConfirmTip,
MapVisual
},
data() {
return {
tempData: [],
beforeSectionList: [],
beforeSectionList: [],
beforeSwitchList: [],
showExpand: true,
dialogShow: false,
loading: false,
selected: null,
@ -60,10 +72,11 @@ export default {
operation: '',
display: true,
stationName: '',
signalName: '',
signalName: '',
mapData: null,
tableStyle: {
'border-bottom': 'none'
}
}
};
},
computed: {
@ -81,7 +94,7 @@ export default {
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.menu.domId : '';
},
},
title() {
return '进路设置';
},
@ -99,10 +112,13 @@ export default {
this.commit();
}
}
},
},
mounted() {
this.mapData = JSON.parse(JSON.stringify(this.$store.state.map.map));
},
methods: {
expandPath() {
console.log('展开进路预览');
this.showExpand = !this.showExpand;
},
doShow(operate, selected, tempData) {
this.selected = selected;
@ -126,12 +142,21 @@ export default {
}
});
this.operation = operate.operation;
}
this.dialogShow = true;
}
this.dialogShow = true;
this.$nextTick(function () {
this.loadData();
this.$store.dispatch('training/emitTipFresh');
});
},
},
loadData() {
this.beforeSwitchList = [];
this.beforeSectionList = [];
if (this.mapData) {
this.$refs.map.loadData(this.mapData);
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
@ -143,60 +168,77 @@ export default {
restoreBeforeDevices() {
//
if (this.beforeSectionList && this.beforeSectionList.length) {
this.beforeSectionList.forEach(elem => {
elem.cutOff = false;
this.beforeSectionList.forEach(el => {
el.routeLock = false;
el.preBlue = false;
el.preGreen = false;
});
}
this.$store.dispatch('training/updateMapState', [...this.beforeSectionList]);
this.beforeSectionList = [];
if (this.beforeSwitchList && this.beforeSwitchList.length) {
this.beforeSwitchList.forEach(el => {
el.normalPosition = false;
el.reversePosition = false;
el.routeLock = false;
});
}
this.$refs.map.updateMapDevice([...this.beforeSectionList, ...this.beforeSwitchList]);
this.beforeSectionList = [];
this.beforeSwitchList = [];
},
clickEvent(row, event, column) {
this.row = row;
if (row) {
//
this.row.canSetting = true;
this.restoreBeforeDevices();
const containSectionList = [];
this.restoreBeforeDevices();
const containSectionList = [];
const containSwitchList = [];
if (!row.setting) {
//
const signalBegin = this.$refs.map.getDeviceByCode(row.startSignalCode);
const signalEnd = this.$refs.map.getDeviceByCode(row.endSignalCode);
const diff = signalBegin.position.x - signalEnd.position.x;
const code = diff < 0? row.endSignalCode : row.startSignalCode;
this.$refs.map.setCenterWithOffset(code, 0);
if (row.routeSectionList && row.routeSectionList.length) {
//
row.routeSectionList.forEach(elem => {
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
row.routeSectionList.forEach(code => {
const section = deepAssign({}, this.$refs.map.getDeviceByCode(code));
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach(item => {
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
sec.cutOff = true;
containSectionList.push(sec);
section.logicSectionCodeList.forEach(sectionCode => {
containSectionList.push({code: sectionCode,preGreen: true,preBlue: false});
});
} else {
section.cutOff = true;
containSectionList.push(section);
containSectionList.push({code, preGreen: true,preBlue: false});
}
});
}
if (this.overlapData[row.overlapCode] && this.overlapData[row.overlapCode].pathList && this.overlapData[row.overlapCode].pathList.length) {
this.overlapData[row.overlapCode].pathList.forEach(item => {
if (item.sectionList && item.sectionList.length) {
item.sectionList.forEach(elem => {
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach(logicSectionCode => {
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](logicSectionCode));
sec.cutOff = true;
containSectionList.push(sec);
});
} else {
section.cutOff = true;
containSectionList.push(section);
}
});
}
}
if (row.routeSwitchList && row.routeSwitchList.length) {
row.routeSwitchList.forEach(el => {
console.log(row.routeSectionList.includes(el.sectionACode));
const swch = deepAssign({}, this.$refs.map.getDeviceByCode(el.switchCode));
const sectionA = this.$refs.map.getDeviceByCode(swch.sectionACode);
const sectionB = this.$refs.map.getDeviceByCode(swch.sectionBCode);
const sectionC = this.$refs.map.getDeviceByCode(swch.sectionCCode);
containSwitchList.push({code: el.switchCode, routeLock: true, normalPosition: el.normal,reversePosition: !el.normal});
if (el.normal) {
containSectionList.push({code: sectionA.code, routeLock:true });
containSectionList.push({code: sectionC.code, preBlue: true });
} else {
containSectionList.push({code: sectionC.code, routeLock:true });
containSectionList.push({code: sectionB.code, preBlue: true });
}
});
}
this.$store.dispatch('training/updateMapState', [...containSectionList]);
this.beforeSectionList = containSectionList || [];
}
this.$refs.map.updateMapDevice([...containSectionList, ...containSwitchList]);
this.beforeSectionList = containSectionList
this.beforeSwitchList = containSwitchList;
//
const operate = {

View File

@ -31,8 +31,8 @@ export function createBoundingRect(view) {
return rect;
}
export function calculateDCenter(viewRect, zrbound) {
var dx = (zrbound.width - viewRect.width) / 2 - viewRect.x;
export function calculateDCenter(viewRect, offsetX, zrbound) {
var dx = zrbound.width/2 - offsetX - viewRect.x;
var dy = 0;
return { dx: dx, dy: dy };
}

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://api.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.119:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';