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

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,7 +1,16 @@
<template>
<div>
<el-dialog class="beijing-01__systerm section-cmd-control" :title="title" :visible.sync="show" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<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">
@ -9,41 +18,49 @@
<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-option>
<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-input>
<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-input>
<el-input v-model="sectionName" size="small" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<el-table class="table" ref="tempData" :data="tempData" border style="width: 100%" size="mini"
highlight-current-row height="200">
<el-table-column prop="order" :width="50" label="序号">
</el-table-column>
<el-table-column prop="date" :width="160" label="时间">
</el-table-column>
<el-table-column prop="context" :width="180" label="执行过程">
</el-table-column>
<el-table-column prop="result" label="执行结果">
</el-table-column>
<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>
<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>
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
@ -51,7 +68,8 @@
</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>
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>
@ -64,11 +82,11 @@
</div>
</template>
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import { now } from '@/utils/date';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import { now } from '@/utils/date';
export default {
export default {
name: 'SectionCmdControl',
data() {
return {
@ -87,89 +105,97 @@
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: '区段计轴预复位' },
]
{ 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.unlock.menu.operation) {
/** 区段解封*/
return OperationEvent.Section.unlock.order.domId;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
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.unlock.menu.operation) {
/** 区段解封*/
return OperationEvent.Section.unlock.confirm1.domId;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
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.unlock.menu.operation) {
/** 区段解封*/
return OperationEvent.Section.unlock.confirm2.domId;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
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.unlock.menu.operation) {
/** 区段解封*/
return OperationEvent.Section.unlock.stop.domId;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
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.unlock.menu.operation) {
return '区段解封';
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
return '区段故障解锁';
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
return '区段计轴预复位';
} else {
return '';
}
} else {
return '';
}
}
},
@ -179,7 +205,7 @@
this.stpDisabled = true;
val.forEach((elem, index) => {
// 1
if (elem == false && 1 <= index && index <= 2) {
if (elem == false && index >= 1 && index <= 2) {
this.stpDisabled = false;
}
});
@ -190,7 +216,7 @@
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
});
this.timer = setInterval(() => {
if (!this.$store.state.menuOperation.break) {
if (this.timeCountCommand > 0) {
@ -206,7 +232,7 @@
this.timeCountConfirm = -1;
}
}
}, 1000)
}, 1000);
},
beforeDestroy() {
clearInterval(this.timer);
@ -220,14 +246,14 @@
this.stationName = '';
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (selected.type === '02') {
let section = this.$store.getters['map/getDeviceByCode'](selected.parentCode);
const section = this.$store.getters['map/getDeviceByCode'](selected.parentCode);
if (section) {
this.sectionName += section.name
this.sectionName += section.name;
}
}
this.sectionName += selected.name
this.sectionName += selected.name;
let station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
@ -267,19 +293,19 @@
commandHasPopUp() {
},
commandNoPopUp() {
let operate = {
const operate = {
type: MapDeviceType.Section.type
}
};
if (this.operation == OperationEvent.Section.unlock.menu.operation) {
/** 区段解封*/
operate.operation = OperationEvent.Section.unlock.order.operation
operate.operation = OperationEvent.Section.unlock.order.operation;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.order.operation
operate.operation = OperationEvent.Section.fault.order.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
operate.operation = OperationEvent.Section.axlePreReset.order.operation
operate.operation = OperationEvent.Section.axlePreReset.order.operation;
}
this.setMessage('请点击“确认1”按钮确认命令');
@ -294,17 +320,14 @@
}
}).catch(() => {
this.editRecord({ order: this.order, date: now(), context: '点击下达命令', result: '执行异常' });
})
});
},
confirm1() {
let operate = {
type: MapDeviceType.Section.type,
}
const 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) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.confirm1.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
@ -326,18 +349,15 @@
}
}).catch(() => {
this.editRecord({ order: this.order, date: now(), context: '点击确认1', result: '执行异常' });
})
});
},
confirm2() {
let operate = {
const 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) {
if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.confirm2.operation;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
@ -361,12 +381,12 @@
this.timeCountConfirm = -1;
this.setButtonEnable({ step: -1 });
this.editRecord({ order: this.order, date: now(), context: '点击确认2', result: '执行异常' });
})
});
},
stop() {
let operate = {
type: MapDeviceType.Section.type,
}
const operate = {
type: MapDeviceType.Section.type
};
if (this.operation == OperationEvent.Section.unlock.menu.operation) {
/** 区段解封*/
@ -388,21 +408,21 @@
} else {
this.editRecord({ order: this.order, date: now(), context: '点击终止', result: '执行失败' });
}
}).catch(error => {
}).catch(() => {
this.editRecord({ order: this.order, date: now(), context: '点击终止', result: '执行异常' });
})
});
},
close() {
let operate = {
const operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.close.menu.operation,
}
operation: OperationEvent.Command.close.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => {
}).catch(() => {
this.doClose();
});
},
@ -428,8 +448,8 @@
elem[prop] = param[prop];
}
}
})
}
});
}
}
};
</script>

View File

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

View File

@ -71,16 +71,6 @@ export default {
handler: this.axlePreReset,
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: '区段设置限速',
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() {
// let operate = {