|
|
@ -122,39 +122,43 @@ const [useProvideSmartsheetRowStore, useSmartsheetRowStore] = useInjectionState( |
|
|
|
|
|
|
|
|
|
|
|
// clear LTAR cell
|
|
|
|
// clear LTAR cell
|
|
|
|
const clearLTARCell = async (column: ColumnType) => { |
|
|
|
const clearLTARCell = async (column: ColumnType) => { |
|
|
|
if (!column || column.uidt !== UITypes.LinkToAnotherRecord) return |
|
|
|
try { |
|
|
|
|
|
|
|
if (!column || column.uidt !== UITypes.LinkToAnotherRecord) return |
|
|
|
|
|
|
|
|
|
|
|
const relatedTableMeta = metas.value?.[(<LinkToAnotherRecordType>column?.colOptions)?.fk_related_model_id as string] |
|
|
|
const relatedTableMeta = metas.value?.[(<LinkToAnotherRecordType>column?.colOptions)?.fk_related_model_id as string] |
|
|
|
|
|
|
|
|
|
|
|
if (isNew.value) { |
|
|
|
if (isNew.value) { |
|
|
|
state.value[column.title!] = null |
|
|
|
state.value[column.title!] = null |
|
|
|
} else if (currentRow.value) { |
|
|
|
} else if (currentRow.value) { |
|
|
|
if ((<LinkToAnotherRecordType>column.colOptions)?.type === RelationTypes.BELONGS_TO) { |
|
|
|
if ((<LinkToAnotherRecordType>column.colOptions)?.type === RelationTypes.BELONGS_TO) { |
|
|
|
if (!currentRow.value.row[column.title!]) return |
|
|
|
if (!currentRow.value.row[column.title!]) return |
|
|
|
await $api.dbTableRow.nestedRemove( |
|
|
|
|
|
|
|
NOCO, |
|
|
|
|
|
|
|
project.value.title as string, |
|
|
|
|
|
|
|
meta.value?.title as string, |
|
|
|
|
|
|
|
extractPkFromRow(currentRow.value.row, meta.value?.columns as ColumnType[]), |
|
|
|
|
|
|
|
'bt' as any, |
|
|
|
|
|
|
|
column.title as string, |
|
|
|
|
|
|
|
extractPkFromRow(currentRow.value.row[column.title!], relatedTableMeta?.columns as ColumnType[]), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
currentRow.value.row[column.title!] = null |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
for (const link of (currentRow.value.row[column.title!] as Record<string, any>[]) || []) { |
|
|
|
|
|
|
|
await $api.dbTableRow.nestedRemove( |
|
|
|
await $api.dbTableRow.nestedRemove( |
|
|
|
NOCO, |
|
|
|
NOCO, |
|
|
|
project.value.title as string, |
|
|
|
project.value.title as string, |
|
|
|
meta.value?.title as string, |
|
|
|
meta.value?.title as string, |
|
|
|
extractPkFromRow(currentRow.value.row, meta.value?.columns as ColumnType[]), |
|
|
|
extractPkFromRow(currentRow.value.row, meta.value?.columns as ColumnType[]), |
|
|
|
(<LinkToAnotherRecordType>column?.colOptions).type as 'hm' | 'mm', |
|
|
|
'bt' as any, |
|
|
|
column.title as string, |
|
|
|
column.title as string, |
|
|
|
extractPkFromRow(link, relatedTableMeta?.columns as ColumnType[]), |
|
|
|
extractPkFromRow(currentRow.value.row[column.title!], relatedTableMeta?.columns as ColumnType[]), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
currentRow.value.row[column.title!] = null |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
for (const link of (currentRow.value.row[column.title!] as Record<string, any>[]) || []) { |
|
|
|
|
|
|
|
await $api.dbTableRow.nestedRemove( |
|
|
|
|
|
|
|
NOCO, |
|
|
|
|
|
|
|
project.value.title as string, |
|
|
|
|
|
|
|
meta.value?.title as string, |
|
|
|
|
|
|
|
extractPkFromRow(currentRow.value.row, meta.value?.columns as ColumnType[]), |
|
|
|
|
|
|
|
(<LinkToAnotherRecordType>column?.colOptions).type as 'hm' | 'mm', |
|
|
|
|
|
|
|
column.title as string, |
|
|
|
|
|
|
|
extractPkFromRow(link, relatedTableMeta?.columns as ColumnType[]), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
currentRow.value.row[column.title!] = [] |
|
|
|
currentRow.value.row[column.title!] = [] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (e: any) { |
|
|
|
|
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|