refactor: wait for upload
This commit is contained in:
parent
66a8d0a8b9
commit
46041c3f37
1 changed files with 32 additions and 29 deletions
|
|
@ -1970,7 +1970,7 @@ const emptyCreateDialog = ref(false);
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tapIsUndefined.length > 0) {
|
if (tapIsUndefined.length > 0) {
|
||||||
dialog({
|
return dialog({
|
||||||
color: 'warning',
|
color: 'warning',
|
||||||
icon: 'mdi-alert',
|
icon: 'mdi-alert',
|
||||||
title: t('dialog.title.incompleteDataEntry'),
|
title: t('dialog.title.incompleteDataEntry'),
|
||||||
|
|
@ -1983,30 +1983,30 @@ const emptyCreateDialog = ref(false);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (!customerFormData.customerBranch[idx].id) {
|
||||||
|
await customerFormStore.submitFormCustomer(
|
||||||
|
onCreateImageList,
|
||||||
|
);
|
||||||
|
customerFormState.readonly = true;
|
||||||
|
notify('create', $t('general.success'));
|
||||||
|
// await customerStore.createBranch({
|
||||||
|
// ...customerFormData.customerBranch[idx],
|
||||||
|
// customerId: customerFormState.editCustomerId,
|
||||||
|
// id: undefined,
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
if (!customerFormData.customerBranch[idx].id) {
|
await customerStore.editBranchById(
|
||||||
await customerFormStore.submitFormCustomer(
|
customerFormData.customerBranch[idx].id || '',
|
||||||
onCreateImageList,
|
{
|
||||||
);
|
...customerFormData.customerBranch[idx],
|
||||||
customerFormState.readonly = true;
|
id: undefined,
|
||||||
notify('create', $t('general.success'));
|
},
|
||||||
await fetchListCustomer();
|
);
|
||||||
// await customerStore.createBranch({
|
}
|
||||||
// ...customerFormData.customerBranch[idx],
|
|
||||||
// customerId: customerFormState.editCustomerId,
|
|
||||||
// id: undefined,
|
|
||||||
// });
|
|
||||||
} else {
|
|
||||||
await customerStore.editBranchById(
|
|
||||||
customerFormData.customerBranch[idx].id || '',
|
|
||||||
{
|
|
||||||
...customerFormData.customerBranch[idx],
|
|
||||||
id: undefined,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
customerFormData.customerBranch[idx].file?.forEach(
|
const uploadResult =
|
||||||
|
customerFormData.customerBranch[idx].file?.map(
|
||||||
async (v) => {
|
async (v) => {
|
||||||
if (!v.file) return;
|
if (!v.file) return;
|
||||||
|
|
||||||
|
|
@ -2027,13 +2027,16 @@ const emptyCreateDialog = ref(false);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
) || [];
|
||||||
|
|
||||||
await customerFormStore.assignFormData(
|
for (const r of uploadResult) await r;
|
||||||
customerFormState.editCustomerId,
|
|
||||||
);
|
await customerFormStore.assignFormData(
|
||||||
customerFormStore.resetForm();
|
customerFormState.editCustomerId,
|
||||||
}
|
);
|
||||||
|
|
||||||
|
await fetchListCustomer();
|
||||||
|
customerFormStore.resetForm();
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue