refactor: handle edit
This commit is contained in:
parent
f337760644
commit
d21506f4d6
3 changed files with 20 additions and 4 deletions
|
|
@ -2527,6 +2527,7 @@ watch(
|
|||
await fetchListEmployee();
|
||||
|
||||
employeeFormState.isEmployeeEdit = false;
|
||||
employeeFormState.currentIndex = -1;
|
||||
}
|
||||
"
|
||||
:show="
|
||||
|
|
@ -2734,9 +2735,12 @@ watch(
|
|||
prefix-id="form-employee"
|
||||
dense
|
||||
outlined
|
||||
v-model:employeeCheckup="currentFromDataEmployee.employeeCheckup"
|
||||
v-model:checkupTypeOption="optionStore.globalOption.insurancePlace"
|
||||
v-model:medicalBenefitOption="
|
||||
v-model:current-index="employeeFormState.currentIndex"
|
||||
v-model:employee-checkup="currentFromDataEmployee.employeeCheckup"
|
||||
v-model:checkup-type-option="
|
||||
optionStore.globalOption.insurancePlace
|
||||
"
|
||||
v-model:medical-benefit-option="
|
||||
optionStore.globalOption.typeInsurance
|
||||
"
|
||||
v-model:insuranceCompanyOption="
|
||||
|
|
@ -2753,6 +2757,7 @@ watch(
|
|||
if (
|
||||
currentFromDataEmployee.employeeCheckup?.[index].statusSave
|
||||
) {
|
||||
employeeFormState.currentIndex = index;
|
||||
currentFromDataEmployee.employeeCheckup[index].statusSave =
|
||||
false;
|
||||
}
|
||||
|
|
@ -2764,6 +2769,7 @@ watch(
|
|||
currentFromDataEmployee.employeeCheckup?.[index]
|
||||
.statusSave === false
|
||||
) {
|
||||
employeeFormState.currentIndex = -1;
|
||||
currentFromDataEmployee.employeeCheckup[index].statusSave =
|
||||
true;
|
||||
employeeFormStore.resetFormDataEmployee();
|
||||
|
|
@ -2783,6 +2789,7 @@ watch(
|
|||
prefix-id="form-employee"
|
||||
dense
|
||||
outlined
|
||||
v-model:current-index="employeeFormState.currentIndex"
|
||||
v-model:employee-work="currentFromDataEmployee.employeeWork"
|
||||
v-model:position-name-option="optionStore.globalOption.position"
|
||||
v-model:job-type-option="optionStore.globalOption.businessType"
|
||||
|
|
@ -2804,6 +2811,7 @@ watch(
|
|||
currentFromDataEmployee.employeeWork?.[index].statusSave ===
|
||||
false
|
||||
) {
|
||||
employeeFormState.currentIndex = -1;
|
||||
currentFromDataEmployee.employeeWork[index].statusSave = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2811,6 +2819,7 @@ watch(
|
|||
@edit="
|
||||
(index) => {
|
||||
if (currentFromDataEmployee.employeeWork?.[index].statusSave) {
|
||||
employeeFormState.currentIndex = index;
|
||||
currentFromDataEmployee.employeeWork[index].statusSave =
|
||||
false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,6 +392,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
currentTab: string;
|
||||
dialogModal: boolean;
|
||||
drawerModal: boolean;
|
||||
|
||||
currentEmployeeCode: string;
|
||||
currentEmployee: Employee | null;
|
||||
currentIndex: number;
|
||||
|
|
@ -422,7 +423,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
}
|
||||
| undefined;
|
||||
}>({
|
||||
currentIndex: 0,
|
||||
currentIndex: -1,
|
||||
statusSavePersonal: false,
|
||||
drawerModal: false,
|
||||
imageDialog: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue