From de6ed189bddef67b144fbd994f7d5d8399dcb703 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 9 Sep 2025 09:51:05 +0700 Subject: [PATCH 1/3] fix: download xlsx new api --- src/api/recruiting/api.recruit.ts | 1 + .../03_recruiting/views/01_compete/Period.vue | 38 ++++++++++++++----- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/api/recruiting/api.recruit.ts b/src/api/recruiting/api.recruit.ts index c67ee9d65..bc2344e66 100644 --- a/src/api/recruiting/api.recruit.ts +++ b/src/api/recruiting/api.recruit.ts @@ -47,6 +47,7 @@ export default { exportCandidateListNew: (id: string) => `${recruit_report}candidate-new/${id}`, + reportCandidateListNew: (id: string) => `${recruit}report/candidate-new/${id}`, examReport: (id: string,no:string) => `${recruit}report/exam/${id}/${no}`, }; diff --git a/src/modules/03_recruiting/views/01_compete/Period.vue b/src/modules/03_recruiting/views/01_compete/Period.vue index 0c182fd7b..21cafa6e6 100644 --- a/src/modules/03_recruiting/views/01_compete/Period.vue +++ b/src/modules/03_recruiting/views/01_compete/Period.vue @@ -248,11 +248,34 @@ async function clickPassExam(id: string) { async function clickCandidateList(id: string) { showLoader(); await http - .get(config.API.exportCandidateListNew(id)) + .get(config.API.reportCandidateListNew(id), { + headers: { + accept: + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "content-Type": "application/json", + }, + + responseType: "blob", + }) .then(async (res) => { - const data = res.data.result; - data.reportName = `CandidateList`; - await genReport(data, "รายชื่อผู้มีสิทธิ์สอบ", "pdf"); + const data = res.data; + if (data) { + // สร้าง Blob จาก array buffer + const blob = new Blob([data]); + + // สร้าง URL สำหรับไฟล์ Blob + const url = URL.createObjectURL(blob); + + // สร้างลิงก์เพื่อดาวน์โหลดไฟล์ + const link = document.createElement("a"); + link.href = url; + link.download = `CandidateList.xlsx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด + document.body.appendChild(link); + link.click(); + + // ลบ URL ที่สร้างขึ้นหลังจากใช้งาน + URL.revokeObjectURL(url); + } }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -705,9 +728,7 @@ onMounted(async () => { " > - นำเข้าไฟล์ผลการสอบ (บัญชีรายชื่อ) + นำเข้าไฟล์ผลการสอบ (บัญชีรายชื่อ)
{{ props.row.score.resultCount }} @@ -722,8 +743,7 @@ onMounted(async () => { icon="mdi-file-excel-outline" > นำเข้าไฟล์ผลการสอบ (บัญชีรายชื่อ) - อีกครั้งนำเข้าไฟล์ผลการสอบ (บัญชีรายชื่อ) อีกครั้ง From 2f6282d1dde634aa944619c60b733d5f79e9df3c Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 9 Sep 2025 10:00:26 +0700 Subject: [PATCH 2/3] fix: check nodeId --- src/modules/05_placement/interface/response/OhterMain.ts | 1 + src/modules/05_placement/views/08_otherMain.vue | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/05_placement/interface/response/OhterMain.ts b/src/modules/05_placement/interface/response/OhterMain.ts index 2c2bff31e..6805c0883 100644 --- a/src/modules/05_placement/interface/response/OhterMain.ts +++ b/src/modules/05_placement/interface/response/OhterMain.ts @@ -24,6 +24,7 @@ interface listMain { positionDate: Date; leaveDate: Date; id: string; + nodeId: string; } //ข้อมูลจาก api interface listMainAPI { diff --git a/src/modules/05_placement/views/08_otherMain.vue b/src/modules/05_placement/views/08_otherMain.vue index 68dd96bd2..dfc117935 100644 --- a/src/modules/05_placement/views/08_otherMain.vue +++ b/src/modules/05_placement/views/08_otherMain.vue @@ -195,7 +195,8 @@ async function fecthlistOthet() { e.positionLevelOld && e.positionNumberOld && e.positionDate && - e.leaveDate !== null + e.leaveDate !== null && + e.nodeId !== null ); rows2.value = listData; rows2Data.value = listData; From ab578198865bcb54154cf379d19064e2b7c48b31 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 9 Sep 2025 10:08:03 +0700 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E0=B9=81=E0=B8=81=E0=B9=89=20?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B8=84=E0=B8=99=E0=B8=84=E0=B8=A3=E0=B8=AD=E0=B8=87/=20?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogHistoryPos.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/02_organization/components/DialogHistoryPos.vue b/src/modules/02_organization/components/DialogHistoryPos.vue index 017c504e7..7842de7e9 100644 --- a/src/modules/02_organization/components/DialogHistoryPos.vue +++ b/src/modules/02_organization/components/DialogHistoryPos.vue @@ -102,7 +102,7 @@ const baseColumns = ref([ { name: "position", align: "left", - label: "ตำแแหน่ง", + label: "ตำแหน่งในสายงาน", sortable: true, field: "position", headerStyle: "font-size: 14px", @@ -119,11 +119,11 @@ const baseColumns = ref([ format(val, row) { let name = ""; if (row.posType && row.position) { - name = `${row.posType} (${row.position})`; + name = `${row.posType} (${row.posLevel})`; } else if (row.posType) { name = `${row.posType}`; - } else if (row.position) { - name = `(${row.position})`; + } else if (row.posLevel) { + name = `(${row.posLevel})`; } else name = "-"; return name; }, @@ -213,9 +213,9 @@ function formatHistoryOwnerData(data: HistoryPos[]) { return data.map((item) => ({ ...item, fullname: - item.prefix && item.firstName && item.lastName - ? `${item.prefix} ${item.firstName} ${item.lastName}`.trim() - : "-", + item.firstName + ? `${item.prefix}${item.firstName} ${item.lastName}`.trim() + : "ว่าง", })); }