|
|
@ -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 |
|
|
|