fix: can't edit employee

This commit is contained in:
Net 2024-09-05 11:13:33 +07:00
parent 7664a60523
commit ea602a38a0
3 changed files with 11 additions and 15 deletions

View file

@ -1,14 +1,12 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue';
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
import useAddressStore, {
District,
Province,
SubDistrict,
} from 'stores/address';
import { EmployeeCheckupCreate } from 'stores/employee/types';
import { useI18n } from 'vue-i18n';
import { checkTabBeforeAdd, selectFilterOptionRefMod } from 'stores/utils';
import { selectFilterOptionRefMod } from 'stores/utils';
import { QSelect } from 'quasar';
import DatePicker from '../shared/DatePicker.vue';
import {
@ -19,7 +17,6 @@ import {
UndoButton,
} from 'components/button';
const { locale } = useI18n();
const adrressStore = useAddressStore();
const addrOptions = reactive<{
@ -100,8 +97,10 @@ function addCheckup() {
checkupResult: '',
checkupType: '',
});
if (employeeCheckup.value)
if (employeeCheckup.value) {
tab.value = `tab${employeeCheckup.value.length - 1}`;
currentIndex.value = employeeCheckup.value.length - 1;
}
}
}
@ -162,7 +161,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
/>
{{ $t(`customerEmployee.formHealthCheck.title`) }}
<AddButton
v-if="!readonly && !hideAction"
v-if="currentIndex === -1 && !hideAction"
id="btn-add-bank"
icon-only
class="q-ml-sm"

View file

@ -1,9 +1,7 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
import { EmployeeWorkCreate } from 'stores/employee/types';
import { useI18n } from 'vue-i18n';
import { checkTabBeforeAdd, selectFilterOptionRefMod } from 'stores/utils';
import { selectFilterOptionRefMod } from 'stores/utils';
import DatePicker from '../shared/DatePicker.vue';
import {
@ -13,7 +11,6 @@ import {
SaveButton,
UndoButton,
} from 'components/button';
const { locale } = useI18n();
const currentIndex = defineModel<number>('currentIndex');
const employeeWork = defineModel<EmployeeWorkCreate[]>('employeeWork');
@ -63,7 +60,10 @@ function addData() {
ownerName: '',
remark: '',
});
if (employeeWork.value) tab.value = `tab${employeeWork.value.length - 1}`;
if (employeeWork.value) {
tab.value = `tab${employeeWork.value.length - 1}`;
currentIndex.value = employeeWork.value.length - 1;
}
}
}
@ -117,7 +117,7 @@ const workplaceFilter = selectFilterOptionRefMod(
/>
{{ $t(`customerEmployee.formWorkHistory.title`) }}
<AddButton
v-if="!readonly && !hideAction"
v-if="currentIndex === -1 && !hideAction"
id="btn-add-bank"
icon-only
class="q-ml-sm"

View file

@ -3502,7 +3502,6 @@ const emptyCreateDialog = ref(false);
dense
outlined
:hide-action="currentTab !== 'employee'"
:readonly="!employeeFormState.isEmployeeEdit"
v-model:current-index="employeeFormState.currentIndex"
v-model:employee-checkup="
currentFromDataEmployee.employeeCheckup
@ -3565,7 +3564,6 @@ const emptyCreateDialog = ref(false);
dense
:hide-action="currentTab !== 'employee'"
outlined
:readonly="!employeeFormState.isEmployeeEdit"
v-model:current-index="employeeFormState.currentIndex"
v-model:employee-work="currentFromDataEmployee.employeeWork"
v-model:position-name-option="optionStore.globalOption.position"
@ -3614,7 +3612,6 @@ const emptyCreateDialog = ref(false);
id="drawer-other"
prefix-id="drawer-employee"
dense
:readonly="!employeeFormState.isEmployeeEdit"
outlined
v-model:employee-other="
currentFromDataEmployee.employeeOtherInfo