refactor: create customer
This commit is contained in:
parent
9008bb54da
commit
2ab96dc816
1 changed files with 20 additions and 8 deletions
|
|
@ -86,7 +86,7 @@ const ocrStore = useOcrStore();
|
|||
|
||||
const tabFieldRequired = ref<{ [key: string]: (keyof CustomerBranchCreate)[] }>(
|
||||
{
|
||||
main: ['citizenId', 'legalPersonNo', 'registerName'],
|
||||
main: [],
|
||||
address: ['address', 'addressEN', 'provinceId', 'districtId'],
|
||||
business: [],
|
||||
contact: ['contactName', 'telephoneNo'],
|
||||
|
|
@ -1950,20 +1950,31 @@ const emptyCreateDialog = ref(false);
|
|||
@submit.prevent="
|
||||
async () => {
|
||||
if (!customerFormData.customerBranch) return;
|
||||
if (!customerFormState.editCustomerId) return;
|
||||
|
||||
if (customerFormData.customerType === 'PERS') {
|
||||
tabFieldRequired.main = [
|
||||
'citizenId',
|
||||
'namePrefix',
|
||||
'firstName',
|
||||
'firstNameEN',
|
||||
'lastName',
|
||||
'lastNameEN',
|
||||
'gender',
|
||||
'birthDate',
|
||||
];
|
||||
}
|
||||
if (customerFormData.customerType === 'CORP') {
|
||||
tabFieldRequired.main = [
|
||||
'legalPersonNo',
|
||||
'registerName',
|
||||
'address',
|
||||
'addressEN',
|
||||
'registerNameEN',
|
||||
'registerDate',
|
||||
'authorizedCapital',
|
||||
'authorizedName',
|
||||
'authorizedNameEN',
|
||||
'customerName',
|
||||
];
|
||||
}
|
||||
if (customerFormData.customerType === 'PERS') {
|
||||
tabFieldRequired.main = ['citizenId'];
|
||||
}
|
||||
|
||||
let tapIsUndefined = validateTabField(
|
||||
customerFormData.customerBranch?.[idx],
|
||||
tabFieldRequired,
|
||||
|
|
@ -1996,6 +2007,7 @@ const emptyCreateDialog = ref(false);
|
|||
// id: undefined,
|
||||
// });
|
||||
} else {
|
||||
if (!customerFormState.editCustomerId) return;
|
||||
await customerStore.editBranchById(
|
||||
customerFormData.customerBranch[idx].id || '',
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue