fix: drawer before close and employee edit state
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s

This commit is contained in:
puriphatt 2025-09-17 14:07:07 +07:00
parent a2db828504
commit f4ac6859e3
4 changed files with 15 additions and 10 deletions

View file

@ -1649,6 +1649,7 @@ defineEmits<{
currentFromDataEmployee.employeeOtherInfo?.statusSave ===
false
) {
employeeFormStore.resetFormDataEmployee();
currentFromDataEmployee.employeeOtherInfo.statusSave = true;
}
}

View file

@ -8,7 +8,7 @@ import {
UndoButton,
} from 'components/button';
withDefaults(
const props = withDefaults(
defineProps<{
title: string;
category?: string;
@ -42,6 +42,11 @@ const drawerOpen = defineModel<boolean>('drawerOpen', {
const myForm = ref();
function reset() {
if (props.beforeClose) {
drawerOpen.value = props.beforeClose
? props.beforeClose()
: !drawerOpen.value;
}
if (myForm.value) {
myForm.value.resetValidation();
}
@ -62,7 +67,6 @@ async function onValidationError(ref: any) {
@show="show"
@before-hide="reset"
@hide="close"
@update:model-value="(v) => (drawerOpen = beforeClose ? beforeClose() : v)"
:width="$q.screen.gt.xs ? windowSize * 0.85 : windowSize"
v-model="drawerOpen"
behavior="mobile"

View file

@ -288,8 +288,10 @@ async function init() {
refTabCustomer.value?.openSpecificCustomer(route.query.id as string);
} else if (route.query.tab === 'employee') {
currentTab.value = 'employee';
if (route.query.id)
refTabEmployee.value?.openSpecificEmployee(route.query.id as string);
setTimeout(async () => {
if (route.query.id)
refTabEmployee.value?.openSpecificEmployee(route.query.id as string);
}, 150);
}
if (

View file

@ -1393,12 +1393,10 @@ export const useEmployeeForm = defineStore('form-employee', () => {
statusSave: true,
})),
),
employeeOtherInfo: structuredClone(
{
...payload.employeeOtherInfo,
statusSave: !!payload.employeeOtherInfo?.id ? true : false,
} || {},
),
employeeOtherInfo: structuredClone({
...(payload.employeeOtherInfo ?? {}),
statusSave: true,
}),
employeeWork: structuredClone(
payload.employeeWork?.length === 0
? state.value.dialogModal