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: [
|
employeeVisa: [],
|
||||||
{
|
|
||||||
number: '',
|
|
||||||
type: '',
|
|
||||||
entryCount: 0,
|
|
||||||
issueCountry: '',
|
|
||||||
issuePlace: '',
|
|
||||||
issueDate: new Date(),
|
|
||||||
expireDate: new Date(),
|
|
||||||
mrz: '',
|
|
||||||
remark: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
employeePassport: [
|
employeePassport: [],
|
||||||
{
|
|
||||||
id: undefined,
|
|
||||||
number: '',
|
|
||||||
type: '',
|
|
||||||
issueDate: new Date(),
|
|
||||||
expireDate: new Date(),
|
|
||||||
issueCountry: '',
|
|
||||||
issuePlace: '',
|
|
||||||
previousPassportRef: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
employeeOtherInfo: {
|
employeeOtherInfo: {
|
||||||
citizenId: '',
|
citizenId: '',
|
||||||
|
|
@ -869,7 +846,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
currentFromDataEmployee.value.employeeVisa?.[state.value.currentIndexVisa]
|
currentFromDataEmployee.value.employeeVisa?.[state.value.currentIndexVisa]
|
||||||
.id !== undefined
|
.id !== undefined
|
||||||
) {
|
) {
|
||||||
const { id, ...payload } =
|
const { id, updatedAt, createdAt, employeeId, ...payload } =
|
||||||
currentFromDataEmployee.value.employeeVisa?.[
|
currentFromDataEmployee.value.employeeVisa?.[
|
||||||
state.value.currentIndexVisa
|
state.value.currentIndexVisa
|
||||||
];
|
];
|
||||||
|
|
@ -1151,18 +1128,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
employeeVisa: structuredClone(
|
employeeVisa: structuredClone(
|
||||||
payload.employeeVisa?.length === 0
|
payload.employeeVisa?.length === 0
|
||||||
? defaultFormData.employeeVisa
|
? defaultFormData.employeeVisa
|
||||||
: payload.employeeVisa?.map((item) => ({
|
: payload.employeeVisa,
|
||||||
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,
|
|
||||||
})),
|
|
||||||
),
|
),
|
||||||
employeeCheckup: structuredClone(
|
employeeCheckup: structuredClone(
|
||||||
payload.employeeCheckup?.length === 0
|
payload.employeeCheckup?.length === 0
|
||||||
|
|
@ -1274,14 +1240,28 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
|
|
||||||
function addPassport() {
|
function addPassport() {
|
||||||
currentFromDataEmployee.value.employeePassport?.push({
|
currentFromDataEmployee.value.employeePassport?.push({
|
||||||
id: undefined,
|
birthCountry: '',
|
||||||
number: '',
|
|
||||||
type: '',
|
|
||||||
issueDate: new Date(),
|
|
||||||
expireDate: new Date(),
|
|
||||||
issueCountry: '',
|
|
||||||
issuePlace: '',
|
|
||||||
previousPassportRef: '',
|
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 =
|
state.value.currentIndexPassport =
|
||||||
|
|
@ -1290,15 +1270,19 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
|
|
||||||
function addVisa() {
|
function addVisa() {
|
||||||
currentFromDataEmployee.value.employeeVisa?.push({
|
currentFromDataEmployee.value.employeeVisa?.push({
|
||||||
number: '',
|
arrivalAt: '',
|
||||||
type: '',
|
arrivalTMNo: '',
|
||||||
entryCount: 0,
|
arrivalTM: '',
|
||||||
issueCountry: '',
|
|
||||||
issuePlace: '',
|
|
||||||
issueDate: new Date(),
|
|
||||||
expireDate: new Date(),
|
|
||||||
mrz: undefined,
|
mrz: undefined,
|
||||||
|
entryCount: 0,
|
||||||
|
issuePlace: '',
|
||||||
|
issueCountry: '',
|
||||||
|
issueDate: new Date(),
|
||||||
|
type: '',
|
||||||
|
expireDate: new Date(),
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
|
workerType: '',
|
||||||
|
number: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
state.value.currentIndexVisa =
|
state.value.currentIndexVisa =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue