Browse Source

处理vue-treeSelect回显出现unknown问题

master
xuhuajiao 3 years ago
parent
commit
0d2b8d7645
  1. 15
      src/views/components/category/PreviewForm.vue

15
src/views/components/category/PreviewForm.vue

@ -19,7 +19,9 @@
no-options-text="无数据" no-options-text="无数据"
@select="selectTree" @select="selectTree"
@open="openTree(item)" @open="openTree(item)"
/>
>
<div slot="value-label" slot-scope="{ node }">{{ getAutoNameUnknown(node.label) }}</div>
</treeselect>
<!-- text / number / textarea / popover --> <!-- text / number / textarea / popover -->
<!-- :validate-event="isDisabled" --> <!-- :validate-event="isDisabled" -->
<el-input <el-input
@ -170,6 +172,15 @@ export default {
// } // }
// } // }
// }, // },
// vue-treeSelectunknown
getAutoNameUnknown(name) {
if (name.lastIndexOf('unknown') > -1) {
// treeselectnameidid
return name.split('(')[0]
} else {
return name
}
},
getNode(list, dicName) { getNode(list, dicName) {
let data; let data;
(list || []).map(item => { (list || []).map(item => {
@ -196,7 +207,7 @@ export default {
await FetchFindAllSubsetById({ id: fieldInfo.dictionaryConfigId.id }).then(res => { await FetchFindAllSubsetById({ id: fieldInfo.dictionaryConfigId.id }).then(res => {
const option = this.getNode(res, this.addOrUpdateForm[val.fieldName]) const option = this.getNode(res, this.addOrUpdateForm[val.fieldName])
if (option) { if (option) {
string += '' + option[0].dicCode + val.connector
string += '' + option[0].dicName + val.connector
} }
}) })
} else { } else {

Loading…
Cancel
Save