关联关系select添加可清除功能

This commit is contained in:
fan 2019-12-02 14:12:10 +08:00
parent 4da5ce2e52
commit 2a851dc51f
2 changed files with 8 additions and 2 deletions

View File

@ -12,6 +12,7 @@
filterable
:placeholder="item.placeholder"
:disabled="item.disabled"
:clearable="item.clearable"
@change="item.deviceChange"
>
<el-option
@ -28,6 +29,7 @@
filterable
:placeholder="item.placeholder"
:disabled="item.disabled"
:clearable="item.clearable"
>
<el-option
v-for="option in item.options"

View File

@ -383,8 +383,8 @@ export default {
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList},
{ prop: 'leftSection', label: '左关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.PhysicalSectionList},
{ prop: 'rightSection', label: '右关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.PhysicalSectionList},
{ prop: 'leftSection', label: '左关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', clearable: true, options: this.PhysicalSectionList},
{ prop: 'rightSection', label: '右关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', clearable: true, options: this.PhysicalSectionList},
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
@ -458,6 +458,8 @@ export default {
const leftSection = this.$store.getters['map/getDeviceByCode'](value);
if (leftSection && (leftSection.points[1].x !== this.selected.points[0].x || leftSection.points[1].y !== this.selected.points[0].y )) {
callback(new Error('所选择关联区段不相邻!'));
// } else if (this.editModel.type === '03' && !this.editModel.rightSection && !value) {
// callback(new Error(''));
} else {
callback();
}
@ -466,6 +468,8 @@ export default {
const rightSection = this.$store.getters['map/getDeviceByCode'](value);
if (rightSection && (rightSection.points[0].x !== this.selected.points[1].x || rightSection.points[0].y !== this.selected.points[1].y )) {
callback(new Error('所选择关联区段不相邻!'));
// } else if (this.editModel.type === '03' && !this.editModel.leftSection && !value) {
// callback(new Error(''));
} else {
callback();
}