From 8e982af4bc41d8be347e28b263b23751c9fcaf87 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 24 Dec 2024 14:18:34 +0700 Subject: [PATCH 1/3] fix --- .../views/06_appointPromoteMain.vue | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/modules/05_placement/views/06_appointPromoteMain.vue b/src/modules/05_placement/views/06_appointPromoteMain.vue index 8cb31760a..83ac2fc36 100644 --- a/src/modules/05_placement/views/06_appointPromoteMain.vue +++ b/src/modules/05_placement/views/06_appointPromoteMain.vue @@ -83,9 +83,7 @@ const columns = ref([ format(val, row) { return `${ row.firstName - ? `${row.prefix ?? ""}${row.firstName ?? ""} ${ - row.lastName ?? "" - }` + ? `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}` : "-" }`; }, @@ -317,22 +315,23 @@ onMounted(async () => {
-
- - ส่งไปออกคำสั่งแต่งตั้ง-เลื่อน-ย้าย - +
+
+ + ส่งไปออกคำสั่งแต่งตั้ง-เลื่อน-ย้าย + +
{ :options="columns" option-value="name" style="min-width: 140px" - class="col-xs-12 col-sm-3 col-md-2 q-ml-sm" />
From 8df59017dbed2869b3e35eca4164d2267220b8f3 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 24 Dec 2024 15:05:24 +0700 Subject: [PATCH 2/3] =?UTF-8?q?fix=20=E0=B9=82=E0=B8=AB=E0=B8=A5=E0=B8=94?= =?UTF-8?q?=E0=B9=84=E0=B8=9F=E0=B8=A5=E0=B9=8C=20=20=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=A5=E0=B8=B0=E0=B9=80=E0=B8=AD=E0=B8=B5=E0=B8=A2?= =?UTF-8?q?=E0=B8=94=E0=B8=84=E0=B8=B3=E0=B8=A3=E0=B9=89=E0=B8=AD=E0=B8=87?= =?UTF-8?q?=E0=B8=82=E0=B8=AD=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/requestEdit/Page01_Detail.vue | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue b/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue index 01456479f..0fd35dba6 100644 --- a/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue +++ b/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue @@ -156,6 +156,7 @@ function classInput(val: boolean) { const checkFile = ref(null); // เช็คไฟล์อัปโหลด null ค่าเริ่มต้น, false ไม่มีไฟล์, "img" รูปภาพ, "doc" เอกสาร const urlDownload = ref(""); // url ไฟล์อัปโหลด +const fileDownloadName = ref(""); /** * function หาชื่อไฟล์ * @param id รายการยื่นคำร้องขอแก้ไขข้อมูล @@ -196,8 +197,9 @@ async function downloadUrl(id: string, fileName: string) { fileName ) ) - .then((res) => { + .then(async (res) => { urlDownload.value = res.data.downloadUrl; + fileDownloadName.value = res.data.fileName; if (dataRequest.value.topic == "ขอแก้ไขรูปภาพประจำตัว") { checkFile.value = "img"; } else { @@ -254,6 +256,34 @@ function fetchCheckIsofficer() { } } +async function onDownloadFil() { + try { + // ดึงข้อมูลไฟล์จาก URL + const response = await fetch(urlDownload.value); + + if (!response.ok) { + throw new Error("ไม่สามารถดาวน์โหลดไฟล์ได้"); + } + + // แปลงไฟล์เป็น Blob + const blob = await response.blob(); + + // สร้าง URL ชั่วคราว + const url = URL.createObjectURL(blob); + + // สร้าง เพื่อบังคับดาวน์โหลด + const link = document.createElement("a"); + link.href = url; + link.download = fileDownloadName.value; + link.click(); + + // ลบ URL ชั่วคราวเพื่อประหยัดหน่วยความจำ + URL.revokeObjectURL(url); + } catch (error) { + console.error("เกิดข้อผิดพลาด:", error); + } +} + onMounted(async () => { await Promise.all([fetchDataRequest(), fetchCheckIsofficer()]); }); @@ -402,11 +432,16 @@ onMounted(async () => { icon="mdi-download" dense flat - :label="checkFile == 'img' ? 'ดาวน์โหลดรูปภาพประจำตัว':'ดาวน์โหลดเอกสารหลักฐาน'" + :label=" + checkFile == 'img' + ? 'ดาวน์โหลดรูปภาพประจำตัว' + : 'ดาวน์โหลดเอกสารหลักฐาน' + " color="blue" - :href="urlDownload" - target="_blank" + @click="onDownloadFil" /> + +
From 0feef52cbc0905d6b8f5d29adc1e37a2b3bcdd2e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 24 Dec 2024 15:05:41 +0700 Subject: [PATCH 3/3] no message --- .../04_registryPerson/components/requestEdit/Page01_Detail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue b/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue index 0fd35dba6..36ffd9a6a 100644 --- a/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue +++ b/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue @@ -302,7 +302,7 @@ onMounted(async () => { class="q-mr-sm" @click="router.go(-1)" /> - รายละเอียดคำร้องขอแก้ไขทะเบียนประวัติของ{{ dataRequest.fullname }} + รายละเอียดคำร้องขอแก้ไขทะเบียนประวัติ {{ dataRequest.fullname }}