Browse Source

fix: duplicate fields in payload issue

pull/7376/head
Ramesh Mane 12 months ago
parent
commit
e20f0be5cf
  1. 35
      packages/nc-gui/components/smartsheet/details/Fields.vue

35
packages/nc-gui/components/smartsheet/details/Fields.vue

@ -318,7 +318,7 @@ const onFieldUpdate = (state: TableExplorerColumn) => {
return
}
if (field && !moveField) {
if (field || (field && moveField)) {
field.column = state
} else {
ops.value.push({
@ -403,6 +403,19 @@ const onMove = (_event: { moved: { newIndex: number; oldIndex: number } }) => {
return
}
const mop = moveOps.value.find((op) => compareCols(op.column, fields.value[_event.moved.oldIndex]))
if (mop) {
mop.index = _event.moved.newIndex
mop.order = order
} else {
moveOps.value.push({
op: 'move',
column: fields.value[_event.moved.oldIndex],
index: _event.moved.newIndex,
order,
})
}
if (op) {
onFieldUpdate({
...op.column,
@ -420,19 +433,6 @@ const onMove = (_event: { moved: { newIndex: number; oldIndex: number } }) => {
},
})
}
const mop = moveOps.value.find((op) => compareCols(op.column, fields.value[_event.moved.oldIndex]))
if (mop) {
mop.index = _event.moved.newIndex
mop.order = order
} else {
moveOps.value.push({
op: 'move',
column: fields.value[_event.moved.oldIndex],
index: _event.moved.newIndex,
order,
})
}
}
const isColumnValid = (column: TableExplorerColumn) => {
@ -585,6 +585,13 @@ const saveChanges = async () => {
view_id: view.value?.id as string,
}
}
if (op && op.op === 'update') {
op.column.column_order = {
order: mop.order,
view_id: view.value?.id as string,
}
}
}
for (const op of ops.value) {

Loading…
Cancel
Save