状态调整

This commit is contained in:
joylink_fanyuhong 2020-02-14 18:07:54 +08:00
parent 42d0932e1c
commit 2cd2f93c20
9 changed files with 65 additions and 46 deletions

View File

@ -64,6 +64,7 @@ deviceState[deviceType.Signal] = {
yellowOpen: false, // 黄灯开放
redOpen: true, // 红灯开放(默认状态)
delayTime: 0, // 信号机延迟解锁倒计时
atsControl: 1, // 0是人工1是自动
fault: false // 是否故障
};

View File

@ -49,7 +49,13 @@ class Status {
}
handleSignal(device) {
this.statusObj = {
fault: device.fault /** 非故障*/
fault: device.fault, /** 非故障*/
atsControl: device.atsControl, /** 0是人工控制1是自动控制 */
blockade: device.blockade,
logicLight: device.logicLight,
greenOpen: device.greenOpen,
redOpen: device.redOpen,
yellowOpen: device.yellowOpen
};
}
handlePsd(device) {

View File

@ -80,7 +80,7 @@ class Jlmap {
return defaultStateDict;
}
setMap(map, mapDevice) {
setMap(map, mapDevice, routeData) {
// 保存皮肤类型
if (map.skinVO) {
this.lineCode = map.skinVO.code;
@ -94,7 +94,8 @@ class Jlmap {
// 解析后的数据
this.mapDevice = mapDevice;
// 进路数据
this.routeData = routeData;
// 加载对应皮肤
this.style = this.loadStyle(this.lineCode);
@ -121,7 +122,6 @@ class Jlmap {
// 列车不需要设置默认状态
type != deviceType.Train && list.push(Object.assign({ code, _type: type }, this.defaultStateDict[type]));
});
this.update(list);
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
@ -245,17 +245,25 @@ class Jlmap {
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
if (elem.dispose) {
this.$painter.delete(oDevice);
if (elem.deviceType === 'ROUTE') { // 处理进路数据状态
store.dispatch('map/updateRouteState', elem);
const route = this.routeData[code];
const signalDevice = this.mapDevice[route.startSignalCode];
const signalStatus = {atsControl: elem.atsControl};
if (this.hookHandle(signalDevice, signalStatus)) {
this.$painter.update(signalDevice);
}
} else {
if (this.hookHandle(oDevice, elem)) {
this.$painter.update(oDevice);
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
if (elem.dispose) {
this.$painter.delete(oDevice);
} else {
if (this.hookHandle(oDevice, elem)) {
this.$painter.update(oDevice);
}
}
}
if (elem.deviceType == 'ROUTE') { // 处理进路数据状态
store.dispatch('map/updateRouteState', elem);
}
});
// 状态后处理

View File

@ -106,14 +106,18 @@ class Painter {
var oldTrainWindowModel = null;
var instance = device.instance;
var curModel = device;
let displayPosition = 'margin';
if (instance) {
oldTrainWindowModel = device.trainWindowModel;
displayPosition = instance.style.Train.common.displayPosition;
}
// console.log(device, '===============');
if (curModel.sectionCode) {
curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode);
if (curModel.sectionModel.trainWindowCode) {
curModel.trainWindowCode = curModel.sectionModel.trainWindowCode;
} else if (displayPosition === 'center' && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) {
const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[Math.floor(curModel.sectionModel.logicSectionCodeList.length / 2)]);
curModel.trainWindowCode = sec.trainWindowCode;
} else if (curModel.right && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) {
const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[curModel.sectionModel.logicSectionCodeList.length - 1]);
curModel.trainWindowCode = sec.trainWindowCode;

View File

@ -6,43 +6,42 @@ class ESigDrict extends Group {
constructor(model) {
super();
this.model = model;
this.isNew = false;
this.create();
}
create() {
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
const model = this.model;
const style = this.model.style;
this.isNew = true;
this.sigDrict = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: triangular(model.x, model.y, model.drict, style.Signal.lamp.radiusR)
},
style: {
stroke: style.backgroundColor,
lineWidth: 0.5,
fill: style.Signal.route.routeColor
}
});
this.add(this.sigDrict);
}
this.isNew = true;
this.sigDrict = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: triangular(model.x, model.y, model.drict, style.Signal.lamp.radiusR)
},
style: {
stroke: style.backgroundColor,
lineWidth: 0.5,
fill: style.Signal.route.routeColor
}
});
this.add(this.sigDrict);
this.sigDrict.hide();
}
// 隐藏
hide() {
this.create();
this.sigDrict.hide();
}
// 显示
show() {
this.create();
this.sigDrict.show();
}
setStyle(styles) {
this.sigDrict.setStyle( styles );
}
}
export default ESigDrict;

View File

@ -427,16 +427,10 @@ class Signal extends Group {
}
}
// 设置自动信号模式状态类型
setAutoSignalOpen() {
this.sigRoute.show();
}
// 隐藏自动信号和自动进路
setAutoClose() {
this.sigAuto.hide();
this.sigAuto.setColor(this.style.backgroundColor);
this.sigRoute.hide();
}
// 自动信号和自动进路开始动画
@ -509,6 +503,13 @@ class Signal extends Group {
} else {
this.physicsLight(); // 设置物理点灯
}
/** 进路交人工控或自动控 */
if (model.atsControl) {
this.sigRoute.hide();
} else {
this.sigRoute.show();
this.sigRoute.setStyle({fill: this.style.Signal.auto.manualControl});
}
/** 设置灯的颜色 */
if (model.greenOpen) {
if (this.lamps[0]) {

View File

@ -258,7 +258,7 @@ export default {
cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING,
val: this.row.code,
param: {
Route_Code: this.row.code
routeCodeList: [this.row.code]
}
};
@ -282,7 +282,7 @@ export default {
cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING,
val: this.row.code,
param: {
Route_Code: this.row.code
routeCodeList: [this.row.code]
}
};

View File

@ -3,12 +3,12 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -293,7 +293,7 @@ export default {
},
//
setMap(map) {
this.$jlmap.setMap(map, this.$store.state.map.mapDevice);
this.$jlmap.setMap(map, this.$store.state.map.mapDevice, this.$store.state.map.routeData);
},
//
refresh(map) {