diff --git a/src/views/category/descriptionPreview/index.vue b/src/views/category/descriptionPreview/index.vue index 821d49c..673b7c0 100644 --- a/src/views/category/descriptionPreview/index.vue +++ b/src/views/category/descriptionPreview/index.vue @@ -160,6 +160,7 @@ export default { // 清空数组数据 this.allFieldsData.splice(0, this.allFieldsData.length) this.getArchivesType(true) + this.thisFields = this.editField }) }) return false diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index d600659..0f65df6 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -158,14 +158,34 @@ export default { this.FetchNoFormatField() }, methods: { + // 递归查询字典名称对应的字典代码 + getNode(tree, dicName) { + for (let i = 0; i < tree.length; i++) { + if (tree[i].dicName === dicName) { + return tree[i] + } else if (tree[i].childMenus) { + return this.getNode(tree[i].childMenus, dicName) + } + } + }, // 自动生成 handleAuto() { let string = '' - this.autoMatic.forEach(val => { + this.autoMatic.forEach(async val => { if (!this.addOrUpdateForm[val.fieldName]) { string += '' } else { - string += '' + this.addOrUpdateForm[val.fieldName] + val.connector + const fieldInfo = this.formPreviewData.find(element => element.fieldName === val.fieldName) + if (fieldInfo.isInputClass === 'select' || fieldInfo.isInputClass === 'popover') { + await FetchFindAllSubsetById({ id: fieldInfo.dictionaryConfigId.id }).then(res => { + const option = this.getNode(res, this.addOrUpdateForm[val.fieldName]) + if (option) { + string += '' + option.dicCode + val.connector + } + }) + } else { + string += '' + this.addOrUpdateForm[val.fieldName] + val.connector + } } this.formPreviewData.map(item => { if (item.isAutomatic) { @@ -226,7 +246,7 @@ export default { // tree - select selectTree(val) { this.addOrUpdateForm[this.treeCurrentFiled.fieldName] = val.dicName - this.treeName = val.dicName + // this.treeName = val.dicName // 自动重复字段 - 是否重复 - treeSelect方式 if (this.treeCurrentFiled.isRepeat) { const params = { @@ -358,7 +378,6 @@ export default { } } -// addOrUpdateForm[item.fieldName] = item.isDefaultValue