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 @@ diff --git a/src/modules/06_evaluate/components/viewstep/popupHistory.vue b/src/modules/06_evaluate/components/viewstep/popupHistory.vue index fe1c8b9..e2060e1 100644 --- a/src/modules/06_evaluate/components/viewstep/popupHistory.vue +++ b/src/modules/06_evaluate/components/viewstep/popupHistory.vue @@ -38,29 +38,29 @@ const columns = ref([ style: "font-size: 14px", }, { - name: "Step", + name: "step", align: "left", label: "การแก้ไข", sortable: true, - field: "Step", + field: "step", headerStyle: "font-size: 14px", style: "font-size: 14px", }, { - name: "LastUpdateFullName", + name: "lastUpdateFullName", align: "left", label: "ผู้ดำเนินการ", sortable: true, - field: "LastUpdateFullName", + field: "lastUpdateFullName", headerStyle: "font-size: 14px", style: "font-size: 14px", }, { - name: "LastUpdatedAt", + name: "lastUpdatedAt", align: "left", label: "วันที่แก้ไข", sortable: true, - field: "LastUpdatedAt", + field: "lastUpdatedAt", headerStyle: "font-size: 14px", style: "font-size: 14px", }, @@ -74,9 +74,9 @@ async function fetchListHistory(id: string) { .then((res) => { const data = res.data.result; const list = data.map((e: any) => ({ - Step: e.Step, - LastUpdateFullName: e.LastUpdateFullName, - LastUpdatedAt: date2Thai(e.LastUpdatedAt), + step: e.step, + lastUpdateFullName: e.lastUpdateFullName, + lastUpdatedAt: date2Thai(e.lastUpdatedAt), })); row.value = list; }) diff --git a/src/modules/06_evaluate/components/viewstep/viewPDF.vue b/src/modules/06_evaluate/components/viewstep/viewPDF.vue index 81faa83..1df850a 100644 --- a/src/modules/06_evaluate/components/viewstep/viewPDF.vue +++ b/src/modules/06_evaluate/components/viewstep/viewPDF.vue @@ -1,5 +1,42 @@ @@ -27,7 +99,7 @@ const { @@ -35,14 +107,14 @@ const { @@ -55,7 +127,7 @@ const { @@ -63,7 +135,7 @@ const { @@ -71,7 +143,7 @@ const { @@ -79,7 +151,7 @@ const { @@ -88,7 +160,7 @@ const { @@ -97,7 +169,7 @@ const { @@ -106,7 +178,7 @@ const { diff --git a/src/modules/06_evaluate/components/viewstep/viewStep3.vue b/src/modules/06_evaluate/components/viewstep/viewStep3.vue index c83e2d6..57f7efb 100644 --- a/src/modules/06_evaluate/components/viewstep/viewStep3.vue +++ b/src/modules/06_evaluate/components/viewstep/viewStep3.vue @@ -2,6 +2,13 @@ import ViewPDF from "@/modules/06_evaluate/components/viewstep/viewPDF.vue"; import { useEvaluateStore } from "@/modules/06_evaluate/store"; +const props = defineProps({ + pdfSrc: { + type: String, + }, +}); + + const store = useEvaluateStore(); @@ -9,24 +16,24 @@ const store = useEvaluateStore(); - + - + - + - + - + - + diff --git a/src/modules/06_evaluate/store.ts b/src/modules/06_evaluate/store.ts index fac1525..11efe15 100644 --- a/src/modules/06_evaluate/store.ts +++ b/src/modules/06_evaluate/store.ts @@ -4,7 +4,7 @@ import { ref } from "vue"; export const useEvaluateStore = defineStore("evaluateStore", () => { const tabMenu = ref("1"); const showLoadStatus = ref(false); - const step = ref(0); + const step = ref(1); const currentStep = ref(1); const title = ref([ "ตรวจสอบคุณสมบัติ", diff --git a/src/modules/06_evaluate/stores/evaluationFunction.ts b/src/modules/06_evaluate/stores/evaluationFunction.ts index bc3f51b..d31d0c2 100644 --- a/src/modules/06_evaluate/stores/evaluationFunction.ts +++ b/src/modules/06_evaluate/stores/evaluationFunction.ts @@ -14,7 +14,7 @@ const { showLoader, hideLoader, messageError } = mixin; /** function เช็คการยื่นข้อประเมิน*/ async function fetchCheckStatus() { store.showLoadStatus = false; - store.currentStep = 1; + // = 1; showLoader(); await http .get(config.API.evaluationCheckStatus()) @@ -41,27 +41,28 @@ async function fetchCheckStep(id: string) { const data = res.data.result; let step = - data.Step === "CHECK_SPEC" + data.step === "CHECK_SPEC" ? 1 - : data.Step === "PREPARE_DOC_V1" + : data.step === "PREPARE_DOC_V1" ? 2 - : data.Step === "CHECK_DOC_V1" + : data.step === "CHECK_DOC_V1" ? 3 - : data.Step === "WAIT_CHECK_DOC_V1" + : data.step === "WAIT_CHECK_DOC_V1" ? 4 - : data.Step === "ANNOUNCE_WEB" + : data.step === "ANNOUNCE_WEB" ? 5 - : data.Step === "PREPARE_DOC_V2" + : data.step === "PREPARE_DOC_V2" ? 6 - : data.Step === "CHECK_DOC_V2" + : data.step === "CHECK_DOC_V2" ? 7 - : data.Step === "WAIT_CHECK_DOC_V2" + : data.step === "WAIT_CHECK_DOC_V2" ? 8 - : data.Step === "DONE" + : data.step === "DONE" ? 9 : 1; - store.currentStep = step; - store.step = step; + + store.currentStep = 2; + store.step = 2; }) .catch((err) => { messageError($q, err); @@ -69,118 +70,45 @@ async function fetchCheckStep(id: string) { .finally(() => { store.showLoadStatus = true; }); - } else (store.step = 1), (store.showLoadStatus = true); + } else + ((store.step = 1), (store.currentStep = 1)), (store.showLoadStatus = true); } -async function saveEvaluation(body: any) { - const data = { - IsEducationalQft: body.isEducationalQft, - IsGovermantServiceHtr: body.isGovermantServiceHtr, - IsOperatingExp: body.isOperatingExp, - IsMinPeriodOfTenure: body.isMinPeriodOfTenure, - IsHaveSpecificQft: body.isHaveSpecificQft, - IsHaveProLicense: body.isHaveProLicense, - IsHaveMinPeriodOrHoldPos: body.isHaveMinPeriodOrHoldPos, +async function saveEvaluation(formSpec: any, detail: any) { + const form = { + userId: detail.id, + citizenId: detail.citizenId, + prefix: detail.prefix, + fullName: `${detail.firstName} ${detail.lastName}.`, + position: detail.position, + oc: detail.oc, + salary: detail.salary.toString(), + positionLevel: detail.positionLevel, + posNo: detail.posNo, + birthDate: detail.birthDate, + govAge: detail.govAge, + type: "", + step: "", + isEducationalQft: formSpec.isEducationalQft, + isGovermantServiceHtr: formSpec.isGovermantServiceHtr, + isOperatingExp: formSpec.isOperatingExp, + isMinPeriodOfTenure: formSpec.isMinPeriodOfTenure, + isHaveSpecificQft: formSpec.isHaveSpecificQft, + isHaveProLicense: formSpec.isHaveProLicense, + isHaveMinPeriodOrHoldPos: formSpec.isHaveMinPeriodOrHoldPos, + reason: "", + educations: [...detail.educations], + certificates: [...detail.certificates], + salaries: [], + trainings: [...detail.trainings], + assessments: [...detail.assessments], }; - console.log(data); - // const form = { - // UserId: "08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6", - // CitizenId: "1540200054020", - // Prefix: "นางสาว", - // FullName: "สาวิตรี ศรีสมัย", - // Position: "นักทรัพยากรบุคคล", - // Oc: "สำนักปลัดกรุงเทพมหานคร/สำนักงานการเจ้าหน้าที่", - // Salary: "10000", - // PositionLevel: "นักทรัพยากรบุคคล", - // PosNo: "10", - // BirthDate: "string", - // GovAge: "string", - // Type: "string", - // Step: "string", - // IsEducationalQft: true, - // IsGovermantServiceHtr: true, - // IsOperatingExp: true, - // IsMinPeriodOfTenure: true, - // IsHaveSpecificQft: true, - // IsHaveProLicense: true, - // IsHaveMinPeriodOrHoldPos: true, - // Reason: "string", - // Educations: [ - // { - // EducationLevel: "string", - // Institute: "string", - // IsDate: true, - // StartDate: "2023-12-19T03:20:04.460Z", - // EndDate: "2023-12-19T03:20:04.460Z", - // FinishDate: "2023-12-19T03:20:04.460Z", - // IsEducation: true, - // Degree: "string", - // Field: "string", - // FundName: "string", - // Gpa: "string", - // Country: "string", - // Other: "string", - // Duration: "string", - // DurationYear: "string", - // }, - // ], - // Certificates: [ - // { - // Step: "string", - // CertificateType: "string", - // Issuer: "string", - // CertificateNo: "string", - // IssueDate: "2023-12-19T03:20:04.460Z", - // ExpireDate: "2023-12-19T03:20:04.460Z", - // }, - // ], - // Salaries: [ - // { - // Step: "string", - // Date: "2023-12-19T03:20:04.460Z", - // Amount: 0, - // PositionSalaryAmount: 0, - // MouthSalaryAmount: 0, - // Position: "string", - // PosNo: "string", - // SalaryClass: "string", - // SalaryRef: "string", - // RefCommandNo: "string", - // RefCommandDate: "2023-12-19T03:20:04.460Z", - // SalaryStatus: "string", - // }, - // ], - // Trainings: [ - // { - // Name: "string", - // Topic: "string", - // StartDate: "2023-12-19T03:20:04.460Z", - // EndDate: "2023-12-19T03:20:04.460Z", - // Yearly: 0, - // Place: "string", - // Duration: "string", - // Department: "string", - // NumberOrder: "string", - // DateOrder: "2023-12-19T03:20:04.460Z", - // }, - // ], - // Assessments: [ - // { - // Date: "2023-12-19T03:20:04.460Z", - // Point1Total: 0, - // Point1: 0, - // Point2Total: 0, - // Point2: 0, - // PointSumTotal: 0, - // PointSum: 0, - // }, - // ], - // }; + console.log(form); showLoader(); await http - .post(config.API.evaluationCheckspec(), data) + .post(config.API.evaluationCheckspec(), form) .then((res) => { console.log(res); }) diff --git a/src/modules/06_evaluate/views/EvaluateMain.vue b/src/modules/06_evaluate/views/EvaluateMain.vue index 2bd359d..f29e519 100644 --- a/src/modules/06_evaluate/views/EvaluateMain.vue +++ b/src/modules/06_evaluate/views/EvaluateMain.vue @@ -17,8 +17,6 @@ const router = useRouter(); const $q = useQuasar(); const { showLoader, hideLoader, messageError } = mixin; - -onMounted(async () => {}); @@ -57,7 +55,9 @@ onMounted(async () => {}); - + + +