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 @@