This commit is contained in:
zyy 2020-03-18 19:08:12 +08:00
commit 4243d62ab1
7 changed files with 222 additions and 150 deletions

View File

@ -180,10 +180,12 @@ class SkinCode extends defaultStyle {
route: {
direction: true, // 自动通过方向
offset: { x: 4, y: 0}, // 自动通过偏移量
routeColor: '#00FF00' // 自动进路
routeColor: '#00FF00', // 自动进路
radiusR: 6
},
auto: {
signalFrontTriangle: true, // 信号灯前三角展示
fleetModeTriangle: true, // 自动进路显示三角形非箭头
direction: false, // 自动通过方向
offset: { x: -4, y: 0}, // 自动通过偏移量
width: 5, // 自动宽度
@ -494,7 +496,7 @@ class SkinCode extends defaultStyle {
/** 引导总锁 */
this[deviceType.GuideLock] = {
// 是否显示
displayCondition: '03', // 显示条件 prdType
displayCondition: '03', // 显示条件 01所有模式下显示 02 行调显示 03现地显示
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细

View File

@ -15,7 +15,16 @@ deviceState[deviceType.Section] = {
/** 是否故障*/
fault: 0 /** 非故障*/
};
// 进路后端状态
// boolean cbtcMode;是否CBTC模式
// boolean atsControl;ats自动控制
// boolean fleetMode;连续通过进路模式(联锁自动进路)开启
// boolean ciControl;自动追踪/联锁自动触发模式开启
// boolean setting;进路是否排列中
// boolean settingGuide;是否引导进路排列
// boolean lock;进路是否锁闭
// boolean canceling;进路是否人解中
// boolean normalUnlock;是否正常解锁中
deviceState[deviceType.Switch] = {
singleLock: 0, // 是否单锁
blockade: 0, // 是否封锁

View File

@ -282,6 +282,8 @@ class Jlmap {
} else if (oDevice._type === deviceType.Section) {
this.$painter.updateShowStation(oDevice, stationCode);
this.showStationHandleSection(oDevice, stationCode);
} else if (oDevice._type === deviceType.TrainWindow) {
// 不处理车次窗 勿删
} else if (oDevice._type === deviceType.Psd) {
this.showStationHandlePsd(oDevice, stationCode);
} else {

View File

@ -10,7 +10,6 @@ import { EAxle } from './EAxle'; // 创建计轴 (私有)
import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头
import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle';
import router from '@/router';
import { drawSectionStyle } from '../../config/defaultStyle';
import store from '@/store';
import Vue from 'vue';
@ -67,14 +66,13 @@ export default class Section extends Group {
createSection() {
const model = this.model;
const style = this.style;
// 创建区段
this.section = new ELines({
zlevel: this.zlevel,
z: model.type == '02' ? this.z + 1 : this.z, // 逻辑区段层级降低一层
isSwitchSection: model.switchSection,
isCurve: model.curve,
points: model.points,
points: model.type == '04' ? [model.namePosition, model.namePosition] : model.points,
style: style
});
// 创建哈尔滨特殊区段(用作封锁显示)
@ -320,25 +318,23 @@ export default class Section extends Group {
this.add(this.name);
}
} else if (model.type == '04') { // 道岔计轴区段名称
if (router.currentRoute.path.startsWith('/design/usermap/map/draw') && router.currentRoute.path.endsWith('/draft')) {
this.name = new ETextName({
zlevel: this.zlevel,
z: this.z + 2,
style: this.style,
silent: false,
x: tempx + model.namePosition.x,
y: tempy + model.namePosition.y + style.Section.text.distance * drict,
fontWeight: style.Section.text.fontWeight,
fontSize: style.Section.text.fontSize,
fontFamily: style.fontFamily,
text: model.name,
textFill: style.Section.text.fontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,
textVerticalAlign: style.Section.text.textVerticalAlign
});
this.add(this.name);
}
this.name = new ETextName({
zlevel: this.zlevel,
z: this.z + 2,
style: this.style,
silent: false,
x: tempx + model.namePosition.x,
y: tempy + model.namePosition.y + style.Section.text.distance * drict,
fontWeight: style.Section.text.fontWeight,
fontSize: style.Section.text.fontSize,
fontFamily: style.fontFamily,
text: model.name,
textFill: style.Section.text.fontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,
textVerticalAlign: style.Section.text.textVerticalAlign
});
this.add(this.name);
}
/** 站台轨名称*/
@ -817,8 +813,16 @@ export default class Section extends Group {
sectionC && sectionC.instance && sectionC.instance.setState(sectionC, true);
}
}
let numFlag = 0;
model.logicSectionNum.forEach(item => {
numFlag += item;
});
if (numFlag) {
return;
}
// 顺序代表优先级
/** 道岔保护区段锁闭 */
model.overlapLock && this.protectiveLock();
{ model.overlapLock && this.protectiveLock(); }
/** 空闲锁闭或者叫进路锁闭 */
model.routeLock && this.routeLock();
/** 轨道封锁 */

View File

@ -443,8 +443,13 @@ class Signal extends Group {
// 设置自动进路模式状态类型
setAutoRouteOpen() {
this.sigAuto.setColor(this.style.Signal.auto.autoRoute);
this.sigAuto.show();
if (this.style.Signal.auto.fleetModeTriangle) {
this.sigRoute.show();
this.sigRoute.setStyle({ fill: this.style.Signal.auto.autoRoute });
} else {
this.sigAuto.setColor(this.style.Signal.auto.autoRoute);
this.sigAuto.show();
}
}
// 信号机进路自动触发模式状态类型
@ -473,9 +478,9 @@ class Signal extends Group {
recover() {
this.sigName.setStyle({ textBorderWidth: 0 });
this.setAutoClose();
this.model.atsControl && this.sigRoute.hide();
this.sigDelay.hide();
this.sigAuto.animationRecover();
this.sigRoute.hide();
this.sigName.setColor(this.style.Signal.text.defaultColor);
if (this.style.Signal.lamp.guidName == 'chengdu_03') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
@ -521,9 +526,7 @@ class Signal extends Group {
model.isRouteSignal && this.setLowButtonShow();
/** 信号机封锁 */
model.blockade && this.block();
// 联锁自动进路通过
// model.linkageAutoRouteShow = 1;
model.fleetMode && this.setAutoRouteOpen();
/** 设置点灯类型*/
if (model.lightType) {
this.logicalLight(); // 设置逻辑点灯
@ -533,6 +536,9 @@ class Signal extends Group {
model.guid && this.guid(); // 引导信号显示
/** 进路交人工控或自动控 */
!model.atsControl && this.setArtificialRouteClose();
// 联锁自动进路通过
model.fleetMode && this.setAutoRouteOpen();
debugger;
}
getBoundingRect() {

View File

@ -1,79 +1,79 @@
<template>
<div v-if="isShowBtn" class="menu" style="height: 45px;" :style="{left: point.x+'px', top: point.y+'px' }">
<button :id="Signal.arrangementRoute.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.arrangementRoute.button.operation, 'MixinCommand')">
<button :id="Signal.arrangementRoute.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.arrangementRoute.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="MixinCommand.totalCancel.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.totalCancel.button.operation, 'Signal')">
<button :id="MixinCommand.totalCancel.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.totalCancel.button.operation, ['Signal','AutoTurnBack','AutomaticRoute'])">
<span style="color: black">
<center><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Signal.guide.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.guide.button.operation, 'Signal')">
<button :id="Signal.guide.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.guide.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<!-- 流程未做暂不显示 -->
<button :id="Station.guideLock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Station.guideLock.button.operation)">
<button :id="Station.guideLock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Station.guideLock.button.operation, ['GuideLock'])">
<span style="color: #800000">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Signal.humanTrainRoute.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.humanTrainRoute.button.operation, 'Signal')">
<button :id="Signal.humanTrainRoute.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.humanTrainRoute.button.operation, ['Signal'])">
<span style="color: #800000">
<center><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Section.fault.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Section.fault.button.operation, 'Section')">
<button :id="Section.fault.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Section.fault.button.operation, ['Section'])">
<span style="color: #800000">
<center><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Switch.locate.button.domId" class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown(Switch.locate.button.operation, 'Switch')">
<button :id="Switch.locate.button.domId" class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown(Switch.locate.button.operation, ['Switch'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Switch.reverse.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.reverse.button.operation, 'Switch')">
<button :id="Switch.reverse.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.reverse.button.operation, ['Switch'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Switch.lock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.lock.button.operation, 'Switch')">
<button :id="Switch.lock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.lock.button.operation, ['Switch'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Switch.unlock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unlock.button.operation, 'Switch')">
<button :id="Switch.unlock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unlock.button.operation, ['Switch'])">
<span style="color: #800000">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="MixinCommand.block.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.block.button.operation, 'MixinCommand')">
<button :id="MixinCommand.block.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.block.button.operation, ['Switch', 'Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b></center>
</span>
</button>
<button :id="MixinCommand.unblock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.unblock.button.operation, 'MixinCommand')">
<button :id="MixinCommand.unblock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.unblock.button.operation, ['Switch', 'Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b></center>
</span>
</button>
<button :id="MixinCommand.functionButton.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.functionButton.button.operation, 'MixinCommand')">
<button :id="MixinCommand.functionButton.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.functionButton.button.operation, ['StationStand', 'AutoTurnBack', 'AutomaticRoute'])">
<span style="color: black">
<center>
<b style="color:#4B4B99"></b>
@ -85,13 +85,13 @@
</center>
</span>
</button>
<button :id="Signal.atsAutoControl.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.atsAutoControl.button.operation, 'Signal')">
<button :id="Signal.atsAutoControl.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.atsAutoControl.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Signal.humanControl.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.humanControl.button.operation, 'Signal')">
<button :id="Signal.humanControl.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.humanControl.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b><b></b></center>
@ -104,6 +104,7 @@
</span>
</button>
<password-box ref="password" @checkOver="passWordCommit" />
<notice-info ref="noticeInfo" />
</div>
</template>
@ -111,15 +112,17 @@
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import Handler from '@/scripts/cmdPlugin/Handler';
import { getAutoReentryBySignalCode } from '@/utils/index';
import { getAutoReentryBySignalCode } from '@/utils/mapList';
import PasswordBox from './dialog/childDialog/passwordInputBox.vue';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { mapGetters } from 'vuex';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
export default {
name: 'MapButtonMenu',
components: {
PasswordBox
PasswordBox,
NoticeInfo
},
data() {
return {
@ -134,7 +137,7 @@ export default {
width: 58,
tempData: null,
offset: {},
commandType: '',
commandTypeList: [],
cmdTypeList: [],
deviceList: []
};
@ -177,8 +180,10 @@ export default {
return CMD.Switch.CMD_SWITCH_SINGLE_LOCK;
case this.Switch.unlock.button.operation: //
return CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK;
case this.Switch.locate.button.operation || this.Switch.reverse.button.operation: // /
return CMD.Switch.CMD_SWITCH_TURN;
case this.Switch.locate.button.operation: //
return CMD.Switch.CMD_SWITCH_NORMAL_POSITION;
case this.Switch.reverse.button.operation: //
return CMD.Switch.CMD_SWITCH_REVERSE_POSITION;
case this.MixinCommand.block.button.operation: //
return {};
case this.MixinCommand.unblock.button.operation: //
@ -190,15 +195,15 @@ export default {
case this.Section.fault.button.operation: //
return CMD.Section.CMD_SECTION_FAULT_UNLOCK;
case this.Signal.humanTrainRoute.button.operation: // ()
return CMD.Section.CMD_SIGNAL_HUMAN_RELEASE_ROUTE;
case this.Signal.cancelTrainRoute.button.operation: //
return CMD.Section.CMD_SIGNAL_CANCEL_ROUTE;
return CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE;
case this.Signal.arrangementRoute.button.operation: //
return CMD.Signal.CMD_SIGNAL_SET_ROUTE;
case this.Signal.guide.button.operation: //
return CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE;
case this.Signal.reopenSignal.button.operation:
return CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL;
case this.Station.guideLock.button.operation:
return CMD.Station.CMD_STATION_SET_MASTER_GUIDE_LOCK;
}
return '';
}
@ -223,10 +228,13 @@ export default {
type: 'mbm',
operation: data.operateNext
};
this.trainingOperation(operate);
},
//
trainingOperation(operate) {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
@ -262,33 +270,21 @@ export default {
}
}
},
buttonDown(operation, commandType) {
buttonDown(operation, commandTypeList) {
this.deviceList = [];
if (operation != this.Command.cancel.clearMbm.operation) {
const operate = {
type: 'mbm',
operation: operation
};
const operationList = [this.Signal.humanTrainRoute.button.operation, this.Section.fault.button.operation, this.Switch.unlock.button.operation, this.MixinCommand.unblock.button.operation];
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.operation = operation;
this.commandType = commandType;
if (this.commandType == 'MixinCommand') {
this.cmdTypeList = ['Switch', 'Signal'];
} else {
this.cmdTypeList = [commandType];
}
this.commandTypeList = commandTypeList;
this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (operation == this.Signal.humanTrainRoute.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.Section.fault.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.Switch.unlock.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.MixinCommand.unblock.button.operation) { //
if (operationList.includes(operation)) {
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
@ -303,7 +299,7 @@ export default {
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.commandType = '';
this.commandTypeList = [];
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
Handler.clear(); //
@ -313,6 +309,12 @@ export default {
},
arrangementRouteOperation(deviceList) {
const routes = [];
const operate = {
send: true,
operation: this.$store.state.menuOperation.buttonOperation,
cmdType: '',
param: ''
};
let isArrangementRoute = false;
if (deviceList.length === 1) {
this.routeList.forEach(item => {
@ -325,19 +327,17 @@ export default {
});
const signal = this.$store.getters['map/getDeviceByCode'](deviceList[0].code);
if (signal.redOpen && !signal.greenOpen && !signal.yellowOpen && isArrangementRoute) {
const operate = {
type: 'mbm',
operation: this.Signal.reopenSignal.button.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
const newOperate = this.handelOperate(deviceList[0].code);
this.$store.dispatch('training/nextNew', newOperate).then(({ valid, response }) => {});
});
operate.cmdType = CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL;
operate.param = {signalCode: deviceList[0].code};
this.deviceList = [];
this.$store.dispatch('training/nextNew', newOperate).then(({ valid, response }) => {});
}
} else if (deviceList.length === 2) {
this.routeList.forEach(item => {
if (item.startSignalCode === deviceList[0].code && item.endSignalCode === deviceList[1].code) {
const operate = this.handelOperate(item);
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE;
operate.param = {routeCode: item.code};
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
}
});
@ -364,7 +364,10 @@ export default {
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_CI_AUTO;
operate.param = {signalCode: route.startSignalCode};
}
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch(() => {
this.deviceList = [];
this.$refs.noticeInfo.doShow(operate);
});
},
handelTotalCancel(model, subType) {
const operate = {
@ -391,7 +394,10 @@ export default {
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO;
operate.param = {signalCode: route.startSignalCode};
}
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {}).catch(() => {
this.deviceList = [];
this.$refs.noticeInfo.doShow(operate);
});
},
handleGuideRoute(deviceList) {
if (deviceList.length === 1) {
@ -422,9 +428,9 @@ export default {
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.deviceList = [];
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate['operateNext'] = this.Command.close.password.operation;
this.operation = '0';
this.$refs.password.doShow(operate);
}
});
@ -439,86 +445,129 @@ export default {
this.routeList.forEach(item => {
if (item.startSignalCode === deviceList[0].code && item.endSignalCode === deviceList[1].code) {
operate.param = {routeCode: item.code};
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
}
});
}
},
selectedChange() {
//
if (this.$store.state.menuOperation.buttonOperation) {
const model = this.$store.state.menuOperation.selected; //
const subType = this.$store.state.menuOperation.subType; //
this.deviceList.push(model);
if (model._type) {
if (this.Signal.arrangementRoute.button.operation === this.$store.state.menuOperation.buttonOperation) {
if (model._type !== 'Signal') {
return;
}
this.arrangementRouteOperation(this.deviceList);
} else if (this.$store.state.menuOperation.buttonOperation === this.MixinCommand.functionButton.button.operation) {
this.handelFunctionButton(model, subType);
} else if (this.$store.state.menuOperation.buttonOperation === this.MixinCommand.totalCancel.button.operation) {
this.handelTotalCancel(model, subType);
} else if (this.$store.state.menuOperation.buttonOperation === this.Signal.guide.button.operation) {
if (model._type !== 'Signal') {
return;
}
this.handleGuideRoute(this.deviceList);
} else {
const operate = this.handelOperate(model);
if (this.cmdTypeList.indexOf(model._type) >= 0) {
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
} else {
Handler.clear(); //
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
}
} else {
Handler.clear(); //
this.$store.dispatch('menuOperation/setButtonOperation', null);
handleTotalHumanSolution(model) {
let route = '';
this.routeList.forEach(item => {
if (item.startSignalCode === model.code) {
route = item;
}
});
const operate = {
send: true,
operation: this.$store.state.menuOperation.buttonOperation
};
if (this.routeData[route.code].settingGuide) {
operate.cmdType = CMD;
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {});
} else {
operate.cmdType = CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE;
operate.param = {signalCode: model.code};
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
}
},
handelOperate(model) { // operate
this.deviceList = [];
handelControlRoute(model) {
const routeCodeList = [];
const operate = {
send: true,
operation: this.$store.state.menuOperation.buttonOperation,
cmdType: this.cmdType,
param: {}
};
switch (this.commandType) {
case 'Switch':
operate.param['switchCode'] = model.code;
break;
case 'Signal':
operate.param['signalCode'] = model.code;
break;
case 'Section':
operate.param['sectionCode'] = model.code;
break;
case 'MixinCommand':
if (model._type == 'Switch') {
if (this.operation == this.MixinCommand.block.button.operation) {
operate.cmdType = CMD.Switch.CMD_SWITCH_BLOCK;
} else if (this.operation == this.MixinCommand.unblock.button.operation) {
operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK;
}
operate.param['Switch_Code'] = model.code;
} else if (model._type == 'Signal') {
if (this.operation == this.MixinCommand.block.button.operation) {
operate.cmdType = CMD.Signal.CMD_SIGNAL_BLOCK;
} else if (this.operation == this.MixinCommand.unblock.button.operation) {
operate.cmdType = CMD.Signal.CMD_SIGNAL_UNBLOCK;
}
operate.param['Signal_Code'] = model.code;
} else if (model.deviceType == 'ROUTE') {
operate.param['routeCode'] = model.code;
this.routeList.forEach(item => {
if (item.startSignalCode === model.code) {
routeCodeList.push(item.code);
}
break;
});
operate.param = {signalCode: model.code, routeCodeList: routeCodeList};
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
handelSwitchOperate(model) {
const operate = {
send: true,
operation: this.$store.state.menuOperation.buttonOperation,
cmdType: this.cmdType,
param: { switchCode: model.code}
};
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
handelBlockOrUnblock(model) {
const buttonOperation = this.$store.state.menuOperation.buttonOperation;
const operate = {
send: true,
operation: buttonOperation,
cmdType: '',
param: {}
};
if (model.type === 'Switch' && buttonOperation === this.MixinCommand.block.button.operation) {
operate.cmdType = CMD.Switch.CMD_SWITCH_BLOCK;
operate.param = {SwitchCode: model.code};
} else if (model.type === 'Switch' && buttonOperation === this.MixinCommand.unblock.button.operation) {
operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK;
operate.param = {SwitchCode: model.code};
} else if (model.type === 'Signal' && buttonOperation === this.MixinCommand.block.button.operation) {
operate.cmdType = CMD.Signal.CMD_SIGNAL_BLOCK;
operate.param = {SignalCode: model.code};
} else if (model.type === 'Signal' && buttonOperation === this.MixinCommand.unblock.button.operation) {
operate.cmdType = CMD.Signal.CMD_SIGNAL_UNBLOCK;
operate.param = {SignalCode: model.code};
}
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
selectedChange() {
//
const buttonOperation = this.$store.state.menuOperation.buttonOperation;
const model = this.$store.state.menuOperation.selected; //
const subType = this.$store.state.menuOperation.subType; //
const switchOperation = [this.Switch.lock.button.operation, this.Switch.unlock.button.operation, this.Switch.locate.button.operation, this.Switch.reverse.button.operation];
if (buttonOperation && this.commandTypeList.includes(model._type)) {
this.deviceList.push(model);
if (buttonOperation === this.Signal.arrangementRoute.button.operation) {
this.arrangementRouteOperation(this.deviceList);
} else if (buttonOperation === this.MixinCommand.functionButton.button.operation) {
this.handelFunctionButton(model, subType);
} else if (buttonOperation === this.MixinCommand.totalCancel.button.operation) {
this.handelTotalCancel(model, subType);
} else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) {
this.handleTotalHumanSolution(model);
} else if (buttonOperation === this.Signal.guide.button.operation) {
this.handleGuideRoute(this.deviceList);
} else if (buttonOperation === this.Signal.atsAutoControl.button.operation || buttonOperation === this.Signal.humanControl.button.operation) {
this.handelControlRoute(model);
} else if (switchOperation.includes(buttonOperation)) {
this.handelSwitchOperate(model);
} else if (buttonOperation === this.MixinCommand.block.button.operation || buttonOperation === this.MixinCommand.unblock.button.operation) {
this.handelBlockOrUnblock(model);
} else {
const operate = this.handelOperate(model);
if (this.cmdTypeList.indexOf(model._type) >= 0) {
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {});
} else {
Handler.clear(); //
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
}
} else {
Handler.clear(); //
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
return operate;
}
}
};

View File

@ -2,7 +2,7 @@ import store from '@/store';
import { Notification } from 'element-ui';
function handle(state, data) {
// console.log(data, 'socket订阅');
console.log(data, 'socket订阅');
const msg = data.body;
const path = window.location.href;
switch (data.type) {