refactor: add function resetScrollBar
This commit is contained in:
parent
18059db8a0
commit
47d775ca58
4 changed files with 27 additions and 10 deletions
|
|
@ -6,7 +6,7 @@ import { BranchContact } from 'stores/branch-contact/types';
|
||||||
import { colors, useQuasar } from 'quasar';
|
import { colors, useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import type { QTableProps } from 'quasar';
|
import type { QTableProps } from 'quasar';
|
||||||
|
import { resetScrollBar } from 'src/stores/utils';
|
||||||
import useBranchStore from 'stores/branch';
|
import useBranchStore from 'stores/branch';
|
||||||
import useFlowStore from 'stores/flow';
|
import useFlowStore from 'stores/flow';
|
||||||
import {
|
import {
|
||||||
|
|
@ -1649,7 +1649,12 @@ watch(currentHq, () => {
|
||||||
:submit="() => onSubmit()"
|
:submit="() => onSubmit()"
|
||||||
:delete-data="() => triggerDelete(currentEdit.id)"
|
:delete-data="() => triggerDelete(currentEdit.id)"
|
||||||
:close="
|
:close="
|
||||||
() => ((modalDrawer = false), flowStore.rotate(), (isImageEdit = false))
|
() => (
|
||||||
|
(modalDrawer = false),
|
||||||
|
flowStore.rotate(),
|
||||||
|
(isImageEdit = false),
|
||||||
|
resetScrollBar('branch-info')
|
||||||
|
)
|
||||||
"
|
"
|
||||||
:statusBranch="formData.status"
|
:statusBranch="formData.status"
|
||||||
hide-action
|
hide-action
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import useFlowStore from 'stores/flow';
|
import useFlowStore from 'stores/flow';
|
||||||
import useUserStore from 'stores/user';
|
import useUserStore from 'stores/user';
|
||||||
import useBranchStore from 'stores/branch';
|
import useBranchStore from 'stores/branch';
|
||||||
import { isRoleInclude } from 'src/stores/utils';
|
import { isRoleInclude, resetScrollBar } from 'src/stores/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
User,
|
User,
|
||||||
|
|
@ -1494,7 +1494,12 @@ watch(
|
||||||
"
|
"
|
||||||
v-model:drawerOpen="infoDrawer"
|
v-model:drawerOpen="infoDrawer"
|
||||||
:submit="() => onSubmit()"
|
:submit="() => onSubmit()"
|
||||||
:close="() => onClose()"
|
:close="
|
||||||
|
() => {
|
||||||
|
onClose();
|
||||||
|
resetScrollBar('user-form-content');
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<InfoForm>
|
<InfoForm>
|
||||||
<div class="q-px-lg q-pt-lg surface-2">
|
<div class="q-px-lg q-pt-lg surface-2">
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import useOcrStore from 'stores/ocr';
|
||||||
import useCustomerStore from 'stores/customer';
|
import useCustomerStore from 'stores/customer';
|
||||||
import useEmployeeStore from 'stores/employee';
|
import useEmployeeStore from 'stores/employee';
|
||||||
import useMyBranchStore from 'stores/my-branch';
|
import useMyBranchStore from 'stores/my-branch';
|
||||||
import useUtilsStore, { dialog, notify } from 'stores/utils';
|
import useUtilsStore, { dialog, notify, resetScrollBar } from 'stores/utils';
|
||||||
import useFlowStore from 'stores/flow';
|
import useFlowStore from 'stores/flow';
|
||||||
import { Status } from 'stores/types';
|
import { Status } from 'stores/types';
|
||||||
import {
|
import {
|
||||||
|
|
@ -68,6 +68,7 @@ import FormEmployeeOther from 'components/03_customer-management/FormEmployeeOth
|
||||||
import useOptionStore from 'stores/options';
|
import useOptionStore from 'stores/options';
|
||||||
import { DialogContainer, DialogHeader } from 'components/dialog';
|
import { DialogContainer, DialogHeader } from 'components/dialog';
|
||||||
import KebabAction from 'src/components/shared/KebabAction.vue';
|
import KebabAction from 'src/components/shared/KebabAction.vue';
|
||||||
|
import { roundElectricalServices } from '@quasar/extras/material-icons-round';
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -2695,6 +2696,7 @@ const emptyCreateDialog = ref(false);
|
||||||
:close="
|
:close="
|
||||||
() => {
|
() => {
|
||||||
customerFormState.drawerModal = false;
|
customerFormState.drawerModal = false;
|
||||||
|
resetScrollBar('customer-form-content');
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:submit="
|
:submit="
|
||||||
|
|
@ -2999,11 +3001,13 @@ const emptyCreateDialog = ref(false);
|
||||||
|
|
||||||
<!-- ลูกจ้าง edit employee -->
|
<!-- ลูกจ้าง edit employee -->
|
||||||
<DrawerInfo
|
<DrawerInfo
|
||||||
|
v-if="!!employeeFormState.currentEmployee"
|
||||||
hide-action
|
hide-action
|
||||||
v-model:drawer-open="employeeFormState.drawerModal"
|
v-model:drawer-open="employeeFormState.drawerModal"
|
||||||
:close="
|
:close="
|
||||||
() => {
|
() => {
|
||||||
employeeFormState.drawerModal = false;
|
employeeFormState.drawerModal = false;
|
||||||
|
resetScrollBar('drawer-employee-form-content');
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:title="
|
:title="
|
||||||
|
|
@ -3044,11 +3048,6 @@ const emptyCreateDialog = ref(false);
|
||||||
employeeFormState.currentIndex = -1;
|
employeeFormState.currentIndex = -1;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:show="
|
|
||||||
() => {
|
|
||||||
employeeFormStore.resetFormDataEmployee(true);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
:before-close="
|
:before-close="
|
||||||
() => {
|
() => {
|
||||||
if (employeeFormStore.isFormDataDifferent()) {
|
if (employeeFormStore.isFormDataDifferent()) {
|
||||||
|
|
|
||||||
|
|
@ -226,4 +226,12 @@ export function isRoleInclude(role2check: string[]): boolean {
|
||||||
return isIncluded;
|
return isIncluded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resetScrollBar(elementId: string) {
|
||||||
|
const element = document.getElementById(elementId);
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
element.scrollTop = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default useUtilsStore;
|
export default useUtilsStore;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue