大铁仿真调整

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

View File

@ -39,6 +39,9 @@ class Model {
this['private'][deviceType.TrainWindow] = {
trainWindowShow: true
};
this['private'][deviceType.SignalButton] = {
hasSelected: 0
};
}
initPublicProps(model) {

View File

@ -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 (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 (!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}]);
}
}
//
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 }) => {
}).catch(() => {
this.$refs.noticeInfo.doShow();
});
_that.deviceList = [];
}, 15000);
}
if (deviceList.length === 1) {
operate.code = deviceList[0].code; //
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) {
@ -729,7 +734,12 @@ export default {
this.clearOperate();
}
} 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) => {
commit('updateMapState', deviceStatus);
},
/** 新版状态 更新地图设备状态数据 */
updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapStateNew', deviceStatus);
},
/**
* 开始教学模式
*/