ประเมินบุคคล ==> ปรับ 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 ประเม
*/
async function fetchDataStep1(id: string) {
showLoadStatus.value = false;
showLoader();
showLoadStatus.value = false;
await http
.get(config.API.evaluationCheckspecByid(id))
.then((res) => {
@ -206,7 +206,9 @@ async function fetchDataStep1(id: string) {
})
.finally(() => {
showLoadStatus.value = true;
hideLoader();
setTimeout(() => {
hideLoader();
}, 3000);
});
}

View file

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

View file

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

View file

@ -143,7 +143,7 @@ async function fetchDetail() {
.finally(() => {
setTimeout(() => {
hideLoader();
}, 500);
}, 2500);
});
}
@ -235,14 +235,30 @@ function getData() {
messageError($q, e);
})
.finally(() => {
hideLoader();
setTimeout(() => {
hideLoader();
}, 2500);
});
}
onMounted(async () => {
route.name === "evaluate-add" && (await fetchDetail());
props.data && fetchCheckSpec(props.data);
getData();
// route.name === "evaluate-add" && (await fetchDetail());
// props.data && fetchCheckSpec(props.data);
// 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>