diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue index 0ca224d95..61e2a997b 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue @@ -82,9 +82,19 @@ async function onClickDowloadFile( { positionLevel: profile.value == null ? "" : profile.value.positionLevel }, { posNo: profile.value == null ? "" : profile.value.posNo }, { oc: profile.value == null ? "" : profile.value.oc }, - { birthDate: profile.value == null ? "" : date2Thai(profile.value.birthDate) }, + { + birthDate: + profile.value == null ? "" : date2Thai(profile.value.birthDate), + }, { govAge: profile.value == null ? "" : profile.value.govAge }, - { positionLevelNew: profile.value == null ? "" : (profile.value.type == "EXPERT"? "ชำนาญการ":"ชำนาญการพิเศษ")}, + { + positionLevelNew: + profile.value == null + ? "" + : profile.value.type == "EXPERT" + ? "ชำนาญการ" + : "ชำนาญการพิเศษ", + }, tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "หน่วยงาน" } : null, @@ -246,24 +256,26 @@ function fileUpLoad(url: string) { } function sentMessenger() { - dialogConfirm($q, () => { - showLoader(); - http - .put(config.API.evaluationSentToContact(id.value), { - subject: title.value, - body: messenger.value, - }) - .then((res) => { - console.log(res); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - modalEvaluation.value = false; - hideLoader(); - }); - }); + // dialogConfirm($q, () => { + showLoader(); + http + .put(config.API.evaluationSentToContact(id.value), { + subject: title.value, + body: messenger.value, + }) + .then((res) => { + title.value = ""; + messenger.value = ""; + success($q, "ส่งข้อความสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + modalEvaluation.value = false; + hideLoader(); + }); + // }); } const download10Url = ref(""); @@ -286,7 +298,7 @@ function checkDoc10() { .finally(() => { hideLoader(); }); - fetchProfile() + fetchProfile(); } async function fetchProfile() { @@ -295,7 +307,7 @@ async function fetchProfile() { .get(config.API.evaluateGetDetail(id.value)) .then((res) => { const data = res.data.result; - profile.value =data + profile.value = data; }) .catch((err) => { messageError($q, err); @@ -358,7 +370,7 @@ onMounted(() => {
-
+
{ onClickDowloadFile( 'เอกสารหมายเลข 10', 'template-4', - 'แบบประเมินคุณลักษณะบุคคล' + 'ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)' ) " > @@ -390,31 +402,34 @@ onMounted(() => { ดูไฟล์เอกสาร
-
- - - -
-
- อัปโหลดไฟล์ + +
+
+ + + +
+
+ อัปโหลดไฟล์ +
diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step5.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step5.vue index 9bd7c0a4d..e7a2a7904 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step5.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step5.vue @@ -171,7 +171,6 @@ function backPage() { } function copyLink(name: string) { - console.log(name); showLoader(); http .get(config.API.evaluationFilebyId("เล่ม 1", id.value, name)) @@ -194,9 +193,9 @@ function getDate() { .then((res) => { const data = res.data.result; AnnouncementStartDate.value = date2Thai(data.dateStartAnnounce); - const endDate = new Date(data.dateStartAnnounce); - endDate.setDate(endDate.getDate() + 30); - AnnouncementEndDate.value = date2Thai(endDate); + // const endDate = new Date(data.dateStartAnnounce); + // endDate.setDate(endDate.getDate() + 30); + AnnouncementEndDate.value = date2Thai(data.dateEndAnnounce); }) .catch((e) => { messageError($q, e); @@ -219,31 +218,31 @@ function getDate() { // }); // } -async function onClickDowloadFile( - tp: string, - templateName: string, - fileName: string -) { - showLoader(); - const data = Object.assign( - { fullName: fullName.value }, - tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "-" } : null, - tp === "EV1_007" ? { positionName: "-" } : null, - tp === "EV1_007" ? { positionLeaveName: "-" } : null - ); - const body = { - template: tp, - reportName: templateName, - data: data, - }; - console.log(body); - await genReport(body, fileName); -} +// async function onClickDowloadFile( +// tp: string, +// templateName: string, +// fileName: string +// ) { +// showLoader(); +// const data = Object.assign( +// { fullName: fullName.value }, +// tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "-" } : null, +// tp === "EV1_007" ? { positionName: "-" } : null, +// tp === "EV1_007" ? { positionLeaveName: "-" } : null +// ); +// const body = { +// template: tp, +// reportName: templateName, +// data: data, +// }; +// console.log(body); +// await genReport(body, fileName); +// } -function onClickViewPDF(file: any) { - // pdfSrc.value = file.webkitRelativePath; - modalView.value = true; -} +// function onClickViewPDF(file: any) { +// // pdfSrc.value = file.webkitRelativePath; +// modalView.value = true; +// } const download10Url = ref(""); function checkDocResult() { @@ -304,6 +303,16 @@ onMounted(() => {
+ { >
-
- - - -
-
- อัปโหลดไฟล์ +
+
+ + + +
+
+ อัปโหลดไฟล์ +
diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step6.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step6.vue index 5681b80fd..a8a6c12a5 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step6.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step6.vue @@ -43,12 +43,10 @@ function getDate() { .get(config.API.evaluationDateAnnounce(id.value)) .then((res) => { const data = res.data.result; - const endDate = new Date(data.dateStartAnnounce); - endDate.setDate(endDate.getDate() + 210); + const endDate = new Date(data.dateEndAnnounce); + endDate.setDate(endDate.getDate() + 180); dateEndPrepareDoc2.value = date2Thai(endDate); - dateEndPrepareDoc2.value = data.dateEndPrepareDoc2 - ? date2Thai(data.dateEndPrepareDoc2) - : dateEndPrepareDoc2.value; + // dateEndPrepareDoc2.value = dateEndPrepareDoc2.value; }) .catch((e) => { messageError($q, e); @@ -69,9 +67,9 @@ function getSigner() { formCommand.abovelevelFullname = data.commanderAboveFullnameDoc2; formCommand.abovelevelPosition = data.commanderAbovePositionDoc2; }) - .catch((e) => { - messageError($q, e); - }) + // .catch((e) => { + // messageError($q, e); + // }) .finally(() => { hideLoader(); }); diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step8.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step8.vue index efe050d85..db2924f81 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step8.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step8.vue @@ -50,9 +50,19 @@ async function onClickDowloadFile( { positionLevel: profile.value == null ? "" : profile.value.positionLevel }, { posNo: profile.value == null ? "" : profile.value.posNo }, { oc: profile.value == null ? "" : profile.value.oc }, - { birthDate: profile.value == null ? "" : date2Thai(profile.value.birthDate) }, + { + birthDate: + profile.value == null ? "" : date2Thai(profile.value.birthDate), + }, { govAge: profile.value == null ? "" : profile.value.govAge }, - { positionLevelNew: profile.value == null ? "" : (profile.value.type == "EXPERT"? "ชำนาญการ":"ชำนาญการพิเศษ")} + { + positionLevelNew: + profile.value == null + ? "" + : profile.value.type == "EXPERT" + ? "ชำนาญการ" + : "ชำนาญการพิเศษ", + } ); const body = { @@ -96,6 +106,7 @@ function upLoadFile(name: string, file: any) { messageError($q, e); }) .finally(() => { + downloadFileList(name); hideLoader(); }); } @@ -120,67 +131,84 @@ function fileUpLoad(url: string, file: any) { }); } -function downloadFile() { +// const fileEdit2 = ref(""); +// function downloadFile() { +// showLoader(); +// http +// .get( +// config.API.evaluationFilebyId( +// "เล่ม 2", +// id.value, +// "2-เอกสารเล่ม 2 (ฉบับแก้ไข)" +// ) +// ) +// .then((res) => { +// fileEdit2.value = res.data.downloadUrl; +// const link = res.data.downloadUrl; +// const type = res.data.fileType; +// const fileName = res.data.fileName; +// getPDF(link, type, fileName); +// }) +// .catch((e) => {}) +// .finally(() => { +// hideLoader(); +// }); +// } + +// function getPDF(url: string, type: string, fileName: string) { +// axios +// .get(url, { +// method: "GET", +// responseType: "blob", +// headers: { +// "Content-Type": "application/json", +// Accept: type, // ถ้ามีการระบุเมื่ออัปโหลด +// }, +// }) +// .then(async (res) => { +// console.log(res); +// const a = document.createElement("a"); +// a.href = window.URL.createObjectURL(res.data); +// a.download = fileName; +// // a.download = res.data.fileName + `.${mime.getExtension(res.data.fileType)}` +// a.click(); +// }) +// .catch((e) => {}) +// .finally(() => {}); +// } + +function confirmApprove() { + const data = { + metadata: { + additionalProp1: nameOfWork.value, + additionalProp2: nameOfOwner.value, + additionalProp3: position.value, + }, + }; showLoader(); http - .get(config.API.evaluationFilebyId("เล่ม 2", id.value, '2-เอกสารเล่ม 2 (ฉบับแก้ไข)')) + .patch( + config.API.evaluationPatchData( + "เล่ม 2", + id.value, + "2-เอกสารเล่ม 2 (ฉบับแก้ไข)" + ), + data + ) .then((res) => { - const link = res.data.downloadUrl; - const type = res.data.fileType; - const fileName = res.data.fileName; - getPDF(link, type, fileName); + console.log(res); + }) + .catch((e) => { + messageError($q, e); }) - .catch((e) => {}) .finally(() => { + nextStep(); + modalConfirm.value = false; hideLoader(); }); } -function getPDF(url: string, type: string, fileName: string) { - axios - .get(url, { - method: "GET", - responseType: "blob", - headers: { - "Content-Type": "application/json", - Accept: type, // ถ้ามีการระบุเมื่ออัปโหลด - }, - }) - .then(async (res) => { - console.log(res); - const a = document.createElement("a"); - a.href = window.URL.createObjectURL(res.data); - a.download = fileName; - // a.download = res.data.fileName + `.${mime.getExtension(res.data.fileType)}` - a.click(); - }) - .catch((e) => {}) - .finally(() => {}); -} - -function confirmApprove(){ - const data = { - metadata: { - additionalProp1: nameOfWork.value, - additionalProp2: nameOfOwner.value, - additionalProp3: position.value, - }, - } - showLoader() - http - .patch(config.API.evaluationPatchData('เล่ม 2',id.value,'2-เอกสารเล่ม 2 (ฉบับแก้ไข)'),data) - .then((res)=>{ - console.log(res) - }).catch((e)=>{ - messageError($q,e) - }).finally(()=>{ - nextStep(); - modalConfirm.value = false - hideLoader() - }) -} - -function nextStep(){ +function nextStep() { showLoader(); http .put(config.API.evaluationNextFinish(id.value)) @@ -202,7 +230,7 @@ async function fetchProfile() { .get(config.API.evaluateGetDetail(id.value)) .then((res) => { const data = res.data.result; - profile.value =data + profile.value = data; }) .catch((err) => { messageError($q, err); @@ -212,9 +240,75 @@ async function fetchProfile() { }); } -onMounted(()=>{ - fetchProfile() -}) +const downloadDocEditUrl = ref(""); +function checkDocEdit() { + showLoader(); + http + .get( + config.API.evaluationPatchData( + "เล่ม 2", + id.value, + "2-เอกสารเล่ม 2 (ฉบับแก้ไข)" + ) + ) + .then((res: any) => { + downloadDocEditUrl.value = res.data.downloadUrl; + }) + // .catch((e) => { + // messageError($q, e); + // }) + .finally(() => { + hideLoader(); + }); +} + +const downloadFile1 = ref(""); +const downloadFile2 = ref(""); +const downloadFile3 = ref(""); +const downloadFile4 = ref(""); +const downloadFile5 = ref(""); +const downloadFile6 = ref(""); +async function downloadFileList(fileName: string) { + showLoader(); + await http + .get(config.API.evaluationFilebyId("เล่ม 2", id.value, fileName)) + .then((res) => { + console.log(res.data); + if ( + fileName === + "แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)" + ) { + downloadFile1.value = res.data.downloadUrl; + } else if (fileName === "บัญชีแสดงการรับ-ส่งผลงาน (เอกสารหมายเลข 15)") { + downloadFile2.value = res.data.downloadUrl; + } else if (fileName === "แบบประเมินผลงาน (เอกสารหมายเลข 16)") { + downloadFile3.value = res.data.downloadUrl; + } else if (fileName === "แบบแสดงการประเมินผลงาน (เอกสารหมายเลข 17)") { + downloadFile4.value = res.data.downloadUrl; + } else if (fileName === "แบบรายงานผลการประเมินบุคคล (เอกสารหมายเลข 18)") { + downloadFile5.value = res.data.downloadUrl; + } else if (fileName === "แบบสรุปผลการประเมิน (เอกสารแบบ ง)") { + downloadFile6.value = res.data.downloadUrl; + } + }) + .finally(() => { + hideLoader(); + }); +} + +onMounted(() => { + fetchProfile(); + downloadFileList( + "แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)" + ); + downloadFileList("บัญชีแสดงการรับ-ส่งผลงาน (เอกสารหมายเลข 15)"); + downloadFileList("แบบประเมินผลงาน (เอกสารหมายเลข 16)"); + downloadFileList("แบบแสดงการประเมินผลงาน (เอกสารหมายเลข 17)"); + downloadFileList("แบบรายงานผลการประเมินบุคคล (เอกสารหมายเลข 18)"); + downloadFileList("แบบสรุปผลการประเมิน (เอกสารแบบ ง)"); + + checkDocEdit(); +});