แก้ไข 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,19 +121,19 @@ 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 router = useRouter();
const route = useRoute();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError, success } = mixin;
const { messageError, success, showLoader, hideLoader } = mixin;
const year = ref<string>("");
const round = ref<string>("");
const name = ref<string>("");
@ -365,7 +365,7 @@ const columns = ref<QTableProps["columns"]>([
]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
@ -374,7 +374,7 @@ const clickDetail = (examID: string) => {
};
const downloadExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.exportExam(importId.value), {
responseType: "blob",
@ -390,12 +390,12 @@ const downloadExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadPassExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.exportPassExam(importId.value), {
responseType: "blob",
@ -411,12 +411,12 @@ const downloadPassExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadPassResultExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.exportPassResultExam(importId.value), {
responseType: "blob",
@ -432,12 +432,12 @@ const downloadPassResultExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.getExamResultById(importId.value), {
examAttribute: "",
@ -474,7 +474,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -489,7 +489,7 @@ const candidateToPlacement = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodRecruitToPlacement(importId.value))
.then((res) => {
@ -499,7 +499,7 @@ const candidateToPlacement = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
router.go(-1);
});
})

View file

@ -236,17 +236,17 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
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 router = useRouter();
const route = useRoute();
const { loaderPage } = dataStore;
const profile_id = ref<string>("");
const birthdate = ref<string>("");
const gender = ref<string>("");
@ -269,7 +269,7 @@ const examOrder = ref<string>("");
const number = ref<string>("");
const score_expired = ref<string>("");
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const examID = ref<string>("62150001");
const prefix = ref<string>("นาย");
const fullname = ref<string>("เกียรติศักดิ์ บัณฑิต");
@ -281,7 +281,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getExamDetail(importId.value, examId.value))
.then((res) => {
@ -319,12 +319,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadScore = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.downloadScoreReport(importId.value, examId.value), {
responseType: "blob",
@ -340,12 +340,12 @@ const downloadScore = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadCertificate = async () => {
loaderPage(true);
showLoader();
let type = degree.value.includes("บัณฑิต") ? 2 : 1;
await http
.get(config.API.downloadExamReport(importId.value, examId.value, type), {
@ -362,7 +362,7 @@ const downloadCertificate = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>

File diff suppressed because it is too large Load diff

View file

@ -806,15 +806,14 @@ import type {
} from "@/modules/02_organizational/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO, notifyError } = mixin;
const { date2Thai, success, dateToISO, notifyError, showLoader, hideLoader } = mixin;
const myForm = ref<QForm | null>(null); //form data input
const name = ref<string>("");
const note = ref<string>("");
@ -925,7 +924,7 @@ watch(organizationName, (count: DataOption, prevCount: DataOption) => {
});
onMounted(async () => {
loaderPage(false);
hideLoader();
if (route.params.id != undefined) {
edit.value = true;
id.value = route.params.id.toString();
@ -940,7 +939,7 @@ const clickBack = () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getPeriodById(id.value))
.then((res) => {
@ -992,7 +991,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1019,7 +1018,7 @@ const uploadDocData = async () => {
fileDocDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodRecruitDoc(id.value), formData)
.then((res) => {})
@ -1027,7 +1026,7 @@ const uploadDocData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "บันทึกข้อมูลสำเร็จ");
clickBack();
});
@ -1043,7 +1042,7 @@ const uploadImgData = async () => {
fileImgDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodRecruitImg(id.value), formData)
.then((res) => {})
@ -1051,7 +1050,7 @@ const uploadImgData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
};
@ -1132,7 +1131,7 @@ const sendData = () => {
};
const deleteDocData = async (docId: string) => {
loaderPage(true);
showLoader();
await http
.delete(config.API.periodDeleteDoc(docId))
.then(async () => {
@ -1142,12 +1141,12 @@ const deleteDocData = async (docId: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const deleteImgData = async (docId: string) => {
loaderPage(true);
showLoader();
await http
.delete(config.API.periodDeleteImg(docId))
.then(async () => {
@ -1157,12 +1156,12 @@ const deleteImgData = async (docId: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const addData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.savePeriod, sendData())
.then(async (res) => {
@ -1175,12 +1174,12 @@ const addData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const editData = async (id: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.editPeriod(id), sendData())
.then(async () => {
@ -1191,7 +1190,7 @@ const editData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};

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);
});
})

View file

@ -237,19 +237,19 @@
import type { QTableProps } from "quasar";
import { ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
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 router = useRouter();
const route = useRoute();
const mixin = useCounterMixin();
const { messageError } = mixin;
const { loaderPage } = dataStore;
const { messageError, showLoader, hideLoader } = mixin;
const date = ref<any>();
const profile_id = ref<string>("");
const birthdate = ref<string>("");
@ -289,7 +289,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getDisableExamDetail(importId.value, examId.value))
.then((res) => {
@ -328,12 +328,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadScore = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.downloadDisableScoreReport(importId.value, examId.value), {
responseType: "blob",
@ -349,12 +349,12 @@ const downloadScore = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadCertificate = async () => {
loaderPage(true);
showLoader();
await http
.get(
config.API.downloadDisableExamReport(importId.value, examId.value, 2),
@ -373,7 +373,7 @@ const downloadCertificate = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>

File diff suppressed because it is too large Load diff

View file

@ -669,15 +669,20 @@ import type {
} from "@/modules/02_organizational/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO, notifyError, messageError } = mixin;
const {
date2Thai,
success,
dateToISO,
notifyError,
messageError,
showLoader,
hideLoader,
} = mixin;
const myForm = ref<QForm | null>(null); //form data input
const name = ref<string>("");
const note = ref<string>("");
@ -725,7 +730,7 @@ onMounted(async () => {
if (route.params.id != undefined) {
edit.value = true;
id.value = route.params.id.toString();
loaderPage(false);
hideLoader();
await fetchData();
} else {
edit.value = false;
@ -737,7 +742,7 @@ const clickBack = () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getDisablePeriodById(id.value))
.then((res) => {
@ -774,7 +779,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -829,7 +834,7 @@ const sendData = () => {
};
const addData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.saveDisablePeriod, sendData())
.then(async (res) => {
@ -844,12 +849,12 @@ const addData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const editData = async (id: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.editDisablePeriod(id), sendData())
.then(async () => {
@ -862,7 +867,7 @@ const editData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -889,7 +894,7 @@ const uploadImgData = async () => {
fileImgDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamImg(id.value), formData)
.then((res) => {})
@ -897,7 +902,7 @@ const uploadImgData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
};
@ -906,7 +911,7 @@ const deleteDocData = async (docId: string) => {
const params = {
documentId: docId,
};
loaderPage(true);
showLoader();
await http
.delete(config.API.periodExamDoc(id.value.toString()), {
params,
@ -919,7 +924,7 @@ const deleteDocData = async (docId: string) => {
})
.finally(async () => {
await fetchData();
loaderPage(false);
hideLoader();
});
};
@ -950,7 +955,7 @@ const uploadDocData = async () => {
fileDocDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamDoc(id.value), formData)
.then((res) => {})
@ -958,7 +963,7 @@ const uploadDocData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
} else {
clickBack();

View file

@ -138,14 +138,11 @@ import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { success, dateToISO, messageError } = mixin;
const { success, dateToISO, messageError, showLoader, hideLoader } = mixin;
const route = useRoute();
const examId = ref<string>(route.params.examId.toString());
const candidateId = ref<string>(route.params.candidateId.toString());
@ -163,7 +160,7 @@ onMounted(async () => {
});
const fetchStatus = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateId(candidateId.value))
.then((res) => {
@ -174,12 +171,12 @@ const fetchStatus = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const confirm = async (status: boolean, reason: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateCheckRegister(candidateId.value), {
status: status,
@ -190,14 +187,14 @@ const confirm = async (status: boolean, reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});
};
const reject = async (reason: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateRejectRegister(candidateId.value), {
reason: reason,
@ -207,7 +204,7 @@ const reject = async (reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});
@ -253,7 +250,7 @@ const clickSave = async () => {
type.value = defaultOccupation.value.employee;
if (defaultOccupation.value.status == "other")
type.value = defaultOccupation.value.other;
loaderPage(true);
showLoader();
await http
.post(config.API.candidateId(candidateId.value), {
prefixId: defaultInformation.value.prefixId,
@ -329,7 +326,7 @@ const clickSave = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
});

View file

@ -55,17 +55,16 @@ import { useCounterMixin } from "@/stores/mixin";
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { RequestPeriodExam } from "@/modules/03_recruiting/interface/request/Period";
import type { ResponsePeriodExam } from "@/modules/03_recruiting/interface/response/Period";
import { useQuasar } from "quasar";
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const router = useRouter();
const mixin = useCounterMixin();
const { date2Thai, messageError } = mixin;
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const rows = ref<ResponsePeriodExam[]>([]);
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
@ -163,12 +162,12 @@ const columns = ref<QTableProps["columns"]>([
]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamType("exam"))
.then((res) => {
@ -223,7 +222,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -278,17 +278,14 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const filePayment = ref<File[]>([]);
const bank = ref<any>([]);
const fee = ref<number>();
const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin(); //
const { success, messageError } = mixin;
const { success, messageError, showLoader, hideLoader } = mixin;
const route = useRoute();
const examId = ref<string>(route.params.examId.toString());
const candidateId = ref<string>(route.params.candidateId.toString());
@ -308,13 +305,13 @@ const props = defineProps({
});
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchPaymentExam();
await fetchData();
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidatePayment(candidateId.value))
.then((res) => {
@ -325,12 +322,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchPaymentExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamPayment(examId.value))
.then((res) => {
@ -342,12 +339,12 @@ const fetchPaymentExam = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const confirm = async (status: boolean, reason: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateCheckPayment(candidateId.value), {
status: status,
@ -358,7 +355,7 @@ const confirm = async (status: boolean, reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลชำระเงินสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});

View file

@ -94,15 +94,20 @@ import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
import Table from "@/modules/03_recruiting/components/Table.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import { useRouter } from "vue-router";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const { date2Thai, success, typeCategoryExam, messageError } = mixin;
const {
date2Thai,
success,
typeCategoryExam,
messageError,
showLoader,
hideLoader,
} = mixin;
const filter = ref<string>(""); //search data table
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
@ -205,12 +210,12 @@ const columns = ref<QTableProps["columns"]>([
]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamType("all"))
.then((res) => {
@ -292,7 +297,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -322,7 +327,7 @@ const clickAdd = () => {
};
const deleteData = async (id: string) => {
loaderPage(true);
showLoader();
await http
.delete(config.API.periodExamId(id))
.then((res) => {
@ -332,7 +337,7 @@ const deleteData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
};

View file

@ -986,16 +986,15 @@ import type {
} from "@/modules/02_organizational/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const myForm = ref<QForm | null>(null); //form data input
const name = ref<string>("");
const note = ref<string>("");
@ -1137,7 +1136,7 @@ watch(organizationName, (count: DataOption, prevCount: DataOption) => {
});
onMounted(async () => {
loaderPage(false);
hideLoader();
if (route.params.id != undefined) {
edit.value = true;
id.value = route.params.id.toString();
@ -1160,7 +1159,7 @@ const clickBack = () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamId(id.value))
.then((res) => {
@ -1239,7 +1238,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1247,7 +1246,7 @@ const fetchData = async () => {
* get รายการ รหสหนวยงาน
*/
const fetchOrganizationShortName = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -1265,7 +1264,7 @@ const fetchOrganizationShortName = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1273,7 +1272,7 @@ const fetchOrganizationShortName = async () => {
* get รายการ หนวยงาน
*/
const fetchOrganizationOrganization = async (val: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -1291,7 +1290,7 @@ const fetchOrganizationOrganization = async (val: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1299,7 +1298,7 @@ const fetchOrganizationOrganization = async (val: string) => {
* get รายการ ตำแหนงในสายงาน
*/
const fetchPositionPath = async (val: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.positionPath)
.then((res) => {
@ -1317,7 +1316,7 @@ const fetchPositionPath = async (val: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1410,7 +1409,7 @@ const sendData = () => {
};
const addData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.periodExam, sendData())
.then(async (res) => {
@ -1425,12 +1424,12 @@ const addData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const editData = async (id: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamId(id), sendData())
.then(async (res) => {
@ -1443,7 +1442,7 @@ const editData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -1470,13 +1469,13 @@ const uploadDocData = async () => {
fileDocDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamDoc(id.value), formData)
.then((res) => {})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
} else {
clickBack();
@ -1506,13 +1505,13 @@ const uploadImgData = async () => {
fileImgDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamImg(id.value), formData)
.then((res) => {})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
};
@ -1521,7 +1520,7 @@ const deleteDocData = async (docId: string) => {
const params = {
documentId: docId,
};
loaderPage(true);
showLoader();
await http
.delete(config.API.periodExamDoc(id.value.toString()), {
params,

View file

@ -37,7 +37,9 @@
<div class="q-pa-md row col-12 no-wrap">
<!-- การดแสดงจำนวนขอม -->
<div class="col-12 row">
<div class="text-grey-7 q-pb-sm row text-weight-medium col-12 items-center">
<div
class="text-grey-7 q-pb-sm row text-weight-medium col-12 items-center"
>
<!-- สรปจำนวนผสมครคดเลอก -->
<datepicker
v-model="dateFilter"
@ -120,7 +122,8 @@
<div class="col-12 row items-center q-pa-sm">
<div
:class="
'col-12 text-h5 text-weight-bold text-' + `${num.color}`
'col-12 text-h5 text-weight-bold text-' +
`${num.color}`
"
>
{{
@ -282,7 +285,7 @@ import { useCounterMixin } from "@/stores/mixin";
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import TableCandidate from "@/modules/03_recruiting/components/TableCandidate.vue";
import ExamFinished from "@/modules/03_recruiting/components/ExamFinished.vue";
import type { DataNumObject } from "@/modules/01_metadata/interface/request/Calendar";
@ -290,9 +293,15 @@ import { useQuasar } from "quasar";
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { genColor15, dateToISO, date2Thai, messageError } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const {
genColor15,
dateToISO,
date2Thai,
messageError,
showLoader,
hideLoader,
} = mixin;
const router = useRouter();
const route = useRoute();
const status = ref<string>("all");
@ -483,7 +492,7 @@ watch(status, (count: String, prevCount: String) => {
});
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchDataCom();
});
@ -502,7 +511,7 @@ const fetchDataCom = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateOfPeriodExam(status.value, examId.value))
.then((res) => {
@ -530,12 +539,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchPeriodExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamStatus(examId.value))
.then((res) => {
@ -550,7 +559,7 @@ const fetchPeriodExam = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -559,7 +568,7 @@ const fetchPeriodExam = async () => {
*/
const fetchDataSummary = async () => {
dataNum.value = [];
loaderPage(true);
showLoader();
await http
.get(config.API.countDashbordPeriodExam(examId.value))
.then((res) => {
@ -577,12 +586,12 @@ const fetchDataSummary = async () => {
dataNum.value = [];
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadFileDashboard = async () => {
loaderPage(true);
showLoader();
await http
.put(
config.API.periodExamDownloadDashboard(examId.value),
@ -606,7 +615,7 @@ const downloadFileDashboard = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -571,14 +571,13 @@ import http from "@/plugins/http";
import config from "@/app.config";
import HeaderTop from "@/modules/04_registry/components/Information/top.vue";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
const $q = useQuasar();
const mixin = useCounterMixin(); //
const store = useDataStore();
const { loaderPage } = store;
const { date2Thai, messageError } = mixin;
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const previous = ref<boolean>(false);
const next = ref<boolean>(false);
const addDialog = ref<boolean>(false);
@ -870,7 +869,7 @@ const saveEdit = async () => {
};
const saveDataAgency = async (data: DataLink[]) => {
loaderPage(true);
showLoader();
await http
.post(config.API.cmsAgency, data)
.then((res) => {})
@ -883,7 +882,7 @@ const saveDataAgency = async (data: DataLink[]) => {
};
const saveDataGoverment = async (data: DataLink[]) => {
loaderPage(true);
showLoader();
await http
.post(config.API.cmsGoverment, data)
@ -897,7 +896,7 @@ const saveDataGoverment = async (data: DataLink[]) => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.cms)
.then((res) => {
@ -952,12 +951,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const takeLogo = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("FileData", imageFileLogo.value);
await http
@ -974,7 +973,7 @@ const takeLogo = async () => {
};
const takeBanner = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("FileData", imageFile.value);
await http
@ -999,7 +998,7 @@ const sendDataDetail = async () => {
description: web.value.descripstion,
shortName: web.value.by,
};
loaderPage(true);
showLoader();
await http
.post(config.API.cmsDeatail, data)
.then((res) => {})
@ -1026,7 +1025,7 @@ const sendDataAbout = async () => {
zipCode: address.value.code,
telephone: address.value.tel,
};
loaderPage(true);
showLoader();
await http
.post(config.API.cmsAbout, data)
.then((res) => {})
@ -1042,7 +1041,7 @@ const sendDataAbout = async () => {
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -1057,13 +1056,13 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchDistrict = async (id: string | null) => {
if (id !== null && id != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -1078,14 +1077,14 @@ const fetchDistrict = async (id: string | null) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchSubDistrict = async (id: string | null) => {
if (id !== null && id != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -1104,7 +1103,7 @@ const fetchSubDistrict = async (id: string | null) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};