refactor: add function putAttachment

This commit is contained in:
Net 2024-08-29 14:57:49 +07:00
parent 5e7451010d
commit 47bd4637d8

View file

@ -1865,6 +1865,29 @@ const emptyCreateDialog = ref(false);
);
}
customerFormData.customerBranch[idx].file?.forEach(
async (v) => {
if (!v.file) return;
const ext = v.file.name.split('.').at(-1);
let filename = v.group + '-' + new Date().getTime();
if (ext) filename += `.${ext}`;
const res = await customerStore.putAttachment({
branchId:
customerFormData.customerBranch?.[idx].id || '',
file: v.file,
filename,
});
if (res) {
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
}
},
);
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);