北京一号线现地 自动折返设置和取消操作代码添加

This commit is contained in:
joylink_cuiweidong 2020-03-18 15:31:59 +08:00
parent a126ddad02
commit 68571fff18
5 changed files with 93 additions and 473 deletions

View File

@ -105,7 +105,7 @@ export default class Automactic extends Group {
} }
recover() { recover() {
this.control.setStyle({ fill: this.style.AutoTurnBack.lamp.controlColor }); this.control && this.control.setStyle({ fill: this.style.AutoTurnBack.lamp.controlColor });
} }
handleSignal() { handleSignal() {
this.control.setStyle({ fill: 'green' }); this.control.setStyle({ fill: 'green' });

View File

@ -1,455 +0,0 @@
<template>
<div>
<el-dialog
v-dialogDrag
class="beijing-01__systerm section-cmd-control"
:title="title"
:visible.sync="show"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="padding: 10px 20px; border: 1px solid lightgray;">
<span class="base-label">命令信息</span>
<el-form label-position="center" size="mini">
<el-row>
<el-col :span="8">
<el-form-item label="类型" label-width="40px">
<el-select v-model="operation" size="small" disabled>
<el-option
v-for="option in typeList"
:key="option.code"
:label="option.name"
:value="option.code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="车站名称" label-width="80px">
<el-input v-model="stationName" size="small" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="区段名称" label-width="100px">
<el-input v-model="sectionName" size="small" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<el-table
ref="tempData"
class="table"
:data="tempData"
border
style="width: 100%"
size="mini"
highlight-current-row
height="200"
>
<el-table-column prop="order" :width="50" label="序号" />
<el-table-column prop="date" :width="160" label="时间" />
<el-table-column prop="context" :width="180" label="执行过程" />
<el-table-column prop="result" label="执行结果" />
</el-table>
<span class="notice">{{ message }}</span>
<el-row class="button-group">
<el-col :span="2" :offset="2">
<el-button :id="domIdCommand" type="primary" :disabled="cmdDisabled[0]" @click="command">下达<span
v-show="timeCountCommand>0"
>({{ timeCountCommand }})</span></el-button>
</el-col>
<el-col :span="2" :offset="2">
<el-button :id="domIdConfirm1" type="primary" :disabled="cmdDisabled[1]" @click="confirm1">确认1
</el-button>
</el-col>
<el-col :span="2" :offset="2">
<el-button :id="domIdConfirm2" type="primary" :disabled="cmdDisabled[2]" @click="confirm2">确认2<span
v-show="timeCountConfirm>0"
>({{ timeCountConfirm }})</span></el-button>
</el-col>
<el-col :span="2" :offset="2">
<el-button :id="domIdStop" type="primary" :disabled="stpDisabled" @click="stop">中止</el-button>
</el-col>
<el-col :span="2" :offset="2">
<el-button :id="domIdClose" @click="close">关闭</el-button>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import { now } from '@/utils/date';
export default {
name: 'SectionCmdControl',
data() {
return {
dialogShow: false,
backOperate: '',
selected: '',
order: 0,
row: null,
timer: null,
operation: '',
cmdDisabled: [true, true, true],
stpDisabled: true,
tempData: [],
message: '',
timeCountCommand: -1,
timeCountConfirm: -1,
stationName: '',
sectionName: ''
};
},
computed: {
typeList() {
return [
{ code: OperationEvent.Section.unlock.menu.operation, name: '区段解封' },
{ code: OperationEvent.Section.fault.menu.operation, name: '区段故障解锁' },
{ code: OperationEvent.Section.axlePreReset.menu.operation, name: '区段计轴预复位' }
];
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCommand() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
return OperationEvent.Section.fault.order.domId;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
return OperationEvent.Section.axlePreReset.order.domId;
} else {
return '';
}
} else {
return '';
}
},
domIdConfirm1() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
return OperationEvent.Section.fault.confirm1.domId;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
return OperationEvent.Section.axlePreReset.confirm1.domId;
} else {
return '';
}
} else {
return '';
}
},
domIdConfirm2() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
return OperationEvent.Section.fault.confirm2.domId;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
return OperationEvent.Section.axlePreReset.confirm2.domId;
} else {
return '';
}
} else {
return '';
}
},
domIdStop() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
return OperationEvent.Section.fault.stop.domId;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
return OperationEvent.Section.axlePreReset.stop.domId;
} else {
return '';
}
} else {
return '';
}
},
domIdClose() {
if (this.dialogShow) {
return OperationEvent.Command.close.menu.domId;
} else {
return '';
}
},
title() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
return '区段故障解锁';
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
return '区段计轴预复位';
} else {
return '';
}
} else {
return '';
}
}
},
watch: {
cmdDisabled: {
handler(val, oldVal) {
this.stpDisabled = true;
val.forEach((elem, index) => {
// 1
if (elem == false && index >= 1 && index <= 2) {
this.stpDisabled = false;
}
});
},
deep: true
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
this.timer = setInterval(() => {
if (!this.$store.state.menuOperation.break) {
if (this.timeCountCommand > 0) {
this.timeCountCommand--;
} else if (this.timeCountCommand == 0) {
this.setButtonEnable({ step: 0 });
this.timeCountCommand = -1;
}
if (this.timeCountConfirm > 0) {
this.timeCountConfirm--;
} else if (this.timeCountConfirm == 0) {
this.setButtonEnable({ step: 0 });
this.timeCountConfirm = -1;
}
}
}, 1000);
},
beforeDestroy() {
clearInterval(this.timer);
this.timer = null;
},
methods: {
doShow(operate, selected) {
this.selected = selected;
if (!this.dialogShow) {
this.sectionName = '';
this.stationName = '';
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (selected.type === '02') {
const section = this.$store.getters['map/getDeviceByCode'](selected.parentCode);
if (section) {
this.sectionName += section.name;
}
}
this.sectionName += selected.name;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
}
this.order = 0;
this.operation = operate.operation || '';
this.dialogShow = true;
this.tempData = [];
this.timeCountCommand = -1;
this.timeCountConfirm = -1;
this.cmdDisabled = [false, true, true];
}
this.stpDisabled = true;
this.setMessage('请点击“下达”按钮,下达命令!');
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
command() {
if (this.operation == OperationEvent.Section.fault.menu.operation ||
this.operation == OperationEvent.Section.unlock.menu.operation ||
this.operation == OperationEvent.Section.cancelSpeed.menu.operation ||
this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 第一步不带弹框处理*/
this.commandNoPopUp();
} else {
/** 第一步带弹框处理*/
this.commandHasPopUp();
}
},
commandHasPopUp() {
},
commandNoPopUp() {
const operate = {
type: MapDeviceType.Section.type
};
if (this.operation == OperationEvent.Section.unlock.menu.operation) {
/** 区段解封*/
operate.operation = OperationEvent.Section.unlock.order.operation;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.order.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
operate.operation = OperationEvent.Section.axlePreReset.order.operation;
}
this.setMessage('请点击“确认1”按钮确认命令');
this.writeRecord({ order: ++this.order, date: now(), context: '点击下达命令', result: '' });
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.setButtonEnable({ step: 1 });
this.editRecord({ order: this.order, date: now(), context: '点击下达命令', result: '执行成功' });
} else {
this.editRecord({ order: this.order, date: now(), context: '点击下达命令', result: '执行失败' });
}
}).catch(() => {
this.editRecord({ order: this.order, date: now(), context: '点击下达命令', result: '执行异常' });
});
},
confirm1() {
const operate = {
type: MapDeviceType.Section.type
};
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.confirm1.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
operate.operation = OperationEvent.Section.axlePreReset.confirm1.operation;
}
this.setMessage('请点击“确认2”按钮确认命令');
this.writeRecord({ order: ++this.order, date: now(), context: '点击确认1', result: '' });
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.timeCountCommand = -1;
this.timeCountConfirm = 10;
this.setButtonEnable({ step: 2 });
this.editRecord({ order: this.order, date: now(), context: '点击确认1', result: '执行成功' });
} else {
this.editRecord({ order: this.order, date: now(), context: '点击确认1', result: '执行失败' });
}
}).catch(() => {
this.editRecord({ order: this.order, date: now(), context: '点击确认1', result: '执行异常' });
});
},
confirm2() {
const operate = {
send: true,
type: MapDeviceType.Section.type
};
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.confirm2.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
operate.operation = OperationEvent.Section.axlePreReset.confirm2.operation;
}
this.setMessage('');
this.writeRecord({ order: ++this.order, date: now(), context: '点击确认2', result: '' });
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.timeCountCommand = -1;
this.timeCountConfirm = -1;
this.setButtonEnable({ step: -1 });
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.editRecord({ order: this.order, date: now(), context: '点击确认2', result: '执行成功' });
} else {
this.editRecord({ order: this.order, date: now(), context: '点击确认2', result: '执行失败' });
}
}).catch(() => {
this.timeCountCommand = -1;
this.timeCountConfirm = -1;
this.setButtonEnable({ step: -1 });
this.editRecord({ order: this.order, date: now(), context: '点击确认2', result: '执行异常' });
});
},
stop() {
const operate = {
type: MapDeviceType.Section.type
};
if (this.operation == OperationEvent.Section.unlock.menu.operation) {
/** 区段解封*/
operate.operation = OperationEvent.Section.unlock.stop.operation;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.stop.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
operate.operation = OperationEvent.Section.axlePreReset.stop.operation;
}
this.writeRecord({ order: ++this.order, date: now(), context: '点击终止', result: '' });
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.setButtonEnable({ step: 0 });
this.editRecord({ order: this.order, date: now(), context: '点击终止', result: '执行成功' });
} else {
this.editRecord({ order: this.order, date: now(), context: '点击终止', result: '执行失败' });
}
}).catch(() => {
this.editRecord({ order: this.order, date: now(), context: '点击终止', result: '执行异常' });
});
},
close() {
const operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.close.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
},
getOperate(operate) {
/** 弹框返回值处理*/
},
setButtonEnable(param) {
this.cmdDisabled = [true, true, true];
if (param && param.step >= 0) {
this.cmdDisabled[param.step] = false;
}
},
setMessage(message) {
this.message = message;
},
writeRecord(param) {
this.tempData.push(param);
},
editRecord(param) {
this.tempData.forEach(elem => {
if (elem.order == param.order) {
for (var prop in param) {
elem[prop] = param[prop];
}
}
});
}
}
};
</script>

