代码调整
This commit is contained in:
parent
0ccc33e64e
commit
01ef134ad3
@ -87,15 +87,15 @@ export default {
|
||||
mapDevice() {
|
||||
return this.$store.state.map.mapDevice;
|
||||
},
|
||||
mapStationDirectionData() {
|
||||
return this.$store.state.map.mapStationDirectionData;
|
||||
},
|
||||
getDeviceList() {
|
||||
const typeObj = {};
|
||||
this.ConstSelect.operationDeviceList.forEach(ii => {
|
||||
typeObj[ii.value] = ii.label;
|
||||
});
|
||||
const list = [];
|
||||
const autoList = ['ASSIST', 'CHANGE_DIRECTION', 'PICK_ASSIST', 'DEPART_ASSIST']; // 自动闭塞
|
||||
const SemiList = ['OCCLUSION', 'RECOVERY', 'ACCIDENT']; // 半自动闭塞
|
||||
const allList = [...autoList, ...SemiList];
|
||||
Object.values(this.mapDevice).forEach(item => {
|
||||
if (typeObj[item._type]) {
|
||||
list.push({
|
||||
@ -104,22 +104,23 @@ export default {
|
||||
_type: item._type
|
||||
});
|
||||
}
|
||||
if (item._type == 'SignalButton' && allList.includes(item.type)) {
|
||||
let isAuto = true;
|
||||
if (SemiList.includes(item.type)) {
|
||||
isAuto = false;
|
||||
}
|
||||
list.push({
|
||||
code: item.code,
|
||||
name: `${item.name}(${isAuto ? '自动闭塞' : '半自动闭塞'})`,
|
||||
_type: `${isAuto ? 'StationDirectionAuto' : 'StationDirectionSemi'}`
|
||||
});
|
||||
});
|
||||
Object.values(this.mapStationDirectionData).forEach(item => {
|
||||
let isAuto = true;
|
||||
if (item.runModel == 'S') {
|
||||
isAuto = false;
|
||||
}
|
||||
list.push({
|
||||
code: item.code,
|
||||
name: `${item.name}_${item.labelEnum}(${isAuto ? '自动闭塞' : '半自动闭塞'})`,
|
||||
_type: `${isAuto ? 'StationDirectionAuto' : 'StationDirectionSemi'}`
|
||||
});
|
||||
});
|
||||
this.getRouteList.forEach(item => {
|
||||
list.push({
|
||||
code: item.code,
|
||||
name: `${item.name}(进路)`,
|
||||
startSignalCode: item.startSignalCode,
|
||||
_type: 'Route'
|
||||
});
|
||||
});
|
||||
|
@ -32,6 +32,17 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="deviceType == 'Route'" label="初始信号机">
|
||||
<el-select v-model="startSignal" placeholder="请选择值" size="mini">
|
||||
<el-option
|
||||
v-for="option in getSignalList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button :type="field == 'startSignal' ? 'danger' : 'primary'" size="mini" @click="hover('startSignal')">激活</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="showDevice" label="设备" prop="elementCode">
|
||||
<el-select v-model="formModel.elementCode" clearable placeholder="请选择设备" size="mini">
|
||||
<el-option
|
||||
@ -41,7 +52,7 @@
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button :type="field == 'elementCode' ? 'danger' : 'primary'" size="mini" @click="hover('elementCode')">激活</el-button>
|
||||
<el-button v-if="showElementCodeActive" :type="field == 'elementCode' ? 'danger' : 'primary'" size="mini" @click="hover('elementCode')">激活</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="showDevice" label="属性" prop="filedName">
|
||||
<el-select v-model="formModel.filedName" clearable placeholder="请选择设备属性" size="mini" @change="changeFiledName">
|
||||
@ -121,6 +132,7 @@ export default {
|
||||
indexPath: '',
|
||||
field: '',
|
||||
deviceType: '',
|
||||
startSignal: '',
|
||||
formModel: {
|
||||
t: 'E',
|
||||
t1: 'S',
|
||||
@ -153,6 +165,18 @@ export default {
|
||||
list = this.getDeviceList.filter(item => {
|
||||
return item._type == this.deviceType;
|
||||
});
|
||||
if (this.deviceType == 'Route') {
|
||||
list = list.filter(item => {
|
||||
return item.startSignalCode == this.startSignal;
|
||||
});
|
||||
}
|
||||
return list;
|
||||
},
|
||||
getSignalList() { // 信号机列表
|
||||
let list = [];
|
||||
list = this.getDeviceList.filter(item => {
|
||||
return item._type == 'Signal';
|
||||
});
|
||||
return list;
|
||||
},
|
||||
getSectionList() { // 区段列表
|
||||
@ -229,6 +253,14 @@ export default {
|
||||
};
|
||||
return crules;
|
||||
},
|
||||
showElementCodeActive() {
|
||||
let s = true;
|
||||
const arr = ['Route', 'StationDirectionAuto', 'StationDirectionSemi'];
|
||||
if (arr.includes(this.deviceType)) {
|
||||
s = false;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
showDevice() {
|
||||
let s = false;
|
||||
if (this.formModel.t1 == 'S') {
|
||||
@ -263,14 +295,20 @@ export default {
|
||||
let list = this.getDeviceList;
|
||||
if (this.field == 'v') {
|
||||
list = this.getSectionList;
|
||||
} else if (this.field == 'startSignal') {
|
||||
list = this.getSignalList;
|
||||
}
|
||||
const findObj = list.find(item => {
|
||||
return item.code == code;
|
||||
});
|
||||
if (findObj) {
|
||||
this.formModel[this.field] = findObj.code;
|
||||
if (this.field == 'startSignal') {
|
||||
this[this.field] = findObj.code;
|
||||
} else {
|
||||
this.formModel[this.field] = findObj.code;
|
||||
}
|
||||
}
|
||||
if (this.deviceType != this.getDeviceType()) {
|
||||
if (this.field != 'startSignal' && this.deviceType != this.getDeviceType()) {
|
||||
this.deviceType = this.getDeviceType();
|
||||
this.formModel.filedName = '';
|
||||
this.formModel.v = '';
|
||||
@ -372,6 +410,7 @@ export default {
|
||||
}
|
||||
}
|
||||
this.deviceType = this.getDeviceType();
|
||||
this.startSignal = this.getStartSignal();
|
||||
},
|
||||
getDeviceType() {
|
||||
let type = '';
|
||||
@ -383,6 +422,16 @@ export default {
|
||||
}
|
||||
return type;
|
||||
},
|
||||
getStartSignal() {
|
||||
let signal = '';
|
||||
const findObj = this.getDeviceList.find(item => {
|
||||
return item.code == this.formModel.elementCode;
|
||||
});
|
||||
if (findObj) {
|
||||
signal = findObj.startSignalCode || '';
|
||||
}
|
||||
return signal;
|
||||
},
|
||||
clearFromData() {
|
||||
this.$refs.formModel.resetFields();
|
||||
}
|
||||
@ -392,6 +441,7 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.rowConditionList {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
/deep/ .el-form-item__label {
|
||||
line-height: 28px;
|
||||
|
Loading…
Reference in New Issue
Block a user