refactor: edit map data
This commit is contained in:
parent
6882f95122
commit
f875d11b4f
1 changed files with 46 additions and 35 deletions
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue