แก้ไข loader

This commit is contained in:
Thanit Konmek 2023-08-04 10:04:59 +07:00
parent f072224851
commit b663eedb09
147 changed files with 3095 additions and 3256 deletions

View file

@ -347,7 +347,7 @@ import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useProfileDataStore } from "@/modules/04_registry/store";
import { useDataStore } from "@/stores/data";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
@ -380,8 +380,7 @@ const props = defineProps({
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const {
date2Thai,
@ -390,6 +389,8 @@ const {
statusLeave,
dialogMessage,
dateToISO,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
@ -718,7 +719,7 @@ onMounted(async () => {
const fetchData = async () => {
rows.value = [];
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileLeaveId(profileId.value))
.then((res) => {
@ -743,7 +744,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
@ -773,7 +774,7 @@ const filterSelector = (val: any, update: Function, filtername: string) => {
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileLeaveHisId(row.id))
.then((res) => {
@ -798,7 +799,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -969,7 +970,7 @@ const saveData = async () => {
const sum = Number(numLeave.value) + Number(numUsedLeave.value);
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.post(config.API.profileLeaveId(profileId.value), {
dateStartLeave: dateToISO(dateRange.value[0]),
@ -1000,7 +1001,7 @@ const saveData = async () => {
const editData = async () => {
const sum = Number(numLeave.value) + Number(numUsedLeave.value);
loaderPage(true);
showLoader();
await http
.put(config.API.profileLeaveId(id.value), {
dateStartLeave: dateToISO(dateRange.value[0]),
@ -1025,7 +1026,7 @@ const editData = async () => {
};
const deleteData = async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileLeaveId(id.value))
.then((res) => {
@ -1192,7 +1193,7 @@ const addData = async () => {
const clickTotal = async () => {
rowsTotal.value = [];
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileLeaveTotalId(profileId.value))
.then((res) => {
@ -1211,7 +1212,7 @@ const clickTotal = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};