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

@ -121,15 +121,14 @@ import { ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import type { RecruitDetailResponse } from "@/modules/03_recruiting/interface/response/Period";
import Table from "@/modules/03_recruiting/components/Table.vue";
import { useDataStore } from "@/stores/data";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const year = ref<string>("2566");
const round = ref<string>("1");
const name = ref<string>("");
@ -140,7 +139,7 @@ const pass = ref<number>(0);
const notpass = ref<number>(0);
const importId = ref<string>(route.params.id as string); // Period Import Id
const mixin = useCounterMixin();
const { messageError, success } = mixin;
const { messageError, success, showLoader, hideLoader } = mixin;
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([
"examID",
@ -328,12 +327,12 @@ const clickDetail = (examID: string) => {
};
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
const downloadExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.exportDisableExam(importId.value), {
responseType: "blob",
@ -349,12 +348,12 @@ const downloadExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadPassExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.exportDisablePassExam(importId.value), {
responseType: "blob",
@ -370,12 +369,12 @@ const downloadPassExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadPassResultExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.exportDisablePassResultExam(importId.value), {
responseType: "blob",
@ -391,12 +390,12 @@ const downloadPassResultExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.getDisableExamResultById(importId.value), {
examAttribute: "",
@ -427,7 +426,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -442,7 +441,7 @@ const candidateToPlacement = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodDisableToPlacement(importId.value))
.then((res) => {
@ -452,7 +451,7 @@ const candidateToPlacement = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
router.go(-1);
});
})