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

View file

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

View file

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