状态调整

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, // 黄灯开放 yellowOpen: false, // 黄灯开放
redOpen: true, // 红灯开放(默认状态) redOpen: true, // 红灯开放(默认状态)
delayTime: 0, // 信号机延迟解锁倒计时 delayTime: 0, // 信号机延迟解锁倒计时
atsControl: 1, // 0是人工1是自动
fault: false // 是否故障 fault: false // 是否故障
}; };

View File

@ -49,7 +49,13 @@ class Status {
} }
handleSignal(device) { handleSignal(device) {
this.statusObj = { 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) { handlePsd(device) {

View File

@ -80,7 +80,7 @@ class Jlmap {
return defaultStateDict; return defaultStateDict;
} }
setMap(map, mapDevice) { setMap(map, mapDevice, routeData) {
// 保存皮肤类型 // 保存皮肤类型
if (map.skinVO) { if (map.skinVO) {
this.lineCode = map.skinVO.code; this.lineCode = map.skinVO.code;
@ -94,7 +94,8 @@ class Jlmap {
// 解析后的数据 // 解析后的数据
this.mapDevice = mapDevice; this.mapDevice = mapDevice;
// 进路数据
this.routeData = routeData;
// 加载对应皮肤 // 加载对应皮肤
this.style = this.loadStyle(this.lineCode); 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])); type != deviceType.Train && list.push(Object.assign({ code, _type: type }, this.defaultStateDict[type]));
}); });
this.update(list); this.update(list);
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); } if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
@ -245,6 +245,15 @@ class Jlmap {
(list || []).forEach(elem => { (list || []).forEach(elem => {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
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 {
const oDevice = this.mapDevice[code] || deviceFactory(type, elem); const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
if (elem.dispose) { if (elem.dispose) {
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
@ -253,9 +262,8 @@ class Jlmap {
this.$painter.update(oDevice); 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 oldTrainWindowModel = null;
var instance = device.instance; var instance = device.instance;
var curModel = device; var curModel = device;
let displayPosition = 'margin';
if (instance) { if (instance) {
oldTrainWindowModel = device.trainWindowModel; oldTrainWindowModel = device.trainWindowModel;
displayPosition = instance.style.Train.common.displayPosition;
} }
// console.log(device, '===============');
if (curModel.sectionCode) { if (curModel.sectionCode) {
curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode); curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode);
if (curModel.sectionModel.trainWindowCode) { if (curModel.sectionModel.trainWindowCode) {
curModel.trainWindowCode = 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) { } else if (curModel.right && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) {
const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[curModel.sectionModel.logicSectionCodeList.length - 1]); const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[curModel.sectionModel.logicSectionCodeList.length - 1]);
curModel.trainWindowCode = sec.trainWindowCode; curModel.trainWindowCode = sec.trainWindowCode;

View File

@ -6,11 +6,10 @@ class ESigDrict extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false; this.create();
} }
create() { create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
@ -27,22 +26,22 @@ class ESigDrict extends Group {
fill: style.Signal.route.routeColor fill: style.Signal.route.routeColor
} }
}); });
this.add(this.sigDrict); this.add(this.sigDrict);
} this.sigDrict.hide();
} }
// 隐藏 // 隐藏
hide() { hide() {
this.create();
this.sigDrict.hide(); this.sigDrict.hide();
} }
// 显示 // 显示
show() { show() {
this.create();
this.sigDrict.show(); this.sigDrict.show();
} }
setStyle(styles) {
this.sigDrict.setStyle( styles );
}
} }
export default ESigDrict; export default ESigDrict;

View File

@ -427,16 +427,10 @@ class Signal extends Group {
} }
} }
// 设置自动信号模式状态类型
setAutoSignalOpen() {
this.sigRoute.show();
}
// 隐藏自动信号和自动进路 // 隐藏自动信号和自动进路
setAutoClose() { setAutoClose() {
this.sigAuto.hide(); this.sigAuto.hide();
this.sigAuto.setColor(this.style.backgroundColor); this.sigAuto.setColor(this.style.backgroundColor);
this.sigRoute.hide();
} }
// 自动信号和自动进路开始动画 // 自动信号和自动进路开始动画
@ -509,6 +503,13 @@ class Signal extends Group {
} else { } else {
this.physicsLight(); // 设置物理点灯 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 (model.greenOpen) {
if (this.lamps[0]) { if (this.lamps[0]) {

View File

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

View File

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

View File

@ -293,7 +293,7 @@ export default {
}, },
// //
setMap(map) { 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) { refresh(map) {