feat:http数据集完善输出字段配置

main
liu.shiyi 2 years ago
parent 442e505982
commit a63727057c

@ -979,6 +979,8 @@ export default {
this.replaceParams(this.dataForm.config.paramsList)
axiosFormatting({ ...this.newDataForm.config }).then((res) => {
this.dataPreviewList = res.data.list
//
this.updateOoutputFieldList(this.dataPreviewList)
console.log(res)
})
} else {
@ -991,6 +993,8 @@ export default {
}
datasetExecuteTest(executeParams).then(res => {
this.dataPreviewList = res.data.data.list
//
this.updateOoutputFieldList(this.dataPreviewList)
this.$message.success('解析并执行成功')
}).catch((e) => {
@ -998,6 +1002,46 @@ export default {
}
}
},
updateOoutputFieldList (dataList) {
if (dataList && dataList.length) {
const newList = Object.keys(dataList?.[0])?.map(key => {
return {
fieldName: key,
fieldDesc: ''
}
})
this.outputFieldList = this.compareArr(newList, this.outputFieldList)
} else {
this.outputFieldList = []
}
},
//
compareArr (newList, oldList) {
//
const result = []
// A
for (const objA of newList) {
let found = false // B
// B
for (const objB of oldList) {
if (objA.fieldName === objB.fieldName) {
// ABfieldNameBA
objA.fieldDesc = objB.fieldDesc
result.push(objA)
found = true
break
}
}
// B
if (!found) {
result.push(objA)
}
}
return result
},
//
clearType () {
this.typeName = ''

Loading…
Cancel
Save