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