From 0e5d15dc7c1606304756657e786899ac655291af Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 21 Dec 2023 17:51:13 +0700 Subject: [PATCH] =?UTF-8?q?API=20=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80?= =?UTF-8?q?=E0=B8=A1=E0=B8=B4=E0=B8=99=20step=201-4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/evaluate/api.evaluate.ts | 3 + src/modules/06_evaluate/components/Tab1.vue | 33 +++- .../06_evaluate/components/step/step1.vue | 18 +- .../06_evaluate/components/step/step2.vue | 161 ++++++++++++++--- .../06_evaluate/components/step/step3.vue | 67 +++++++- .../components/viewstep/popupHistory.vue | 18 +- .../components/viewstep/viewPDF.vue | 54 +++++- .../components/viewstep/viewStep1.vue | 92 ++++++++-- .../components/viewstep/viewStep3.vue | 19 +- src/modules/06_evaluate/store.ts | 2 +- .../06_evaluate/stores/evaluationFunction.ts | 162 +++++------------- .../06_evaluate/views/EvaluateMain.vue | 6 +- 12 files changed, 444 insertions(+), 191 deletions(-) diff --git a/src/api/evaluate/api.evaluate.ts b/src/api/evaluate/api.evaluate.ts index 0ae1653..7261793 100644 --- a/src/api/evaluate/api.evaluate.ts +++ b/src/api/evaluate/api.evaluate.ts @@ -21,8 +21,11 @@ export default { evaluationWaitCheck: (id: string) => `${evaluation}/wait-check-doc-v2/${id}`, evaluationDoc2: (id: string) => `${evaluation}/doc2/reject/${id}`, evaluationHistory: (id: string) => `${evaluation}/step-history/${id}`, + evaluationDetail: () => `${env.API_URI}/profile/keycloak`, /**document */ loadPathDocument: (val: string, id: string) => `${evaluation}/document/${val}/${id}`, + loadFileDocument: (val: string, id: string, file: String) => + `${evaluation}/document/${val}/${id}/${file}`, }; diff --git a/src/modules/06_evaluate/components/Tab1.vue b/src/modules/06_evaluate/components/Tab1.vue index 2d280b8..5ef151e 100644 --- a/src/modules/06_evaluate/components/Tab1.vue +++ b/src/modules/06_evaluate/components/Tab1.vue @@ -1,5 +1,5 @@ diff --git a/src/modules/06_evaluate/components/step/step2.vue b/src/modules/06_evaluate/components/step/step2.vue index f2373a5..02fb27b 100644 --- a/src/modules/06_evaluate/components/step/step2.vue +++ b/src/modules/06_evaluate/components/step/step2.vue @@ -4,7 +4,9 @@ import keycloak from "@/plugins/keycloak"; import http from "@/plugins/http"; import config from "@/app.config"; import genReport from "@/plugins/genreport"; -import { useQuasar, type StringDictionary } from "quasar"; +import { VuePDF, usePDF } from "@tato30/vue-pdf"; +import { useQuasar } from "quasar"; +import axios from "axios"; import type { FormCommand } from "@/modules/06_evaluate/interface/evalute"; @@ -76,7 +78,7 @@ const page = ref(1); const pdfSrc = ref(); function onClickViewPDF(file: any) { - pdfSrc.value = file.webkitRelativePath; + // pdfSrc.value = file.webkitRelativePath; modalView.value = true; } @@ -115,24 +117,56 @@ async function onClickDowloadFile( await genReport(body, fileName); } -async function fetchPathUpload(volume: string, id: string) { - showLoader(); +async function fetchPathUpload( + volume: string, + id: string | undefined, + type: string, + file: any +) { const body = { - fileList: [ - "1-แบบพิจารณาคุณสมบัติบุคคล", - "2-แบบแสดงรายละเอียดการเสนอผลงาน", - "3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)", - "4-แบบประเมินคุณลักษณะบุคคล", - "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)", - "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)", - ], + fileList: type, + replace: true, + // "1-แบบพิจารณาคุณสมบัติบุคคล", + // "2-แบบแสดงรายละเอียดการเสนอผลงาน", + // "3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)", + // "4-แบบประเมินคุณลักษณะบุคคล", + // "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)", + // "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)", }; - await http - .post(config.API.loadPathDocument(volume, id), body) - .then((res) => {}) - .catch((err) => {}) - .finally(() => { - hideLoader(); + if (id && file) { + showLoader(); + await http + .post(config.API.loadPathDocument(volume, id), body) + .then((res) => { + const foundKey: string | undefined = Object.keys(res.data).find( + (key) => + res.data[key]?.fileName !== undefined && + res.data[key]?.fileName !== "" + ); + foundKey && uploadfile(res.data[foundKey]?.uploadUrl, file); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + } +} + +async function uploadfile(uploadUrl: string, file: any) { + console.log(uploadUrl); + await axios + .put(uploadUrl, file, { + headers: { + "Content-Type": file.type, + }, + }) + .then((res) => { + console.log(res); + }) + .catch((err) => { + console.log(err); }); } @@ -150,7 +184,6 @@ onMounted(async () => { fileEvaluation6Ref: fileEvaluation6Ref.value, }; emit("update:form", formCommand, ref); - props.evaluateId && (await fetchPathUpload("เล่ม 1", props.evaluateId)); }); @@ -215,7 +248,20 @@ onMounted(async () => {
- อัปโหลดไฟล์
@@ -283,7 +329,20 @@ onMounted(async () => {
- อัปโหลดไฟล์
@@ -352,7 +411,20 @@ onMounted(async () => {
- อัปโหลดไฟล์
@@ -420,7 +492,20 @@ onMounted(async () => {
- อัปโหลดไฟล์
@@ -487,7 +572,20 @@ onMounted(async () => {
- อัปโหลดไฟล์
@@ -555,7 +653,20 @@ onMounted(async () => {
- อัปโหลดไฟล์
diff --git a/src/modules/06_evaluate/components/step/step3.vue b/src/modules/06_evaluate/components/step/step3.vue index 1e89608..4cb2732 100644 --- a/src/modules/06_evaluate/components/step/step3.vue +++ b/src/modules/06_evaluate/components/step/step3.vue @@ -1,19 +1,82 @@