refactor: edit map data

This commit is contained in:
Net 2024-08-27 12:55:11 +07:00 committed by Methapon Metanipat
parent 6882f95122
commit f875d11b4f

View file

@ -127,7 +127,8 @@ export const useCustomerForm = defineStore('form-customer', () => {
resetFormData.birthDate = new Date(data.birthDate); resetFormData.birthDate = new Date(data.birthDate);
resetFormData.image = null; resetFormData.image = null;
resetFormData.customerBranch = data.branch.map((v) => ({ resetFormData.customerBranch = await Promise.all(
data.branch.map(async (v) => ({
id: v.id, id: v.id,
code: v.code || '', code: v.code || '',
customerCode: '', customerCode: '',
@ -160,8 +161,18 @@ export const useCustomerForm = defineStore('form-customer', () => {
registerCompanyName: '', registerCompanyName: '',
statusSave: true, statusSave: true,
contactName: v.contactName || '', contactName: v.contactName || '',
file: undefined, file: await customerStore.listAttachment(v.id).then(async (r) => {
})); if (r) {
return await Promise.all(
r.map(async (item) => ({
url: await customerStore.getAttachment(v.id, item),
})),
);
}
return [];
}),
})),
);
currentFormData.value = structuredClone(resetFormData); currentFormData.value = structuredClone(resetFormData);
} }