diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index 19b5146..f359cbb 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -129,6 +129,8 @@ export default { setParentsId: null, result: null, autoMatic: null, + autoEditString: [], + isAutoLastString: null, normalizer(node) { if (node.childMenus == null || node.childMenus === 'null') { delete node.childMenus @@ -216,7 +218,20 @@ export default { } this.formPreviewData.map(item => { if (item.isAutomatic) { - this.$set(this.addOrUpdateForm, item.fieldName, string) + this.autoEditString = [] + this.autoEditString.push(this.addOrUpdateForm[item.fieldName]) + console.log('autoEditString', this.autoEditString) + console.log(this.autoEditString[0].lastIndexOf('-')) + this.isAutoLastString = this.autoEditString[0].substring(this.autoEditString[0].lastIndexOf('-') + 1) + console.log('autoEditString', this.isAutoLastString) + let lastString + if (this.isAutoLastString) { + lastString = string + this.isAutoLastString + } else { + lastString = string + } + + this.$set(this.addOrUpdateForm, item.fieldName, lastString) } }) }) @@ -225,7 +240,7 @@ export default { FetchNoFormatField() { getNoFormatField({ categoryId: this.selectedCategory.id }).then(res => { this.autoMatic = res - this.handleAuto() + // this.handleAuto() }) }, // 获取对应字典子集数据 @@ -260,8 +275,12 @@ export default { } this.handlerIsRepeat(params, item) } + if (!item.isAutomatic) { - this.handleAuto() + const index = this.autoMatic.findIndex(i => item.fieldName === i.fieldName) + if (index !== -1) { + this.handleAuto() + } } }, // tree - open @@ -284,7 +303,10 @@ export default { } this.handlerIsRepeat(params, this.treeCurrentFiled) } - this.handleAuto() + const index = this.autoMatic.findIndex(i => this.treeCurrentFiled.fieldName === i.fieldName) + if (index !== -1) { + this.handleAuto() + } }, // popover - table 单选 clickRowHandler(row) { @@ -298,7 +320,11 @@ export default { } this.$refs.popoverTable.clearSelection() this.popoverVisible = false - this.handleAuto() + + const index = this.autoMatic.findIndex(i => this.currentFieldName === i.fieldName) + if (index !== -1) { + this.handleAuto() + } }, // popover - 当前选中得 handleCurrentFieldName(item) { @@ -384,7 +410,7 @@ export default { 'parentsId': this.setParentsId, 'jsonString': JSON.stringify(this.addOrUpdateForm) } - // console.log(this.addOrUpdateForm) + console.log(this.addOrUpdateForm) edit(params).then(res => { if (res) { this.$message.success(res)