View File

@ -84,6 +84,8 @@ export default {
return '区段控制'; return '区段控制';
} else if (this.operation == OperationEvent.Section.fault.menu.operation) { } else if (this.operation == OperationEvent.Section.fault.menu.operation) {
return '区故解'; return '区故解';
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
return '计轴复位';
} else { } else {
return ''; return '';
} }
@ -106,6 +108,8 @@ export default {
this.isDisplay = true; this.isDisplay = true;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) { } else if (this.operation == OperationEvent.Section.fault.menu.operation) {
this.isDisplay = false; this.isDisplay = false;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
this.isDisplay = false;
} }
this.sectionName = ''; this.sectionName = '';
this.stationName = ''; this.stationName = '';
@ -146,8 +150,12 @@ export default {
} else if (this.operation == OperationEvent.Section.fault.menu.operation) { } else if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区故解*/ /** 区故解*/
this.faultUnlock(); this.faultUnlock();
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 计轴预复位*/
this.axlePreReset();
} }
}, },
//
faultUnlock() { faultUnlock() {
const operate = { const operate = {
over: true, over: true,
@ -156,6 +164,15 @@ export default {
}; };
this.sendCommand(operate); this.sendCommand(operate);
}, },
//
axlePreReset() {
const operate = {
over: true,
operation: OperationEvent.Section.axlePreReset.menu.operation,
cmdType: CMD.Section.CMD_SECTION_AXIS_PRE_RESET
};
this.sendCommand(operate);
},
// //
split() { split() {
const operate = { const operate = {

View File

@ -395,6 +395,49 @@ export default {
} }
break; break;
} }
case OperationEvent.MixinCommand.functionButton.button.operation : {
if (model && model._type == 'AutoTurnBack' && !model.setting) {
const operate = {
start: true,
over: true,
operation: OperationEvent.Station.guideLock.button.operation,
param:{
cycleCode:model.cycleCode
},
cmdType : CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
}
break;
}
case OperationEvent.MixinCommand.totalCancel.button.operation: {
if (model && model._type == 'AutoTurnBack' && model.setting) {
const operate = {
start: true,
over: true,
operation: OperationEvent.Station.guideLock.button.operation,
param:{
cycleCode:model.cycleCode,
cancelRoute:false
},
cmdType : CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
}
break;
}
} }
} else { } else {
Handler.clear(); Handler.clear();

View File

@ -2,7 +2,6 @@
<div> <div>
<pop-menu ref="popMenu" :menu="menu" /> <pop-menu ref="popMenu" :menu="menu" />
<section-control ref="sectionControl" /> <section-control ref="sectionControl" />
<section-cmd-control ref="sectionCmdControl" />
<speed-limit-control ref="speedLimitControl" /> <speed-limit-control ref="speedLimitControl" />
<speed-cmd-control ref="speedCmdControl" /> <speed-cmd-control ref="speedCmdControl" />
<train-create ref="trainCreate" /> <train-create ref="trainCreate" />
@ -14,7 +13,6 @@
<script> <script>
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
import SectionControl from './dialog/sectionControl'; import SectionControl from './dialog/sectionControl';
import SectionCmdControl from './dialog/sectionCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl'; import SpeedCmdControl from './dialog/speedCmdControl';
import SpeedLimitControl from './dialog/speedLimitControl'; import SpeedLimitControl from './dialog/speedLimitControl';
import TrainCreate from './dialog/trainCreate'; import TrainCreate from './dialog/trainCreate';
@ -32,7 +30,6 @@ export default {
components: { components: {
PopMenu, PopMenu,
SectionControl, SectionControl,
SectionCmdControl,
SpeedLimitControl, SpeedLimitControl,
SpeedCmdControl, SpeedCmdControl,
TrainCreate, TrainCreate,
@ -175,17 +172,18 @@ export default {
switch (buttonOperation) { switch (buttonOperation) {
case OperationEvent.Section.fault.button.operation: { case OperationEvent.Section.fault.button.operation: {
// //
// if (selectType.fault) { if (selectType.fault) {
this.faultUnlock(selectType); this.faultUnlock(selectType);
// } else { } else {
// this.$refs.noticeInfo.doShow({}, `[${selectType.name}(${selectType.code})]`); this.$refs.noticeInfo.doShow({}, `该区段[${selectType.name}(${selectType.code})]没有故障`);
// } }
// break; break;
}
case OperationEvent.Section.axlePreReset.button.operation: {
//
this.axlePreReset(selectType);
break;
} }
// case OperationEvent: {
// //
// break;
// }
} }
}, },
// // // //
@ -222,7 +220,6 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.sectionCmdControl.doShow(operate, this.selected);
this.$refs.sectionControl.doShow(operate, this.selected); this.$refs.sectionControl.doShow(operate, this.selected);
} }
}); });
@ -286,22 +283,40 @@ export default {
}); });
}, },
// //
axlePreReset() { axlePreReset(selectType) {
const operate = { const operate = {
start: true, start: true,
code: this.selected.code, code: this.selected.code,
operation: OperationEvent.Section.axlePreReset.menu.operation, operation: OperationEvent.Section.axlePreReset.menu.operation,
param: { param: {
sectionCode: `${this.selected.code}` sectionCode: selectType.code
} }
}; };
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected); this.$refs.sectionControl.doShow(operate, this.selected);
// this.$refs.sectionCmdControl.doShow(operate, this.selected);
} }
}); });
}, },
//
// axlePreReset() {
// const operate = {
// start: true,
// code: this.selected.code,
// operation: OperationEvent.Section.axlePreReset.menu.operation,
// param: {
// sectionCode: `${this.selected.code}`
// }
// };
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.sectionCmdControl.doShow(operate, this.selected);
// }
// });
// },
// //
setSpeed() { setSpeed() {
const operate = { const operate = {