ประเมินบุคคล ==> ปรับ load

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-26 15:52:26 +07:00
parent bb79dded69
commit 87f3209073
4 changed files with 71 additions and 34 deletions

View file

@ -193,8 +193,8 @@ const formDataStep1 = ref<PersonInformation>();
* @param id id ประเม * @param id id ประเม
*/ */
async function fetchDataStep1(id: string) { async function fetchDataStep1(id: string) {
showLoadStatus.value = false;
showLoader(); showLoader();
showLoadStatus.value = false;
await http await http
.get(config.API.evaluationCheckspecByid(id)) .get(config.API.evaluationCheckspecByid(id))
.then((res) => { .then((res) => {
@ -206,7 +206,9 @@ async function fetchDataStep1(id: string) {
}) })
.finally(() => { .finally(() => {
showLoadStatus.value = true; showLoadStatus.value = true;
hideLoader(); setTimeout(() => {
hideLoader();
}, 3000);
}); });
} }

View file

@ -278,9 +278,9 @@ async function uploadfile(uploadUrl: string, file: any) {
* function fecth รายชอผเซนเอกสาร * function fecth รายชอผเซนเอกสาร
* @param id evaluate ID * @param id evaluate ID
*/ */
async function fetcheSigner(id: string) { function fetcheSigner(id: string) {
showLoader(); showLoader();
await http http
.get(config.API.evaluationSignerDoc1(id)) .get(config.API.evaluationSignerDoc1(id))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
@ -297,7 +297,9 @@ async function fetcheSigner(id: string) {
getCommander(); getCommander();
}) })
.finally(() => { .finally(() => {
hideLoader(); setTimeout(() => {
hideLoader();
}, 2000);
}); });
} }
@ -317,7 +319,9 @@ async function fetchCheckSpec(id: string) {
messageError($q, err); messageError($q, err);
}) })
.finally(() => { .finally(() => {
hideLoader(); setTimeout(() => {
hideLoader();
}, 2000);
}); });
} }
@ -389,7 +393,9 @@ async function downloadFile(fileName: string) {
emit("update:form", formCommand, ref); emit("update:form", formCommand, ref);
hideLoader(); setTimeout(() => {
hideLoader();
}, 2000);
}); });
} }
@ -398,17 +404,24 @@ onMounted(async () => {
if (keycloak.tokenParsed != null) { if (keycloak.tokenParsed != null) {
formCommand.author = keycloak.tokenParsed.name; formCommand.author = keycloak.tokenParsed.name;
} }
showLoader();
fetcheSigner(evaluateId.value); await Promise.all([
fetchCheckSpec(evaluateId.value); fetcheSigner(evaluateId.value),
downloadFile("1-แบบพิจารณาคุณสมบัติบุคคล"); fetchCheckSpec(evaluateId.value),
downloadFile("2-แบบแสดงรายละเอียดการเสนอผลงาน"); downloadFile("1-แบบพิจารณาคุณสมบัติบุคคล"),
downloadFile( downloadFile("2-แบบแสดงรายละเอียดการเสนอผลงาน"),
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)" downloadFile(
); "3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)"
downloadFile("4-แบบประเมินคุณลักษณะบุคคล"); ),
downloadFile("5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)"); downloadFile("4-แบบประเมินคุณลักษณะบุคคล"),
downloadFile("6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)"); downloadFile("5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)"),
downloadFile("6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)"),
]);
// .then(() => {
// setTimeout(() => {
// hideLoader();
// }, 2000);
// });
}); });
function getCommander() { function getCommander() {
@ -423,8 +436,7 @@ function getCommander() {
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) });
.finally(() => {});
} }
/** callback function */ /** callback function */
watch( watch(

View file

@ -12,7 +12,7 @@ import { useCounterMixin } from "@/stores/mixin";
const mixins = useCounterMixin(); const mixins = useCounterMixin();
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const { date2Thai, success } = mixins; const { date2Thai, success, showLoader, hideLoader } = mixins;
/** id ประเมิน*/ /** id ประเมิน*/
const evaluateId = ref<string>(route.params.id.toString()); const evaluateId = ref<string>(route.params.id.toString());
@ -44,16 +44,23 @@ const items = ref<any>([
]); ]);
/** fuinction เรียกข้อมูลลิงก์ดาวนฺโหลด*/ /** fuinction เรียกข้อมูลลิงก์ดาวนฺโหลด*/
async function onClickfetchDocument(fileName: string, type: string) { function onClickfetchDocument(fileName: string, type: string) {
evaluateId.value && if (evaluateId.value) {
(await http showLoader();
http
.get(config.API.loadFileDocument("เล่ม 1", evaluateId.value, fileName)) .get(config.API.loadFileDocument("เล่ม 1", evaluateId.value, fileName))
.then((res) => { .then((res) => {
const downloadUrl = res.data.downloadUrl; const downloadUrl = res.data.downloadUrl;
type === "COPPY" && coppyLink(downloadUrl); type === "COPPY" && coppyLink(downloadUrl);
type === "CHECK" && (statusFile.value = true); type === "CHECK" && (statusFile.value = true);
}) })
.catch(() => {})); .catch(() => {})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1500);
});
}
} }
/** function คัดลอหลิงก์ดาวน์โหลด */ /** function คัดลอหลิงก์ดาวน์โหลด */
@ -64,9 +71,9 @@ async function coppyLink(link: string) {
} }
/** function เรียกข้อมูลวันที่ประกาศ*/ /** function เรียกข้อมูลวันที่ประกาศ*/
async function fetchCheckDate() { function fetchCheckDate() {
evaluateId.value && evaluateId.value &&
(await http http
.get(config.API.evaluationCheckDate(evaluateId.value)) .get(config.API.evaluationCheckDate(evaluateId.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
@ -75,7 +82,7 @@ async function fetchCheckDate() {
endDate.setDate(endDate.getDate() + 30); endDate.setDate(endDate.getDate() + 30);
dateEndAnnounce.value = date2Thai(endDate); dateEndAnnounce.value = date2Thai(endDate);
}) })
.catch(() => {})); .catch(() => {});
} }
/** Hook lifecycle*/ /** Hook lifecycle*/
@ -87,7 +94,7 @@ onMounted(async () => {
<template> <template>
<div class="row col-12 q-pa-sm"> <div class="row col-12 q-pa-sm">
<div class="row q-col-gutter-sm"> <div class="row col-12 q-col-gutter-sm">
<div class="col-12 text-center"> <div class="col-12 text-center">
<q-banner rounded class="text-weight-bold text-red-14 bg-red-1"> <q-banner rounded class="text-weight-bold text-red-14 bg-red-1">
<div class="text-weight-bold"> <div class="text-weight-bold">

View file

@ -143,7 +143,7 @@ async function fetchDetail() {
.finally(() => { .finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoader(); hideLoader();
}, 500); }, 2500);
}); });
} }
@ -235,14 +235,30 @@ function getData() {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); setTimeout(() => {
hideLoader();
}, 2500);
}); });
} }
onMounted(async () => { onMounted(async () => {
route.name === "evaluate-add" && (await fetchDetail()); // route.name === "evaluate-add" && (await fetchDetail());
props.data && fetchCheckSpec(props.data); // props.data && fetchCheckSpec(props.data);
getData(); // getData();
const promises = [];
if (route.name === "evaluate-add") {
promises.push(fetchDetail());
}
if (props.data) {
promises.push(fetchCheckSpec(props.data));
}
promises.push(getData());
await Promise.all(promises);
}); });
</script> </script>