fix: 修复原始数据集,选择输出字段后,字段描述消失的情况

main
wu.jian2 2 years ago
parent 5fde1a80c7
commit 9cdfa3c46f

@ -561,7 +561,9 @@ export default {
isSelectAll: false, isSelectAll: false,
activeName: 'data', activeName: 'data',
currentCount: 0, currentCount: 0,
selectorLoading: false selectorLoading: false,
oldStructurePreviewList: [],
isInit: false
} }
}, },
watch: { watch: {
@ -630,6 +632,7 @@ export default {
this.dataForm.repeatStatus = res.config.repeatStatus this.dataForm.repeatStatus = res.config.repeatStatus
this.dataForm.fieldList = res.config.fieldList this.dataForm.fieldList = res.config.fieldList
this.dataForm.fieldDesc = res.config.fieldDesc this.dataForm.fieldDesc = res.config.fieldDesc
this.oldStructurePreviewList = _.cloneDeep(res.config.fieldList)
// //
this.dataForm.fieldInfo = res.config.fieldInfo ? res.config.fieldInfo.split(',') : [] this.dataForm.fieldInfo = res.config.fieldInfo ? res.config.fieldInfo.split(',') : []
if (this.dataForm.typeId) { if (this.dataForm.typeId) {
@ -641,6 +644,7 @@ export default {
} }
}) })
} }
this.isInit = true
this.queryAllTable() this.queryAllTable()
this.queryAllField() this.queryAllField()
}) })
@ -824,7 +828,7 @@ export default {
} }
return field return field
}) })
this.getPreViewData(fieldDescMap) // this.getPreViewData(fieldDescMap)
}).catch(() => { }).catch(() => {
this.fieldList = [] this.fieldList = []
}) })
@ -835,7 +839,6 @@ export default {
*/ */
setFields (values) { setFields (values) {
if (values.includes('全选')) { if (values.includes('全选')) {
//
if (values.length > this.fieldList.length) { if (values.length > this.fieldList.length) {
this.dataForm.fieldInfo = [] this.dataForm.fieldInfo = []
} else { } else {
@ -882,21 +885,35 @@ export default {
datasetExecuteTest(executeParams).then((data) => { datasetExecuteTest(executeParams).then((data) => {
this.dataPreviewList = data.data.list this.dataPreviewList = data.data.list
this.structurePreviewList = data.structure this.structurePreviewList = data.structure
this.structurePreviewList.forEach(item => { //
if (!item.hasOwnProperty('orderNum')) { if (this.isInit) {
this.$set(item, 'orderNum', 0) this.structurePreviewList = this.dataForm.fieldList
} this.isInit = false
if (!item.hasOwnProperty('sourceTable')) { } else {
this.$set(item, 'sourceTable', this.dataForm.tableName) this.structurePreviewList.forEach(item => {
} if (!item.hasOwnProperty('orderNum')) {
if (!item.hasOwnProperty('fieldDesc')) { this.$set(item, 'orderNum', 0)
let fieldDesc = ''
if (fieldDescMap && fieldDescMap[item.fieldName]) {
fieldDesc = fieldDescMap[item.fieldName]
} }
this.$set(item, 'fieldDesc', fieldDesc) if (!item.hasOwnProperty('sourceTable')) {
} this.$set(item, 'sourceTable', this.dataForm.tableName)
}) }
if (!item.hasOwnProperty('fieldDesc')) {
let fieldDesc = ''
if (fieldDescMap && fieldDescMap[item.fieldName]) {
fieldDesc = fieldDescMap[item.fieldName]
}
this.$set(item, 'fieldDesc', fieldDesc)
// this.structurePreviewList this.oldStructurePreviewList fieldDesc
this.structurePreviewList.forEach(item => {
const oldItem = this.oldStructurePreviewList.find(oldItem => oldItem.fieldName === item.fieldName)
if (oldItem && oldItem.fieldDesc) {
item.fieldDesc = oldItem.fieldDesc
}
})
}
})
}
this.structurePreviewListCopy = _.cloneDeep(this.structurePreviewList) this.structurePreviewListCopy = _.cloneDeep(this.structurePreviewList)
this.totalCount = data.data.totalCount this.totalCount = data.data.totalCount
this.currentCount = data.data.currentCount this.currentCount = data.data.currentCount
@ -927,6 +944,11 @@ export default {
treeFilter (value, data) { treeFilter (value, data) {
if (!value) return true if (!value) return true
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
},
setField () {
this.structurePreviewList = _.cloneDeep(this.structurePreviewListCopy)
this.oldStructurePreviewList = _.cloneDeep(this.structurePreviewListCopy)
this.fieldsetVisible = false
} }
} }
} }

Loading…
Cancel
Save