diff --git a/src/modules/12_evaluatePersonal/components/Detail/Stepper.vue b/src/modules/12_evaluatePersonal/components/Detail/Stepper.vue index a5af64aac..e5ed00a81 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/Stepper.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/Stepper.vue @@ -73,7 +73,7 @@ const store = useEvaluateDetailStore(); @@ -82,7 +82,7 @@ const store = useEvaluateDetailStore(); diff --git a/src/modules/12_evaluatePersonal/components/Detail/Tab1.vue b/src/modules/12_evaluatePersonal/components/Detail/Tab1.vue index 530c6c576..43ebc3d92 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/Tab1.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/Tab1.vue @@ -233,7 +233,7 @@ onMounted(() => { diff --git a/src/modules/12_evaluatePersonal/components/Detail/popupHistory.vue b/src/modules/12_evaluatePersonal/components/Detail/popupHistory.vue index e2060e158..1eab54261 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/popupHistory.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/popupHistory.vue @@ -68,6 +68,11 @@ const columns = ref([ const row = ref(); async function fetchListHistory(id: string) { + const thaiOptions: Intl.DateTimeFormatOptions = { + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + }; showLoader(); await http .get(config.API.evaluationHistory(id)) @@ -76,7 +81,9 @@ async function fetchListHistory(id: string) { const list = data.map((e: any) => ({ step: e.step, lastUpdateFullName: e.lastUpdateFullName, - lastUpdatedAt: date2Thai(e.lastUpdatedAt), + lastUpdatedAt: `${date2Thai(e.lastUpdatedAt)} เวลา ${new Date( + e.lastUpdatedAt + ).toLocaleTimeString("th-TH", thaiOptions)} น.`, })); row.value = list; }) diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step2.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step2.vue index ab2c81fdd..7f95bd3bb 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step2.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step2.vue @@ -30,6 +30,8 @@ const formCommand = reactive({ abovelevelFullname: "", abovelevelPosition: "", }); +const author = ref(""); +const subject = ref(""); const elementaryFullNameRef = ref(null); const elementaryPositonRef = ref(null); @@ -105,10 +107,17 @@ function getSigner() { .get(config.API.evaluationSigner(id.value, 1)) .then((res) => { const data = res.data.result; - formCommand.elementaryFullName = data == null ? "" : data.commanderFullname; - formCommand.elementaryPosition = data == null ? "" : data.commanderPosition; - formCommand.abovelevelFullname = data == null ? "" : data.commanderAboveFullname; - formCommand.abovelevelPosition = data == null ? "" : data.commanderAbovePosition; + formCommand.elementaryFullName = + data == null ? "" : data.commanderFullname; + formCommand.elementaryPosition = + data == null ? "" : data.commanderPosition; + formCommand.abovelevelFullname = + data == null ? "" : data.commanderAboveFullname; + formCommand.abovelevelPosition = + data == null ? "" : data.commanderAbovePosition; + + author.value = data.author; + subject.value = data.subject; }) .catch((e) => { messageError($q, e); @@ -527,6 +536,43 @@ onMounted(() => { --> +
+ +
ผลงาน
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue index f5ccfbe03..7d598f2c7 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue @@ -34,7 +34,8 @@ function getFile(volume: number) { .then((res) => { const link = res.data.downloadUrl; const type = res.data.fileType; - getPDF(link,type); + + getPDF(link, type); }) .catch((e) => { // messageError($q, e); @@ -44,7 +45,7 @@ function getFile(volume: number) { }); } -function getPDF(url: string,type:string) { +function getPDF(url: string, type: string) { axios .get(url, { method: "GET", @@ -55,25 +56,26 @@ function getPDF(url: string,type:string) { }, }) .then(async (res) => { - store.log = 0 - console.log(res); + store.log = 0; + store.urlDownloadFile = url; const blob = new Blob([res.data]); const objectUrl = URL.createObjectURL(blob); const pdfData = await usePDF(`${objectUrl}`); showLoader(); setTimeout(() => { - store.log = 1 + store.log = 1; store.pdfSrcStore = pdfData.pdf.value; store.numOfPagesStore = pdfData.pages.value; hideLoader(); }, 1500); - }).catch((e)=>{ - messageError($q,e) }) - .finally(()=>{ - store.log = 0 + .catch((e) => { + messageError($q, e); }) + .finally(() => { + store.log = 0; + }); } function numToThai(val: number) { diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue index fdfed9d63..ba8ad3746 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue @@ -34,6 +34,7 @@ const messenger = ref(""); const title = ref(""); const modalEvaluation = ref(false); const fileEvaluationUpload = ref(); +const fileEvaluationUploadRef = ref(); const status = ref("WAIT_CHECK_DOC_V1"); const files = [ { @@ -153,22 +154,31 @@ function getPDF(url: string, type: string, fileName: string) { /** ส่งไปประกาศบนเว็บไซต์ */ function onWebSite() { - dialogConfirm( - $q, - () => { - showLoader(); - http - .put(config.API.evaluationApproveDoc1(id.value)) - .then((res) => {}) - .catch((e) => {}) - .finally(() => { - success($q, "ส่งไปประกาศบนเว็บไซต์สำเร็จ"); - getStep(); - }); - }, - "ยืนยันการส่งไปประกาศบนเว็บไซต์", - "ยืนยันการส่งไปประกาศบนเว็บไซต์ใช่หรือไม่?" - ); + download10Url.value === "" + ? (fileEvaluationUpload.value = "") + : fileEvaluationUpload.value; + fileEvaluationUploadRef.value.validate(); + if ( + fileEvaluationUploadRef.value.hasError === false && + download10Url.value !== "" + ) { + dialogConfirm( + $q, + () => { + showLoader(); + http + .put(config.API.evaluationApproveDoc1(id.value)) + .then((res) => {}) + .catch((e) => {}) + .finally(() => { + success($q, "ส่งไปประกาศบนเว็บไซต์สำเร็จ"); + getStep(); + }); + }, + "ยืนยันการส่งไปประกาศบนเว็บไซต์", + "ยืนยันการส่งไปประกาศบนเว็บไซต์ใช่หรือไม่?" + ); + } } function getStep() { @@ -210,32 +220,36 @@ function getStep() { }); } -function upLoadFile() { - showLoader(); - http - .post(config.API.evaluationFileListbyId("เล่ม 1", id.value), { - fileList: { - fileName: "10-ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)", - metadata: { - tag: "value", +function upLoadFile(file: any) { + if (file) { + showLoader(); + http + .post(config.API.evaluationFileListbyId("เล่ม 1", id.value), { + fileList: { + fileName: "10-ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)", + metadata: { + tag: "value", + subject: subject.value, + author: author.value, + }, }, - }, - }) - .then((res) => { - const foundKey: any = Object.keys(res.data).find( - (key) => - res.data[key]?.fileName !== undefined && - res.data[key]?.fileName !== "" - ); - const link = res.data[foundKey]?.uploadUrl; - fileUpLoad(link); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); + }) + .then((res) => { + const foundKey: any = Object.keys(res.data).find( + (key) => + res.data[key]?.fileName !== undefined && + res.data[key]?.fileName !== "" + ); + const link = res.data[foundKey]?.uploadUrl; + fileUpLoad(link); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + } } function fileUpLoad(url: string) { @@ -248,7 +262,6 @@ function fileUpLoad(url: string) { messageError($q, e); }) .finally(() => { - fileEvaluationUpload.value = null; checkDoc10(); success($q, "อัปโหลดไฟล์สำเร็จ"); }); @@ -319,8 +332,29 @@ async function fetchProfile() { }); } +const author = ref(""); +const subject = ref(""); + +function fetchDataSigner() { + showLoader(); + http + .get(config.API.evaluationSigner(id.value, 1)) + .then((res) => { + const data = res.data.result; + author.value = data.author; + subject.value = data.subject; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +} + onMounted(() => { checkDoc10(); + fetchDataSigner(); }); @@ -408,6 +442,7 @@ onMounted(() => {
{ hide-bottom-space lazy-rules accept=".pdf" + :rules=" + download10Url === '' + ? [(val) => !!val || 'กรุณาเลือกไฟล์'] + : [] + " >