fix: drawer before close and employee edit state
This commit is contained in:
parent
5becbae369
commit
0ad017309f
4 changed files with 15 additions and 10 deletions
|
|
@ -1649,6 +1649,7 @@ defineEmits<{
|
||||||
currentFromDataEmployee.employeeOtherInfo?.statusSave ===
|
currentFromDataEmployee.employeeOtherInfo?.statusSave ===
|
||||||
false
|
false
|
||||||
) {
|
) {
|
||||||
|
employeeFormStore.resetFormDataEmployee();
|
||||||
currentFromDataEmployee.employeeOtherInfo.statusSave = true;
|
currentFromDataEmployee.employeeOtherInfo.statusSave = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {
|
||||||
UndoButton,
|
UndoButton,
|
||||||
} from 'components/button';
|
} from 'components/button';
|
||||||
|
|
||||||
withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
title: string;
|
title: string;
|
||||||
category?: string;
|
category?: string;
|
||||||
|
|
@ -42,6 +42,11 @@ const drawerOpen = defineModel<boolean>('drawerOpen', {
|
||||||
const myForm = ref();
|
const myForm = ref();
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
|
if (props.beforeClose) {
|
||||||
|
drawerOpen.value = props.beforeClose
|
||||||
|
? props.beforeClose()
|
||||||
|
: !drawerOpen.value;
|
||||||
|
}
|
||||||
if (myForm.value) {
|
if (myForm.value) {
|
||||||
myForm.value.resetValidation();
|
myForm.value.resetValidation();
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +67,6 @@ async function onValidationError(ref: any) {
|
||||||
@show="show"
|
@show="show"
|
||||||
@before-hide="reset"
|
@before-hide="reset"
|
||||||
@hide="close"
|
@hide="close"
|
||||||
@update:model-value="(v) => (drawerOpen = beforeClose ? beforeClose() : v)"
|
|
||||||
:width="$q.screen.gt.xs ? windowSize * 0.85 : windowSize"
|
:width="$q.screen.gt.xs ? windowSize * 0.85 : windowSize"
|
||||||
v-model="drawerOpen"
|
v-model="drawerOpen"
|
||||||
behavior="mobile"
|
behavior="mobile"
|
||||||
|
|
|
||||||
|
|
@ -288,8 +288,10 @@ async function init() {
|
||||||
refTabCustomer.value?.openSpecificCustomer(route.query.id as string);
|
refTabCustomer.value?.openSpecificCustomer(route.query.id as string);
|
||||||
} else if (route.query.tab === 'employee') {
|
} else if (route.query.tab === 'employee') {
|
||||||
currentTab.value = 'employee';
|
currentTab.value = 'employee';
|
||||||
if (route.query.id)
|
setTimeout(async () => {
|
||||||
refTabEmployee.value?.openSpecificEmployee(route.query.id as string);
|
if (route.query.id)
|
||||||
|
refTabEmployee.value?.openSpecificEmployee(route.query.id as string);
|
||||||
|
}, 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -1393,12 +1393,10 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
statusSave: true,
|
statusSave: true,
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
employeeOtherInfo: structuredClone(
|
employeeOtherInfo: structuredClone({
|
||||||
{
|
...(payload.employeeOtherInfo ?? {}),
|
||||||
...payload.employeeOtherInfo,
|
statusSave: true,
|
||||||
statusSave: !!payload.employeeOtherInfo?.id ? true : false,
|
}),
|
||||||
} || {},
|
|
||||||
),
|
|
||||||
employeeWork: structuredClone(
|
employeeWork: structuredClone(
|
||||||
payload.employeeWork?.length === 0
|
payload.employeeWork?.length === 0
|
||||||
? state.value.dialogModal
|
? state.value.dialogModal
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue