北京一号线新版指令代码调整

This commit is contained in:
joylink_cuiweidong 2020-03-11 10:52:36 +08:00
parent c0819a4745
commit 4ceaba9c59
3 changed files with 433 additions and 472 deletions

View File

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

View File

@ -77,9 +77,7 @@ export default {
return this.dialogShow ? getDomIdByOperation(this.operation) : ''; return this.dialogShow ? getDomIdByOperation(this.operation) : '';
}, },
title() { title() {
if (this.operation == OperationEvent.Section.lock.menu.operation) { if (this.operation == OperationEvent.Section.split.menu.operation) {
return '区段封锁';
} else if (this.operation == OperationEvent.Section.split.menu.operation) {
this.radio = '2'; this.radio = '2';
return '区段控制'; return '区段控制';
} else if (this.operation == OperationEvent.Section.active.menu.operation) { } else if (this.operation == OperationEvent.Section.active.menu.operation) {
@ -129,10 +127,7 @@ export default {
mouseCancelState(this.selected); mouseCancelState(this.selected);
}, },
commit() { commit() {
if (this.operation == OperationEvent.Section.lock.menu.operation) { if (this.operation == OperationEvent.Section.split.menu.operation) {
/** 区段封锁*/
this.lock();
} else if (this.operation == OperationEvent.Section.split.menu.operation) {
/** 轨道区段切除*/ /** 轨道区段切除*/
this.split(); this.split();
} else if (this.operation == OperationEvent.Section.active.menu.operation) { } else if (this.operation == OperationEvent.Section.active.menu.operation) {
@ -140,16 +135,6 @@ export default {
this.active(); this.active();
} }
}, },
//
lock() {
const operate = {
over:true,
operation: OperationEvent.Section.lock.menu.operation,
cmdType: CMD.Section.CMD_SWITCH_SINGLE_LOCK
};
this.sendCommand(operate);
},
// //
split() { split() {
const operate = { const operate = {
@ -197,7 +182,7 @@ export default {
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate, error.message); this.$refs.noticeInfo.doShow(operate, error.message);
}); });
}, }
} }
}; };
</script> </script>

View File

@ -71,16 +71,6 @@ export default {
handler: this.axlePreReset, handler: this.axlePreReset,
cmdType: CMD.Section.CMD_SECTION_AXIS_PRE_RESET cmdType: CMD.Section.CMD_SECTION_AXIS_PRE_RESET
}, },
{
label: '区段封锁',
handler: this.lock,
cmdType: CMD.Section.CMD_SECTION_BLOCK
},
{
label: '区段解封',
handler: this.unlock,
cmdType: CMD.Section.CMD_SECTION_UNBLOCK
},
{ {
label: '区段设置限速', label: '区段设置限速',
handler: this.setSpeed, handler: this.setSpeed,
@ -307,40 +297,6 @@ export default {
} }
}); });
}, },
//
lock() {
const operate = {
start: true,
code: this.selected.code,
operation: OperationEvent.Section.lock.menu.operation,
param: {
sectionCode: `${this.selected.code}`
}
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
const operate = {
start: true,
code: this.selected.code,
operation: OperationEvent.Section.unlock.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() {
// let operate = { // let operate = {