From 87f32090734e7fcd0800285f04ef44f9abc9154d Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 26 Aug 2024 15:52:26 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1?= =?UTF-8?q?=E0=B8=B4=E0=B8=99=E0=B8=9A=E0=B8=B8=E0=B8=84=E0=B8=84=E0=B8=A5?= =?UTF-8?q?=20=3D=3D>=20=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EvaluateStepMain.vue | 6 ++- .../06_evaluate/components/step/step2.vue | 48 ++++++++++++------- .../06_evaluate/components/step/step5.vue | 25 ++++++---- .../components/viewstep/viewStep1.vue | 26 ++++++++-- 4 files changed, 71 insertions(+), 34 deletions(-) diff --git a/src/modules/06_evaluate/components/EvaluateStepMain.vue b/src/modules/06_evaluate/components/EvaluateStepMain.vue index 81ba905..710120c 100644 --- a/src/modules/06_evaluate/components/EvaluateStepMain.vue +++ b/src/modules/06_evaluate/components/EvaluateStepMain.vue @@ -193,8 +193,8 @@ const formDataStep1 = ref(); * @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); }); } diff --git a/src/modules/06_evaluate/components/step/step2.vue b/src/modules/06_evaluate/components/step/step2.vue index 79b88c1..4385145 100644 --- a/src/modules/06_evaluate/components/step/step2.vue +++ b/src/modules/06_evaluate/components/step/step2.vue @@ -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( diff --git a/src/modules/06_evaluate/components/step/step5.vue b/src/modules/06_evaluate/components/step/step5.vue index 17aa9e1..5b744f3 100644 --- a/src/modules/06_evaluate/components/step/step5.vue +++ b/src/modules/06_evaluate/components/step/step5.vue @@ -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(route.params.id.toString()); @@ -44,16 +44,23 @@ const items = ref([ ]); /** 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 () => {