refactor: set default value visa and passport
This commit is contained in:
parent
2e1e82b2bc
commit
75cd39681d
1 changed files with 36 additions and 52 deletions
|
|
@ -710,32 +710,9 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
},
|
||||
],
|
||||
|
||||
employeeVisa: [
|
||||
{
|
||||
number: '',
|
||||
type: '',
|
||||
entryCount: 0,
|
||||
issueCountry: '',
|
||||
issuePlace: '',
|
||||
issueDate: new Date(),
|
||||
expireDate: new Date(),
|
||||
mrz: '',
|
||||
remark: '',
|
||||
},
|
||||
],
|
||||
employeeVisa: [],
|
||||
|
||||
employeePassport: [
|
||||
{
|
||||
id: undefined,
|
||||
number: '',
|
||||
type: '',
|
||||
issueDate: new Date(),
|
||||
expireDate: new Date(),
|
||||
issueCountry: '',
|
||||
issuePlace: '',
|
||||
previousPassportRef: '',
|
||||
},
|
||||
],
|
||||
employeePassport: [],
|
||||
|
||||
employeeOtherInfo: {
|
||||
citizenId: '',
|
||||
|
|
@ -869,7 +846,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
currentFromDataEmployee.value.employeeVisa?.[state.value.currentIndexVisa]
|
||||
.id !== undefined
|
||||
) {
|
||||
const { id, ...payload } =
|
||||
const { id, updatedAt, createdAt, employeeId, ...payload } =
|
||||
currentFromDataEmployee.value.employeeVisa?.[
|
||||
state.value.currentIndexVisa
|
||||
];
|
||||
|
|
@ -1151,18 +1128,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
employeeVisa: structuredClone(
|
||||
payload.employeeVisa?.length === 0
|
||||
? defaultFormData.employeeVisa
|
||||
: payload.employeeVisa?.map((item) => ({
|
||||
id: item.id,
|
||||
number: item.number,
|
||||
type: item.type,
|
||||
entryCount: item.entryCount,
|
||||
issueCountry: item.issueCountry,
|
||||
issuePlace: item.issuePlace,
|
||||
issueDate: item.issueDate,
|
||||
expireDate: item.expireDate,
|
||||
mrz: item.mrz || undefined,
|
||||
remark: item.remark || undefined,
|
||||
})),
|
||||
: payload.employeeVisa,
|
||||
),
|
||||
employeeCheckup: structuredClone(
|
||||
payload.employeeCheckup?.length === 0
|
||||
|
|
@ -1274,14 +1240,28 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
|
||||
function addPassport() {
|
||||
currentFromDataEmployee.value.employeePassport?.push({
|
||||
id: undefined,
|
||||
number: '',
|
||||
type: '',
|
||||
issueDate: new Date(),
|
||||
expireDate: new Date(),
|
||||
issueCountry: '',
|
||||
issuePlace: '',
|
||||
birthCountry: '',
|
||||
previousPassportRef: '',
|
||||
issuePlace: '',
|
||||
issueCountry: '',
|
||||
issueDate: new Date(),
|
||||
type: '',
|
||||
expireDate: new Date(),
|
||||
birthDate: new Date(),
|
||||
updatedAt: new Date(),
|
||||
createdAt: new Date(),
|
||||
workerStatus: '',
|
||||
nationality: '',
|
||||
gender: '',
|
||||
lastNameEN: '',
|
||||
lastName: '',
|
||||
middleNameEN: '',
|
||||
middleName: '',
|
||||
firstNameEN: '',
|
||||
firstName: '',
|
||||
namePrefix: '',
|
||||
employeeId: '',
|
||||
number: '',
|
||||
});
|
||||
|
||||
state.value.currentIndexPassport =
|
||||
|
|
@ -1290,15 +1270,19 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
|
||||
function addVisa() {
|
||||
currentFromDataEmployee.value.employeeVisa?.push({
|
||||
number: '',
|
||||
type: '',
|
||||
entryCount: 0,
|
||||
issueCountry: '',
|
||||
issuePlace: '',
|
||||
issueDate: new Date(),
|
||||
expireDate: new Date(),
|
||||
arrivalAt: '',
|
||||
arrivalTMNo: '',
|
||||
arrivalTM: '',
|
||||
mrz: undefined,
|
||||
entryCount: 0,
|
||||
issuePlace: '',
|
||||
issueCountry: '',
|
||||
issueDate: new Date(),
|
||||
type: '',
|
||||
expireDate: new Date(),
|
||||
remark: undefined,
|
||||
workerType: '',
|
||||
number: '',
|
||||
});
|
||||
|
||||
state.value.currentIndexVisa =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue