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)[] }>(
|
const tabFieldRequired = ref<{ [key: string]: (keyof CustomerBranchCreate)[] }>(
|
||||||
{
|
{
|
||||||
main: ['citizenId', 'legalPersonNo', 'registerName'],
|
main: [],
|
||||||
address: ['address', 'addressEN', 'provinceId', 'districtId'],
|
address: ['address', 'addressEN', 'provinceId', 'districtId'],
|
||||||
business: [],
|
business: [],
|
||||||
contact: ['contactName', 'telephoneNo'],
|
contact: ['contactName', 'telephoneNo'],
|
||||||
|
|
@ -1950,20 +1950,31 @@ const emptyCreateDialog = ref(false);
|
||||||
@submit.prevent="
|
@submit.prevent="
|
||||||
async () => {
|
async () => {
|
||||||
if (!customerFormData.customerBranch) return;
|
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') {
|
if (customerFormData.customerType === 'CORP') {
|
||||||
tabFieldRequired.main = [
|
tabFieldRequired.main = [
|
||||||
'legalPersonNo',
|
'legalPersonNo',
|
||||||
'registerName',
|
'registerName',
|
||||||
'address',
|
'registerNameEN',
|
||||||
'addressEN',
|
'registerDate',
|
||||||
|
'authorizedCapital',
|
||||||
|
'authorizedName',
|
||||||
|
'authorizedNameEN',
|
||||||
|
'customerName',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (customerFormData.customerType === 'PERS') {
|
|
||||||
tabFieldRequired.main = ['citizenId'];
|
|
||||||
}
|
|
||||||
|
|
||||||
let tapIsUndefined = validateTabField(
|
let tapIsUndefined = validateTabField(
|
||||||
customerFormData.customerBranch?.[idx],
|
customerFormData.customerBranch?.[idx],
|
||||||
tabFieldRequired,
|
tabFieldRequired,
|
||||||
|
|
@ -1996,6 +2007,7 @@ const emptyCreateDialog = ref(false);
|
||||||
// id: undefined,
|
// id: undefined,
|
||||||
// });
|
// });
|
||||||
} else {
|
} else {
|
||||||
|
if (!customerFormState.editCustomerId) return;
|
||||||
await customerStore.editBranchById(
|
await customerStore.editBranchById(
|
||||||
customerFormData.customerBranch[idx].id || '',
|
customerFormData.customerBranch[idx].id || '',
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue