refactor: edit map data
This commit is contained in:
parent
6882f95122
commit
f875d11b4f
1 changed files with 46 additions and 35 deletions
|
|
@ -127,41 +127,52 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
resetFormData.birthDate = new Date(data.birthDate);
|
||||
resetFormData.image = null;
|
||||
|
||||
resetFormData.customerBranch = data.branch.map((v) => ({
|
||||
id: v.id,
|
||||
code: v.code || '',
|
||||
customerCode: '',
|
||||
provinceId: v.provinceId,
|
||||
districtId: v.districtId,
|
||||
subDistrictId: v.subDistrictId,
|
||||
wageRate: v.wageRate,
|
||||
payDate: new Date(v.payDate), // Convert the string to a Date object
|
||||
saleEmployee: v.saleEmployee,
|
||||
jobDescription: v.jobDescription,
|
||||
jobPositionEN: v.jobPositionEN,
|
||||
jobPosition: v.jobPosition,
|
||||
businessTypeEN: v.businessTypeEN,
|
||||
businessType: v.businessType,
|
||||
employmentOffice: v.employmentOffice,
|
||||
telephoneNo: v.telephoneNo,
|
||||
email: v.email,
|
||||
addressEN: v.addressEN,
|
||||
address: v.address,
|
||||
workplaceEN: v.workplaceEN,
|
||||
workplace: v.workplace,
|
||||
status: v.status,
|
||||
customerId: v.customerId,
|
||||
citizenId: v.citizenId || '',
|
||||
authorizedCapital: v.authorizedCapital || '',
|
||||
registerDate: new Date(v.registerDate), // Convert the string to a Date object
|
||||
registerNameEN: v.registerNameEN || '',
|
||||
registerName: v.registerName || '',
|
||||
legalPersonNo: v.legalPersonNo || '',
|
||||
registerCompanyName: '',
|
||||
statusSave: true,
|
||||
contactName: v.contactName || '',
|
||||
file: undefined,
|
||||
}));
|
||||
resetFormData.customerBranch = await Promise.all(
|
||||
data.branch.map(async (v) => ({
|
||||
id: v.id,
|
||||
code: v.code || '',
|
||||
customerCode: '',
|
||||
provinceId: v.provinceId,
|
||||
districtId: v.districtId,
|
||||
subDistrictId: v.subDistrictId,
|
||||
wageRate: v.wageRate,
|
||||
payDate: new Date(v.payDate), // Convert the string to a Date object
|
||||
saleEmployee: v.saleEmployee,
|
||||
jobDescription: v.jobDescription,
|
||||
jobPositionEN: v.jobPositionEN,
|
||||
jobPosition: v.jobPosition,
|
||||
businessTypeEN: v.businessTypeEN,
|
||||
businessType: v.businessType,
|
||||
employmentOffice: v.employmentOffice,
|
||||
telephoneNo: v.telephoneNo,
|
||||
email: v.email,
|
||||
addressEN: v.addressEN,
|
||||
address: v.address,
|
||||
workplaceEN: v.workplaceEN,
|
||||
workplace: v.workplace,
|
||||
status: v.status,
|
||||
customerId: v.customerId,
|
||||
citizenId: v.citizenId || '',
|
||||
authorizedCapital: v.authorizedCapital || '',
|
||||
registerDate: new Date(v.registerDate), // Convert the string to a Date object
|
||||
registerNameEN: v.registerNameEN || '',
|
||||
registerName: v.registerName || '',
|
||||
legalPersonNo: v.legalPersonNo || '',
|
||||
registerCompanyName: '',
|
||||
statusSave: true,
|
||||
contactName: v.contactName || '',
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue