diff --git a/src/modules/02_organizational/views/MainReport.vue b/src/modules/02_organizational/views/MainReport.vue index 708b18218..38536c94e 100644 --- a/src/modules/02_organizational/views/MainReport.vue +++ b/src/modules/02_organizational/views/MainReport.vue @@ -158,8 +158,8 @@ const clickAccount1 = async () => { // start download a.click(); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); @@ -185,8 +185,8 @@ const clickAccount2 = async () => { // start download a.click(); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); @@ -211,8 +211,8 @@ const clickAccount3 = async () => { // start download a.click(); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); diff --git a/src/modules/03_recruiting/components/TableCandidate.vue b/src/modules/03_recruiting/components/TableCandidate.vue index b274abae8..bd3bc50f7 100644 --- a/src/modules/03_recruiting/components/TableCandidate.vue +++ b/src/modules/03_recruiting/components/TableCandidate.vue @@ -502,8 +502,8 @@ const downloadFile = async () => { const data = res.data; downloadFilePDF(data, `Candidate__${dateToISO(new Date())}.xlsx`); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); @@ -520,8 +520,8 @@ const downloadFileDetail = async () => { const data = res.data; downloadFilePDF(data, `Candidate_Detail_${dateToISO(new Date())}.xlsx`); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); @@ -638,8 +638,8 @@ const downloadFileDashboard = async () => { `Candidate_Dashboard_${dateToISO(new Date())}.xlsx` ); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); diff --git a/src/modules/05_placement/components/Transfer/transferRegistry.vue b/src/modules/05_placement/components/Transfer/transferRegistry.vue index 7d54910cd..cfbcc4e8f 100644 --- a/src/modules/05_placement/components/Transfer/transferRegistry.vue +++ b/src/modules/05_placement/components/Transfer/transferRegistry.vue @@ -84,8 +84,8 @@ const fileDownload = async (no: number, type: string, fileName: string) => { .then(async (res) => { downloadFile(res, `${fileName}.${type}`); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); diff --git a/src/modules/05_placement/components/probation/FormAssign.vue b/src/modules/05_placement/components/probation/FormAssign.vue index c5e502228..69f07140b 100644 --- a/src/modules/05_placement/components/probation/FormAssign.vue +++ b/src/modules/05_placement/components/probation/FormAssign.vue @@ -950,8 +950,8 @@ async function clickdownloadFile(type: string) { `แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}.${type}` ); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue index 0b790a5f3..5ed63fd91 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue @@ -160,8 +160,8 @@ async function clickdownloadFile(type: string) { .then((res) => { downloadFile(res, `แบบรายงานการประเมินฯ_${fullname.value}.${type}`); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); diff --git a/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue b/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue index ccd5499f8..6f8d0988b 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue @@ -37,13 +37,15 @@ const dataRole = ref("mentor"); /** get ข้อมูล มอบหมาย * @param id person id */ -async function fecthAssign(id: string){ +async function fecthAssign(id: string) { showLoader(); await http .get(config.API.formevaluate(id)) .then(async (res: any) => { await fecthdataAssign(res.data.data); - fullname.value = res.data.data.experimentee ? res.data.data.experimentee.name : ""; + fullname.value = res.data.data.experimentee + ? res.data.data.experimentee.name + : ""; dataArrayNumber.value = 1; }) .catch((e: any) => { @@ -52,19 +54,19 @@ async function fecthAssign(id: string){ .finally(() => { hideLoader(); }); -}; +} /** * เปลี่ยน tab * @param tabVal type */ -function changeTab(tabVal: string){ +function changeTab(tabVal: string) { tab.value = tabVal; dataArrayNumber.value = Number(tabVal.charAt(4)); -}; +} /** convert file */ -function downloadFile(response: any, filename: string){ +function downloadFile(response: any, filename: string) { const link = document.createElement("a"); var fileName = filename; link.href = window.URL.createObjectURL(new Blob([response.data])); @@ -72,10 +74,10 @@ function downloadFile(response: any, filename: string){ document.body.appendChild(link); link.click(); document.body.removeChild(link); -}; +} /** download file */ -async function FileDownload(type: string){ +async function FileDownload(type: string) { let numTab = probationStore.evaluate.find( (e: any) => e.no === dataArrayNumber.value ); @@ -92,8 +94,8 @@ async function FileDownload(type: string){ `แบบบันทึกผล(ผู้ดูเเล)_${fullname.value}_ครั้งที่${numTab.no}.${type}` ); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); @@ -111,21 +113,21 @@ async function FileDownload(type: string){ `แบบบันทึกผล(ผู้บังคับบัญชา)_${fullname.value}_ครั้งที่${numTab.no}.${type}` ); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); }); } -}; +} /** ไปหน้า page add */ -function addData(){ +function addData() { router.push( `/probation/detail/addresult/${personalId.value}/${assignId.value}` ); -}; +} onMounted(async () => { await fecthAssign(assignId.value); diff --git a/src/modules/05_placement/components/probation/FormEvaluation/Template1Commader.vue b/src/modules/05_placement/components/probation/FormEvaluation/Template1Commader.vue index a43932fa5..41ee396bc 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/Template1Commader.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/Template1Commader.vue @@ -40,9 +40,9 @@ onMounted(async () => { /** * get data - * @param id person id + * @param id person id */ -async function fecthAssign(id: string){ +async function fecthAssign(id: string) { showLoader(); await http .get(config.API.formevaluateCommander(id)) @@ -59,19 +59,19 @@ async function fecthAssign(id: string){ .finally(() => { hideLoader(); }); -}; +} /** * เปลี่ยน tab - * @param tabVal type + * @param tabVal type */ -function changeTab(tabVal: string){ +function changeTab(tabVal: string) { tab.value = tabVal; dataArrayNumber.value = Number(tabVal.charAt(4)); -}; +} /** เปลี่ยน type file */ -function downloadFile(response: any, filename: string){ +function downloadFile(response: any, filename: string) { const link = document.createElement("a"); var fileName = filename; link.href = window.URL.createObjectURL(new Blob([response.data])); @@ -79,13 +79,13 @@ function downloadFile(response: any, filename: string){ document.body.appendChild(link); link.click(); document.body.removeChild(link); -}; +} /** * download file * @param type type */ -async function FileDownload(type: string){ +async function FileDownload(type: string) { let numTab = probationStore.evaluate.find( (e: any) => e.no === dataArrayNumber.value ); @@ -102,8 +102,8 @@ async function FileDownload(type: string){ `แบบบันทึกผล(ผู้บังคับบัญชา)_${fullname.value}_ครั้งที่${numTab.no}.${type}` ); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); @@ -121,21 +121,21 @@ async function FileDownload(type: string){ `แบบบันทึกผล(ผู้บังคับบัญชา)_${fullname.value}_ครั้งที่${numTab.no}.${type}` ); }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); }) .finally(() => { hideLoader(); }); } -}; +} /** เปลี่ยนหน้า เพิ่ม */ -function addData(){ +function addData() { router.push( `/probation/detail/addevaluacommander/${personalId.value}/${assignId.value}` ); -}; +}