Browse Source

fix(gui-v2): pass attachment and LTAR data properly

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3188/head
Pranav C 2 years ago
parent
commit
c1dca10aca
  1. 6
      packages/nc-gui-v2/composables/useSharedFormViewStore.ts

6
packages/nc-gui-v2/composables/useSharedFormViewStore.ts

@ -106,16 +106,17 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
computed(() => ({ localState: formState?.value, virtual: additionalState?.value })), computed(() => ({ localState: formState?.value, virtual: additionalState?.value })),
) )
const submitForm = async (formState: Record<string, any>, additionalState: Record<string, any>) => { const submitForm = async () => {
try { try {
if (!(await v$.value?.$validate())) { if (!(await v$.value?.$validate())) {
return return
} }
progress.value = true progress.value = true
const data = { ...formState, ...additionalState } const data:Record<string,any> = { ...(formState?.value ?? {}), ...(additionalState?.value || {}) }
const attachment: Record<string, any> = {} const attachment: Record<string, any> = {}
for (const col of metas?.value?.[sharedFormView?.value?.fk_model_id as string]?.columns ?? []) { for (const col of metas?.value?.[sharedFormView?.value?.fk_model_id as string]?.columns ?? []) {
if (col.uidt === UITypes.Attachment) { if (col.uidt === UITypes.Attachment) {
attachment[`_${col.title}`] = data[col.title!] attachment[`_${col.title}`] = data[col.title!]
@ -142,7 +143,6 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
await message.success(sharedFormView.value?.success_msg || 'Saved successfully.') await message.success(sharedFormView.value?.success_msg || 'Saved successfully.')
} catch (e: any) { } catch (e: any) {
console.log(e) console.log(e)
throw e
await message.error(await extractSdkResponseErrorMsg(e)) await message.error(await extractSdkResponseErrorMsg(e))
} }
progress.value = false progress.value = false

Loading…
Cancel
Save