fix: type error

This commit is contained in:
Methapon Metanipat 2024-09-26 09:59:26 +07:00
parent 61b7f19577
commit d740a48c7f
5 changed files with 57 additions and 57 deletions

View file

@ -2171,7 +2171,7 @@ const emptyCreateDialog = ref(false);
} else { } else {
res = await customerStore.createBranch({ res = await customerStore.createBranch({
...customerFormData.customerBranch[idx], ...customerFormData.customerBranch[idx],
customerId: customerFormState.editCustomerId, customerId: customerFormState.editCustomerId || '',
id: undefined, id: undefined,
}); });
} }
@ -2230,6 +2230,7 @@ const emptyCreateDialog = ref(false);
<EmployerFormBranch <EmployerFormBranch
:index="idx" :index="idx"
prefixId="form" prefixId="form"
v-if="customerFormData.customerBranch"
v-model:customer="customerFormData" v-model:customer="customerFormData"
v-model:customer-branch="customerFormData.customerBranch[idx]" v-model:customer-branch="customerFormData.customerBranch[idx]"
:onCreate="customerFormState.dialogType === 'create'" :onCreate="customerFormState.dialogType === 'create'"
@ -2245,6 +2246,8 @@ const emptyCreateDialog = ref(false);
@cancel="() => customerFormUndo(false)" @cancel="() => customerFormUndo(false)"
@delete=" @delete="
async () => { async () => {
if (!customerFormState.editCustomerId) return;
if (idx === 0) { if (idx === 0) {
deleteCustomerById(customerFormState.editCustomerId); deleteCustomerById(customerFormState.editCustomerId);
return; return;

View file

@ -45,8 +45,8 @@ const registerName = defineModel<string>('registerName', { default: '' });
const citizenId = defineModel<string>('citizenId', { default: '' }); const citizenId = defineModel<string>('citizenId', { default: '' });
const legalPersonNo = defineModel<string>('legalPersonNo', { default: '' }); const legalPersonNo = defineModel<string>('legalPersonNo', { default: '' });
const businessType = defineModel<'string'>('businessType'); const businessType = defineModel<string>('businessType');
const jobPosition = defineModel<'string'>('jobPosition'); const jobPosition = defineModel<string>('jobPosition');
const telephoneNo = defineModel<string>('telephoneNo', { default: '' }); const telephoneNo = defineModel<string>('telephoneNo', { default: '' });
const branchOptions = defineModel<{ id: string; name: string }[]>( const branchOptions = defineModel<{ id: string; name: string }[]>(

View file

@ -157,9 +157,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
wageRateText: v.wageRateText, wageRateText: v.wageRateText,
payDate: v.payDate, payDate: v.payDate,
jobDescription: v.jobDescription, jobDescription: v.jobDescription,
jobPositionEN: v.jobPositionEN,
jobPosition: v.jobPosition, jobPosition: v.jobPosition,
businessTypeEN: v.businessTypeEN,
businessType: v.businessType, businessType: v.businessType,
employmentOffice: v.employmentOffice, employmentOffice: v.employmentOffice,
employmentOfficeEN: v.employmentOfficeEN, employmentOfficeEN: v.employmentOfficeEN,

View file

@ -367,7 +367,6 @@ const useCustomerStore = defineStore('api-customer', () => {
data: CustomerBranchCreate & { data: CustomerBranchCreate & {
id?: string; id?: string;
customerId: string; customerId: string;
codeCustomer: string;
}, },
) { ) {
if (data.citizenId) { if (data.citizenId) {

View file

@ -25,56 +25,56 @@ export type Customer = {
export type CustomerBranch = { export type CustomerBranch = {
customerCode?: string; customerCode?: string;
wageRateText: 'string'; wageRateText: string;
wageRate: 0; wageRate: number;
payDateEN: 'string'; payDateEN: string;
payDate: 'string'; payDate: string;
jobDescription: 'string'; jobDescription: string;
jobPosition: 'string'; jobPosition: string;
businessType: 'string'; businessType: string;
agent: 'string'; agent: string;
contactName: 'string'; contactName: string;
officeTel: 'string'; officeTel: string;
contactTel: 'string'; contactTel: string;
email: 'string'; email: string;
subDistrictId: 'string'; subDistrictId: string;
districtId: 'string'; districtId: string;
provinceId: 'string'; provinceId: string;
streetEN: 'string'; streetEN: string;
street: 'string'; street: string;
mooEN: 'string'; mooEN: string;
moo: 'string'; moo: string;
soiEN: 'string'; soiEN: string;
soi: 'string'; soi: string;
addressEN: 'string'; addressEN: string;
address: 'string'; address: string;
employmentOfficeEN: 'string'; employmentOfficeEN: string;
employmentOffice: 'string'; employmentOffice: string;
homeCode: 'string'; homeCode: string;
authorizedNameEN: 'string'; authorizedNameEN: string;
authorizedName: 'string'; authorizedName: string;
authorizedCapital: 'string'; authorizedCapital: string;
registerDate: '2024-09-16T07:52:42.627Z'; registerDate: string | Date | null;
registerNameEN: 'string'; registerNameEN: string;
registerName: 'string'; registerName: string;
legalPersonNo: 'string'; legalPersonNo: string;
citizenId: 'string'; citizenId: string;
birthDate: '2024-09-16T07:52:42.627Z'; birthDate: string;
gender: 'string'; gender: string;
lastNameEN: 'string'; lastNameEN: string;
lastName: 'string'; lastName: string;
firstNameEN: 'string'; firstNameEN: string;
firstName: 'string'; firstName: string;
namePrefix: 'string'; namePrefix: string;
telephoneNo: 'string'; telephoneNo: string;
codeCustomer: 'string'; codeCustomer: string;
customerName: 'string'; customerName: string;
updatedByUserId: 'string'; updatedByUserId: string;
createdByUserId: 'string'; createdByUserId: string;
code: 'string'; code: string;
statusOrder: 0; statusOrder: 0;
customerId: 'string'; customerId: string;
id: 'string'; id: string;
status: Status; status: Status;
createdBy: string | null; createdBy: string | null;
@ -132,11 +132,11 @@ export type CustomerBranchCreate = {
customerName?: string; customerName?: string;
registerName?: string; registerName?: string;
registerNameEN?: string; registerNameEN?: string;
registerDate?: Date | null; registerDate?: string | Date | null;
authorizedCapital?: string; authorizedCapital?: string;
authorizedName?: string; authorizedName?: string;
authorizedNameEN?: string; authorizedNameEN?: string;
code?: 'string'; code?: string;
citizen?: CitizenPayload[]; citizen?: CitizenPayload[];
file?: { file?: {
name?: string; name?: string;