调整现地操作

This commit is contained in:
fan 2020-03-16 17:54:30 +08:00
parent 9c3a61a747
commit aa93cfc250
2 changed files with 31 additions and 5 deletions

View File

@ -111,7 +111,7 @@
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import Handler from '@/scripts/cmdPlugin/Handler';
// import { deepAssign } from '@/utils/index';
import { getAutoReentryBySignalCode } from '@/utils/index';
import PasswordBox from './dialog/childDialog/passwordInputBox.vue';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { mapGetters } from 'vuex';
@ -144,7 +144,8 @@ export default {
'routeList',
'routeData',
'signalList',
'autoReentryList'
'autoReentryList',
'autoReentryData'
]),
Switch() {
return OperationEvent.Switch;
@ -355,6 +356,10 @@ export default {
} else if (model._type === 'MapCycleButtonVO' ) {
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK;
operate.param = {cycleCode: model.cycleCode};
} else if (model._type === 'AutomaticRoute') {
const route = this.routeData[model.automaticRouteCode];
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_CI_AUTO;
operate.param = {signalCode: route.startSignalCode};
}
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
console.log(operate);
@ -367,11 +372,22 @@ export default {
param: {}
};
if (model._type === 'Signal') {
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE;
operate.param = {signalCode: model.code};
const autoReentry = getAutoReentryBySignalCode(model.code, this.routeList, this.autoReentryList);
const autoReentryRel = this.autoReentryData[autoReentry.code];
if (autoReentryRel.open) {
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK;
operate.param = {cycleCode: model.cycleCode, cancelRoute: true};
} else {
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE;
operate.param = {signalCode: model.code};
}
} else if (model._type === 'MapCycleButtonVO') {
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK;
operate.param = {cycleCode: model.cycleCode, cancelRoute: false};
} else if (model._type === 'AutomaticRoute') {
const route = this.routeData[model.automaticRouteCode];
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO;
operate.param = {signalCode: route.startSignalCode};
}
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
console.log(operate);

View File

@ -14,7 +14,17 @@ export async function getMapListByProject(drawWay) {
}
export function getAutoReentryBySignalCode(signalCode, routeList, autoReentryList) { // 根据折返进路的始端信号机去找
let route = '';
let autoReentry = '';
routeList.forEach(item => {
if (item.startSignalCode === signalCode && item.turnBack) {
route = item;
}
});
autoReentryList.forEach(item => {
if (item.turnBackRouteCode === route.code || item.turnBackRoute2Code === route.code) {
autoReentry = item;
}
});
return autoReentry;
}