แก้ไข 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

@ -457,7 +457,7 @@ import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin";
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";
@ -488,10 +488,10 @@ const props = defineProps({
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const route = useRoute();
const id = ref<string>("");
const insigniaId = ref<string>("");
@ -913,7 +913,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
};
const fetchInsignia = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.insignia)
.then((res) => {
@ -934,13 +934,13 @@ const fetchInsignia = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchData = async () => {
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileInsignId(profileId.value))
.then((res) => {
@ -973,7 +973,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
@ -1071,7 +1071,7 @@ const clickSave = async () => {
*/
const saveData = async () => {
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.post(config.API.profileInsignId(profileId.value), {
id: id.value,
@ -1107,7 +1107,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileInsignId(id.value), {
id: id.value,
@ -1150,7 +1150,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileInsignId(id.value))
.then((res) => {
@ -1276,7 +1276,7 @@ const clickEditRow = () => {
*/
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileInsignHisId(row.id))
.then((res) => {
@ -1309,7 +1309,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};