Skip to content

Commit

Permalink
refactor: optimize sourceSortColumn logic in ConditionBox.vue TAP-5650
Browse files Browse the repository at this point in the history
(cherry picked from commit 6226519)
  • Loading branch information
cn-xufei committed Jan 23, 2025
1 parent 3613781 commit 9bce39f
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1461,19 +1461,27 @@ export default {
let sourceSortColumn = updateList.length
? updateList.join(',')
: this.getPrimaryKeyFieldStr(findTable.fields)
if (updateList.length && findTargetTable?.fields) {
sourceSortColumn = findTargetTable.fields
.filter(t => updateList.includes(t.field_name))
.map(t => t.original_field_name)
if (updateList.length && findTargetTable?.fields?.length) {
const fieldMap = findTargetTable?.fields?.reduce((acc, t) => {
acc[t.field_name] = t.original_field_name
return acc
}, {})
sourceSortColumn = updateList
.reduce((acc, t) => {
fieldMap[t] && acc.push(fieldMap[t])
return acc
}, [])
.join(',')
}
item.source.fields = findTable.fields.map(t => {
t.isPrimaryKey = t.primary_key_position > 0
return t
})
item.source.sortColumn = sourceSortColumn
const key = [source || '', sourceConnectionId, item.source.table].join()
this.fieldsMap[key] = item.source.fields
}
Expand Down

0 comments on commit 9bce39f

Please sign in to comment.