大铁仿真调整
This commit is contained in:
parent
6f06822793
commit
4fcaffae50
@ -20,12 +20,7 @@ export default class SignalButton extends Group {
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
let fillColor = '#008000';
|
||||
if (model.type === 'GUIDE') {
|
||||
fillColor = '#5050E1';
|
||||
} else if (model.type === 'FLEXIBLE' || model.type === 'SHUNT_TERMINAL') {
|
||||
fillColor = '#808080';
|
||||
}
|
||||
const fillColor = this.getTypeColor();
|
||||
this.rectButton = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
@ -95,23 +90,36 @@ export default class SignalButton extends Group {
|
||||
}
|
||||
}
|
||||
startAnimate() {
|
||||
let color = '#008000';
|
||||
if (this.model.type === 'TRAIN_TERMINAL') {
|
||||
color = '#008000';
|
||||
} else if (this.model.type === 'FLEXIBLE' || this.model.type === 'SHUNT_TERMINAL') {
|
||||
color = '#808080';
|
||||
}
|
||||
this.rectButton && this.rectButton.animateStyle(true)
|
||||
.when(0, { fill: '#000' })
|
||||
.when(1000, { fill: color })
|
||||
.when(1000, { fill: this.getTypeColor() })
|
||||
.when(2000, { fill: '#000' })
|
||||
.start();
|
||||
}
|
||||
stopAnimation() {
|
||||
this.rectButton && this.rectButton.stopAnimation(true);
|
||||
}
|
||||
getTypeColor() {
|
||||
let color = '';
|
||||
if (this.model.type === 'FLEXIBLE' || this.model.type === 'SHUNT_TERMINAL') {
|
||||
color = '#808080';
|
||||
} else if (this.model.type === 'GUIDE') {
|
||||
color = '#5050E1';
|
||||
} else {
|
||||
color = '#008000';
|
||||
}
|
||||
return color;
|
||||
}
|
||||
recover() {
|
||||
this.stopAnimation();
|
||||
this.rectButton && this.rectButton.setStyle({ fill:this.getTypeColor() });
|
||||
}
|
||||
setState(model) {
|
||||
this.recover();
|
||||
if (!this.isShowShape) return;
|
||||
if (model.hasSelected) {
|
||||
this.startAnimate();
|
||||
}
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
|
@ -39,6 +39,9 @@ class Model {
|
||||
this['private'][deviceType.TrainWindow] = {
|
||||
trainWindowShow: true
|
||||
};
|
||||
this['private'][deviceType.SignalButton] = {
|
||||
hasSelected: 0
|
||||
};
|
||||
}
|
||||
|
||||
initPublicProps(model) {
|
||||
|
@ -134,7 +134,9 @@ export default {
|
||||
commandTypeList: [],
|
||||
cmdTypeList: [],
|
||||
deviceList: [],
|
||||
timer: null
|
||||
timer: null,
|
||||
deviceTimer: null,
|
||||
routeDataMap: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -211,6 +213,7 @@ export default {
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.routeDataMap = null;
|
||||
this.resetMbmButton();
|
||||
},
|
||||
methods: {
|
||||
@ -327,60 +330,62 @@ export default {
|
||||
this.$store.dispatch('menuOperation/setButtonOperation', null);
|
||||
Handler.clear(); // 清空操作组
|
||||
},
|
||||
handleRouteDataMap() {
|
||||
this.routeDataMap = {};
|
||||
this.routeList.forEach(item => {
|
||||
this.routeDataMap[item.btnCodeList.join('-')] = item;
|
||||
});
|
||||
},
|
||||
// 排列进路 OR 信号重开操作
|
||||
arrangementRouteOperation(deviceList) {
|
||||
const operate = {
|
||||
operation: this.$store.state.menuOperation.buttonOperation
|
||||
operation: this.Signal.arrangementRoute.button.operation
|
||||
};
|
||||
let isArrangementRoute = false;
|
||||
if (!this.routeDataMap) { this.handleRouteDataMap(); }
|
||||
if (this.deviceTimer) {
|
||||
const _that = this;
|
||||
clearTimeout(this.deviceTimer);
|
||||
this.deviceTimer = setTimeout(() => {
|
||||
if (deviceList[0]._type === 'SignalButton') {
|
||||
_that.$store.dispatch('training/updateMapState', [{code: deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
|
||||
}
|
||||
_that.deviceList = [];
|
||||
}, 15000);
|
||||
}
|
||||
if (deviceList.length === 1) {
|
||||
const signal = deviceList[0];
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](signal.sectionCode);
|
||||
if (sectionModel) {
|
||||
// 判断 信号机所在区段的 左右关联区段 是否有锁闭
|
||||
const sectionLeft = this.$store.getters['map/getDeviceByCode'](sectionModel.leftSectionCode);
|
||||
const sectionRight = this.$store.getters['map/getDeviceByCode'](sectionModel.rightSectionCode);
|
||||
if (sectionLeft.routeLock || sectionRight.routeLock) {
|
||||
isArrangementRoute = true;
|
||||
}
|
||||
}
|
||||
// 如果该信号机红灯亮 而且 所属区段左右两侧区段锁闭 执行信号重启操作
|
||||
if (signal.redOpen && !signal.greenOpen && !signal.yellowOpen && isArrangementRoute) { // 信号重启
|
||||
operate.over = true;
|
||||
operate.cmdType = CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL;
|
||||
operate.code = deviceList[0].code;
|
||||
operate.param = {signalCode: deviceList[0].code};
|
||||
this.deviceList = [];
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
} else {
|
||||
operate.code = deviceList[0].code; // 进路排列
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
}
|
||||
} else if (deviceList.length === 2) {
|
||||
let flag = false;
|
||||
this.routeList.forEach(item => {
|
||||
// item.endButtonSignalCode
|
||||
// 起始信号机 和 结束信号机按钮 过滤进路
|
||||
if (item.startSignalCode === deviceList[0].code && item.endSignalCode === deviceList[1].code) {
|
||||
operate.over = true;
|
||||
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE;
|
||||
operate.code = deviceList[1].code;
|
||||
operate.param = {routeCode: item.code};
|
||||
this.deviceList = [];
|
||||
flag = true;
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
|
||||
if (deviceList[0]._type === 'SignalButton') {
|
||||
this.$store.dispatch('training/updateMapState', [{code: deviceList[0].code, _type: 'SignalButton', hasSelected: 1}]);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
} else if (deviceList.length > 1) {
|
||||
let key = '';
|
||||
deviceList.forEach((item, index) => {
|
||||
if (index) {
|
||||
key += `-${item.code}`;
|
||||
} else {
|
||||
key = item.code;
|
||||
}
|
||||
});
|
||||
if (!flag) {
|
||||
const route = this.routeDataMap[key];
|
||||
if (route) {
|
||||
operate.over = true;
|
||||
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE;
|
||||
operate.code = deviceList[deviceList.length - 1].code;
|
||||
operate.param = {id: route.code};
|
||||
this.deviceList = [];
|
||||
this.$refs.noticeInfo.doShow('未找到选择的进路!');
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
|
||||
if (deviceList[0]._type === 'SignalButton') {
|
||||
this.$store.dispatch('training/updateMapState', [{code: deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
|
||||
}
|
||||
this.deviceTimer && clearTimeout(this.deviceTimer);
|
||||
}).catch(() => {
|
||||
this.deviceTimer && clearTimeout(this.deviceTimer);
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -708,7 +713,7 @@ export default {
|
||||
if (buttonOperation && this.commandTypeList.includes(model._type)) {
|
||||
this.deviceList.push(model);
|
||||
if (buttonOperation === this.Signal.arrangementRoute.button.operation) {
|
||||
this.arrangementRouteOperation(this.deviceList);
|
||||
// this.arrangementRouteOperation(this.deviceList);
|
||||
} else if (buttonOperation === this.MixinCommand.totalCancel.button.operation) {
|
||||
this.handelTotalCancel(model, subType);
|
||||
} else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) {
|
||||
@ -728,11 +733,16 @@ export default {
|
||||
} else {
|
||||
this.clearOperate();
|
||||
}
|
||||
} else {
|
||||
if (model._type === 'SignalButton') {
|
||||
this.deviceList.push(model);
|
||||
this.arrangementRouteOperation(this.deviceList);
|
||||
} else {
|
||||
this.clearOperate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
@ -532,10 +532,6 @@ const training = {
|
||||
updateMapState: ({ commit }, deviceStatus) => {
|
||||
commit('updateMapState', deviceStatus);
|
||||
},
|
||||
/** 新版状态 更新地图设备状态数据 */
|
||||
updateMapState: ({ commit }, deviceStatus) => {
|
||||
commit('updateMapStateNew', deviceStatus);
|
||||
},
|
||||
/**
|
||||
* 开始教学模式
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user