Browse Source

自动生成bug-01

master
xuhuajiao 3 years ago
parent
commit
04aadca687
  1. 38
      src/views/components/category/PreviewForm.vue

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

@ -129,6 +129,8 @@ export default {
setParentsId: null, setParentsId: null,
result: null, result: null,
autoMatic: null, autoMatic: null,
autoEditString: [],
isAutoLastString: null,
normalizer(node) { normalizer(node) {
if (node.childMenus == null || node.childMenus === 'null') { if (node.childMenus == null || node.childMenus === 'null') {
delete node.childMenus delete node.childMenus
@ -216,7 +218,20 @@ export default {
} }
this.formPreviewData.map(item => { this.formPreviewData.map(item => {
if (item.isAutomatic) { 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() { FetchNoFormatField() {
getNoFormatField({ categoryId: this.selectedCategory.id }).then(res => { getNoFormatField({ categoryId: this.selectedCategory.id }).then(res => {
this.autoMatic = res this.autoMatic = res
this.handleAuto()
// this.handleAuto()
}) })
}, },
// //
@ -260,8 +275,12 @@ export default {
} }
this.handlerIsRepeat(params, item) this.handlerIsRepeat(params, item)
} }
if (!item.isAutomatic) { if (!item.isAutomatic) {
this.handleAuto()
const index = this.autoMatic.findIndex(i => item.fieldName === i.fieldName)
if (index !== -1) {
this.handleAuto()
}
} }
}, },
// tree - open // tree - open
@ -284,7 +303,10 @@ export default {
} }
this.handlerIsRepeat(params, this.treeCurrentFiled) 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 // popover - table
clickRowHandler(row) { clickRowHandler(row) {
@ -298,7 +320,11 @@ export default {
} }
this.$refs.popoverTable.clearSelection() this.$refs.popoverTable.clearSelection()
this.popoverVisible = false this.popoverVisible = false
this.handleAuto()
const index = this.autoMatic.findIndex(i => this.currentFieldName === i.fieldName)
if (index !== -1) {
this.handleAuto()
}
}, },
// popover - // popover -
handleCurrentFieldName(item) { handleCurrentFieldName(item) {
@ -384,7 +410,7 @@ export default {
'parentsId': this.setParentsId, 'parentsId': this.setParentsId,
'jsonString': JSON.stringify(this.addOrUpdateForm) 'jsonString': JSON.stringify(this.addOrUpdateForm)
} }
// console.log(this.addOrUpdateForm)
console.log(this.addOrUpdateForm)
edit(params).then(res => { edit(params).then(res => {
if (res) { if (res) {
this.$message.success(res) this.$message.success(res)

Loading…
Cancel
Save