diff --git a/src/components/customField/AddForm.vue b/src/components/customField/AddForm.vue index ac571380..6f112330 100644 --- a/src/components/customField/AddForm.vue +++ b/src/components/customField/AddForm.vue @@ -90,7 +90,8 @@ :placeholder="$t('pleaseSelect')+item.dbFieldTxt" :type="'select'" :triggerChange="false" - :dictCode="item.dictField" /> + :options="optionsData[item.dbFieldName]" + :dictCode="item.fieldHref ? null : item.dictField" /> + :options="optionsData[item.dbFieldName]" + :dictCode="item.fieldHref ? null : item.dictField"/> acc.concat(cur), []) formList.forEach(item => { - if (item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value) { - // 展示类型是树选择,且有接口的 - if (item.fieldHref) { - getAction(item.fieldHref).then(res => { - if (res.success) { - this.$set(this.optionsData, item.dbFieldName, res.result) - } - }) - } else if (item.dictId) { - getFormDictTreeList({ dictId: item.dictId }).then(res => { - if (res.success) { - this.$set(this.optionsData, item.dbFieldName, res.result) - } - }) - } + // 如果接口这个字段有值 + if (item.fieldHref) { + getAction(item.fieldHref).then(res => { + if (res.success) { + this.$set(this.optionsData, item.dbFieldName, res.result) + } + }) + } else if ((item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value) && item.dictId) { + getFormDictTreeList({ dictId: item.dictId }).then(res => { + if (res.success) { + this.$set(this.optionsData, item.dbFieldName, res.result) + } + }) } }) }, @@ -674,7 +674,7 @@ export default { filterTreeOption (input, option) { const text = option.componentOptions.propsData.title || option.componentOptions.propsData.label return text.toLowerCase().indexOf(input.toLowerCase()) >= 0 - }, + } } }