代码调整
This commit is contained in:
parent
0026faedfe
commit
6adcfd9f9b
@ -291,7 +291,9 @@ export default {
|
||||
{ label: '站台', value: 'StationStand' }, // Stand
|
||||
{ label: '车站', value: 'Station' },
|
||||
{label:'进路', value:'Route'},
|
||||
{ label: '列车', value: 'Train' }
|
||||
{ label: '列车', value: 'Train' },
|
||||
{ label: '自动闭塞', value: 'StationDirectionAuto' },
|
||||
{ label: '半自动闭塞', value: 'StationDirectionSemi' }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
@ -47,11 +47,6 @@ export default {
|
||||
ExpressionValue,
|
||||
Expression
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
optionObj: this.optionObj
|
||||
};
|
||||
},
|
||||
props: {
|
||||
materialsList: {
|
||||
type: Array,
|
||||
@ -68,44 +63,7 @@ export default {
|
||||
tableData: [],
|
||||
activeIndexPath: '',
|
||||
rowIndex: 0,
|
||||
conditionKey: '',
|
||||
optionObj: {
|
||||
boolean: [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false }
|
||||
],
|
||||
RunLevel: [
|
||||
{ label: 'cbtc级别', value: 'CBTC' },
|
||||
{ label: '点式通信', value: 'ITC' },
|
||||
{ label: '联锁级', value: 'IL' }
|
||||
],
|
||||
SignalAspect: [
|
||||
{label:'红', value:1},
|
||||
{label:'绿', value:2},
|
||||
{label:'黄', value:3},
|
||||
{label:'黄红', value:4},
|
||||
{label:'绿绿', value:5},
|
||||
{label:'绿黄', value:6},
|
||||
{label:'黄黄', value:7},
|
||||
{label:'黄闪黄', value:8},
|
||||
{label:'白红', value:9},
|
||||
{label:'蓝', value:10},
|
||||
{label:'白', value:11},
|
||||
{label:'红闪', value:12}
|
||||
],
|
||||
SwitchIndication: [// 道岔位置定位、反位 N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
{ label: '定位', value: 'N' },
|
||||
{ label: '反位', value: 'R' },
|
||||
{ label: '失表', value: 'NO' },
|
||||
{ label: '挤叉', value: 'EX' }
|
||||
],
|
||||
DriveMode: [
|
||||
{ label: '自动驾驶模式', value: 'AM' },
|
||||
{ label: '人工驾驶模式', value: 'CM' },
|
||||
{ label: '限制人工驾驶模式', value: 'RM' },
|
||||
{ label: '非限制人工驾驶模式', value: 'NRM' }
|
||||
]
|
||||
}
|
||||
conditionKey: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -135,6 +93,9 @@ export default {
|
||||
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({
|
||||
@ -143,6 +104,17 @@ 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'}`
|
||||
});
|
||||
}
|
||||
});
|
||||
this.getRouteList.forEach(item => {
|
||||
list.push({
|
||||
|
@ -12,7 +12,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div class="rowConditionList">
|
||||
<el-form-item label="值1类型" prop="t1">
|
||||
<!-- <el-form-item label="值1类型" prop="t1">
|
||||
<el-select v-model="formModel.t1" placeholder="请选择条件类型" size="mini">
|
||||
<el-option
|
||||
v-for="option in conditionList1"
|
||||
@ -21,11 +21,21 @@
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item v-if="showDevice" label="设备类型">
|
||||
<el-select v-model="deviceType" clearable placeholder="请选择设备类型" size="mini" @change="changeDeviceType">
|
||||
<el-option
|
||||
v-for="option in ConstSelect.operationDeviceList"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="showDevice" label="值1设备" prop="elementCode">
|
||||
<el-form-item v-if="showDevice" label="设备" prop="elementCode">
|
||||
<el-select v-model="formModel.elementCode" clearable placeholder="请选择设备" size="mini">
|
||||
<el-option
|
||||
v-for="option in getDeviceList"
|
||||
v-for="option in filterDeviceList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
@ -33,7 +43,7 @@
|
||||
</el-select>
|
||||
<el-button :type="field == 'elementCode' ? 'danger' : 'primary'" size="mini" @click="hover('elementCode')">激活</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="showDevice" label="值1属性" prop="filedName">
|
||||
<el-form-item v-if="showDevice" label="属性" prop="filedName">
|
||||
<el-select v-model="formModel.filedName" clearable placeholder="请选择设备属性" size="mini">
|
||||
<el-option
|
||||
v-for="option in getAttributeList"
|
||||
@ -45,7 +55,7 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="rowConditionList">
|
||||
<el-form-item v-if="showConditionList2" label="值2类型" prop="t2">
|
||||
<!-- <el-form-item v-if="showConditionList2" label="值2类型" prop="t2">
|
||||
<el-select v-model="formModel.t2" placeholder="请选择条件类型" size="mini">
|
||||
<el-option
|
||||
v-for="option in conditionList2"
|
||||
@ -54,8 +64,8 @@
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="showValue2" label="值2" prop="v">
|
||||
</el-form-item> -->
|
||||
<el-form-item v-if="showValue2" label="值" prop="v">
|
||||
<el-select v-if="optionObj[valueType]" v-model="formModel.v" placeholder="请选择值" size="mini">
|
||||
<el-option
|
||||
v-for="option in optionValueType"
|
||||
@ -64,7 +74,7 @@
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
<div v-else-if="valueType == 'SECTION'">
|
||||
<div v-else-if="valueType == 'Section'">
|
||||
<el-select v-model="formModel.v" placeholder="请选择值" size="mini">
|
||||
<el-option
|
||||
v-for="option in getSectionList"
|
||||
@ -75,7 +85,7 @@
|
||||
</el-select>
|
||||
<el-button :type="field == 'v' ? 'danger' : 'primary'" size="mini" @click="hover('v')">激活</el-button>
|
||||
</div>
|
||||
<el-input-number v-else-if="valueType=='int'" v-model="formModel.v" size="mini" style="width: 180px" />
|
||||
<el-input-number v-else-if="valueType=='float' || valueType=='int'" v-model="formModel.v" :precision="valueType=='int' ? 0 : 2" size="mini" style="width: 180px" />
|
||||
<el-input v-else v-model="formModel.v" size="mini" style="width: 180px" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
@ -92,7 +102,6 @@ import ConstConfig from '@/scripts/ConstConfig';
|
||||
export default {
|
||||
name: 'Expression',
|
||||
components:{},
|
||||
inject: ['optionObj'],
|
||||
props: {
|
||||
getDeviceList: {
|
||||
type: Array,
|
||||
@ -111,6 +120,7 @@ export default {
|
||||
return {
|
||||
indexPath: '',
|
||||
field: '',
|
||||
deviceType: '',
|
||||
formModel: {
|
||||
t: 'E',
|
||||
t1: 'S',
|
||||
@ -138,15 +148,12 @@ export default {
|
||||
return item.value == 'V';
|
||||
});
|
||||
},
|
||||
deviceType() {
|
||||
let type = '';
|
||||
const findObj = this.getDeviceList.find(item => {
|
||||
return item.code == this.formModel.elementCode;
|
||||
filterDeviceList() {
|
||||
let list = [];
|
||||
list = this.getDeviceList.filter(item => {
|
||||
return item._type == this.deviceType;
|
||||
});
|
||||
if (findObj) {
|
||||
type = findObj._type || '';
|
||||
}
|
||||
return type;
|
||||
return list;
|
||||
},
|
||||
getSectionList() { // 区段列表
|
||||
let list = [];
|
||||
@ -180,6 +187,22 @@ export default {
|
||||
}
|
||||
return attr;
|
||||
},
|
||||
optionObj() {
|
||||
const obj = {
|
||||
boolean: [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false }
|
||||
]
|
||||
};
|
||||
this.materialsList.forEach(item => {
|
||||
item.materials.forEach(every => {
|
||||
if (every.valueList) {
|
||||
obj[every.type] = every.valueList;
|
||||
}
|
||||
});
|
||||
});
|
||||
return obj;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
t: [
|
||||
@ -234,21 +257,35 @@ export default {
|
||||
if (this.field && this.showDevice) {
|
||||
const model = this.$store.state.menuOperation.selected;
|
||||
let code = model.code;
|
||||
if (model._type == 'SignalButton') {
|
||||
if (model._type == 'SignalButton' && model.signalCode) {
|
||||
code = model.signalCode;
|
||||
}
|
||||
const findObj = this.getDeviceList.find(item => {
|
||||
let list = this.getDeviceList;
|
||||
if (this.field == 'v') {
|
||||
list = this.getSectionList;
|
||||
}
|
||||
const findObj = list.find(item => {
|
||||
return item.code == code;
|
||||
});
|
||||
if (findObj) {
|
||||
this.formModel[this.field] = findObj.code;
|
||||
}
|
||||
if (this.deviceType != this.getDeviceType()) {
|
||||
this.deviceType = this.getDeviceType();
|
||||
this.formModel.filedName = '';
|
||||
this.formModel.v = '';
|
||||
}
|
||||
this.field = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
changeDeviceType() {
|
||||
this.formModel.elementCode = '';
|
||||
this.formModel.filedName = '';
|
||||
this.formModel.v = '';
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field == this.field ? '' : field;
|
||||
this.$emit('hover', field);
|
||||
@ -331,6 +368,17 @@ export default {
|
||||
this.formModel.t2 = 'V';
|
||||
}
|
||||
}
|
||||
this.deviceType = this.getDeviceType();
|
||||
},
|
||||
getDeviceType() {
|
||||
let type = '';
|
||||
const findObj = this.getDeviceList.find(item => {
|
||||
return item.code == this.formModel.elementCode;
|
||||
});
|
||||
if (findObj) {
|
||||
type = findObj._type || '';
|
||||
}
|
||||
return type;
|
||||
},
|
||||
clearFromData() {
|
||||
this.$refs.formModel.resetFields();
|
||||
|
@ -45,7 +45,6 @@ import ConstConfig from '@/scripts/ConstConfig';
|
||||
export default {
|
||||
name: 'ExpressionValue',
|
||||
components:{},
|
||||
inject: ['optionObj'],
|
||||
props: {
|
||||
valueObj: {
|
||||
type: Object,
|
||||
@ -91,6 +90,22 @@ export default {
|
||||
return arr.includes(item.value);
|
||||
});
|
||||
},
|
||||
optionObj() {
|
||||
const obj = {
|
||||
boolean: [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false }
|
||||
]
|
||||
};
|
||||
this.materialsList.forEach(item => {
|
||||
item.materials.forEach(every => {
|
||||
if (every.valueList) {
|
||||
obj[every.type] = every.valueList;
|
||||
}
|
||||
});
|
||||
});
|
||||
return obj;
|
||||
},
|
||||
valueTypeList() {
|
||||
let list = [];
|
||||
Object.values(this.optionObj).forEach(item => {
|
||||
@ -106,12 +121,21 @@ export default {
|
||||
let value = obj.valuables[1].v;
|
||||
const type = this.getValueType(obj.valuables[0]);
|
||||
if (type) {
|
||||
const list = this.optionObj[type] || [];
|
||||
const findObj = list.find(item => {
|
||||
return item.value == value;
|
||||
});
|
||||
if (findObj) {
|
||||
value = findObj.label;
|
||||
if (type != 'Section') {
|
||||
const list = this.optionObj[type] || [];
|
||||
const findObj = list.find(item => {
|
||||
return item.value == value;
|
||||
});
|
||||
if (findObj) {
|
||||
value = findObj.label;
|
||||
}
|
||||
} else {
|
||||
const findObj = this.getDeviceList.find(item => {
|
||||
return item.code == value;
|
||||
});
|
||||
if (findObj) {
|
||||
value = findObj.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user