大铁仿真调整

This commit is contained in:
fan 2021-04-23 10:24:05 +08:00
parent 6f06822793
commit 4fcaffae50
4 changed files with 83 additions and 66 deletions

View File

@ -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() {

View File

@ -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) {

View File

@ -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();
}
} }
} }
} }

View File

@ -532,10 +532,6 @@ const training = {
updateMapState: ({ commit }, deviceStatus) => { updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapState', deviceStatus); commit('updateMapState', deviceStatus);
}, },
/** 新版状态 更新地图设备状态数据 */
updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapStateNew', deviceStatus);
},
/** /**
* 开始教学模式 * 开始教学模式
*/ */