From 04476043a4163efafea36079abc5d47c39b9727c Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 11 Feb 2026 13:06:54 +0700 Subject: [PATCH 1/8] refactor(command):perview cover attachment --- .../18_command/components/Step/4_Attached.vue | 220 +++++++++++++----- 1 file changed, 156 insertions(+), 64 deletions(-) diff --git a/src/modules/18_command/components/Step/4_Attached.vue b/src/modules/18_command/components/Step/4_Attached.vue index 2236b6fea..8b8b210aa 100644 --- a/src/modules/18_command/components/Step/4_Attached.vue +++ b/src/modules/18_command/components/Step/4_Attached.vue @@ -1,5 +1,5 @@ @@ -431,4 +423,24 @@ watch( border: 1px solid #e9eaec; background-color: #e9eaec61; } + +/* สไตล์เพื่อให้ PDF ดูเหมือนวางบนโต๊ะ */ +.pdf-viewer-wrapper { + background-color: white; + width: 100%; + max-width: 900px; /* จำกัดความกว้างเพื่อความสวยงามบนจอใหญ่ */ + transition: all 0.3s ease; +} + +/* ปรับแต่ง Scrollbar ให้ดูสะอาดตา */ +.scroll::-webkit-scrollbar { + width: 8px; +} +.scroll::-webkit-scrollbar-thumb { + background: #bdbdbd; + border-radius: 4px; +} +.scroll::-webkit-scrollbar-thumb:hover { + background: #9e9e9e; +} From 3d5405d676238528e56e7ed463e6ccba748921ce Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 12 Feb 2026 10:13:38 +0700 Subject: [PATCH 4/8] fix: --- .../components/DialogPreviewCommand.vue | 40 +++---- .../18_command/components/Step/4_Attached.vue | 100 +++++------------- .../18_command/components/Step/PerviewPDF.vue | 82 -------------- 3 files changed, 47 insertions(+), 175 deletions(-) diff --git a/src/modules/18_command/components/DialogPreviewCommand.vue b/src/modules/18_command/components/DialogPreviewCommand.vue index 23d4b86a7..7c8fbab72 100644 --- a/src/modules/18_command/components/DialogPreviewCommand.vue +++ b/src/modules/18_command/components/DialogPreviewCommand.vue @@ -174,6 +174,27 @@ async function fetchPDF(data: any, type: string = "docx?folder=command") { }); } +/** Navigate to previous page*/ +function goToPreviousPage() { + if (canGoPrevious.value) { + page.value--; + } +} + +/** Navigate to next page*/ +function goToNextPage() { + if (canGoNext.value) { + page.value++; + } +} + +function cleanupObjectUrl() { + if (currentObjectUrl.value) { + URL.revokeObjectURL(currentObjectUrl.value); + currentObjectUrl.value = null; + } +} + watch( () => modal.value, async () => { @@ -188,6 +209,7 @@ watch( hideLoader(); }); } else { + cleanupObjectUrl(); tab.value = "main"; pdfSrc.value = undefined; page.value = 1; @@ -195,24 +217,6 @@ watch( } ); -/** - * Navigate to previous page - */ -function goToPreviousPage() { - if (canGoPrevious.value) { - page.value--; - } -} - -/** - * Navigate to next page - */ -function goToNextPage() { - if (canGoNext.value) { - page.value++; - } -} - /** check tab เมื่อมีการเปลี่ยน tab*/ watch( () => tab.value, diff --git a/src/modules/18_command/components/Step/4_Attached.vue b/src/modules/18_command/components/Step/4_Attached.vue index 8b8b210aa..8ac33c9a0 100644 --- a/src/modules/18_command/components/Step/4_Attached.vue +++ b/src/modules/18_command/components/Step/4_Attached.vue @@ -324,81 +324,31 @@ onMounted(async () => { - - - - - - - - ดาวน์โหลดไฟล์ PDF - - - - - - - - - ดาวน์โหลดไฟล์ Word - - - - - - - - - ดาวน์โหลดไฟล์ xlsx - - - - - + + + ดาวน์โหลดไฟล์ PDF + + + ดาวน์โหลดไฟล์ DOCX + + + ดาวน์โหลดไฟล์ XLSX + + diff --git a/src/modules/18_command/components/Step/PerviewPDF.vue b/src/modules/18_command/components/Step/PerviewPDF.vue index 7c4c65620..b242237f8 100644 --- a/src/modules/18_command/components/Step/PerviewPDF.vue +++ b/src/modules/18_command/components/Step/PerviewPDF.vue @@ -175,88 +175,6 @@ watch(modal, (val) => { ดาวน์โหลดไฟล์ PDF - - - - From d4ee563d0d9742444791574a3b6b37ebdfede699 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 12 Feb 2026 10:20:02 +0700 Subject: [PATCH 5/8] fix:delete file Dialog1_Perview.vue --- .../18_command/components/Step/1_Detail.vue | 7 - .../components/Step/Dialog1_Perview.vue | 156 ------------------ 2 files changed, 163 deletions(-) delete mode 100644 src/modules/18_command/components/Step/Dialog1_Perview.vue diff --git a/src/modules/18_command/components/Step/1_Detail.vue b/src/modules/18_command/components/Step/1_Detail.vue index 7123edad6..ddab5c0ef 100644 --- a/src/modules/18_command/components/Step/1_Detail.vue +++ b/src/modules/18_command/components/Step/1_Detail.vue @@ -11,7 +11,6 @@ import { useCommandDetail } from "@/modules/18_command/store/DetailStore"; import type { FormDataDetail } from "@/modules/18_command/interface/request/Main"; import type { DataOperators } from "@/modules/18_command/interface/response/Main"; -import DialogPerview from "@/modules/18_command/components/Step/Dialog1_Perview.vue"; import Dialog1_AddOperator from "@/modules/18_command/components/Step/Dialog1_AddOperetor.vue"; const $q = useQuasar(); @@ -55,7 +54,6 @@ let formData = reactive({ }); const commandVolume = ref(""); //เล่มที่ const commandChapter = ref(""); //ตอนที่ -const modalPreview = ref(false); //แสดงตัวอย่าง const isIdofficer = ref(false); //เช็ค สกจ. const rows = ref>([]); @@ -632,11 +630,6 @@ onMounted(async () => { - - -import { onMounted, ref, watch } from "vue"; -import { useQuasar } from "quasar"; -import { VuePDF, usePDF } from "@tato30/vue-pdf"; -import axios from "axios"; - -import http from "@/plugins/http"; -import config from "@/app.config"; - -import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api"; - -import DialogHeader from "@/components/DialogHeader.vue"; - -import { useCounterMixin } from "@/stores/mixin"; - -const $q = useQuasar(); -const { showLoader, hideLoader, messageError } = useCounterMixin(); - -const modal = defineModel("modal", { required: true }); -const dataTemplateDetail = defineModel("dataTemplateDetail", { - required: true, -}); - -const pdfSrc = ref(); -const numOfPages = ref(0); -const page = ref(1); -const vuePDFRef = ref(null); - -async function fetchPDF(type: string = "docx") { - showLoader(); - await axios - .post( - config.API.reportTemplate + `/${type}`, - { - template: "command_test", - reportName: "docx-report", - data: { - commandNo: dataTemplateDetail.value.commandNo, // - commandYear: dataTemplateDetail.value.commandYear, // - commandTitle: "นาย", - detailHeader: dataTemplateDetail.value.detailHeader, // - detailBody: dataTemplateDetail.value.detailBody, // - detailFooter: dataTemplateDetail.value.detailFooter, // - commandDate: "", - name: "Chief Technology Officer", - position: "Chief Technology Officer", - issue: dataTemplateDetail.value.issue, // - }, - }, - { - headers: { - accept: "application/pdf", - "content-Type": "application/json", - }, - responseType: "blob", - } - ) - .then(async (res) => { - const blob = new Blob([res.data]); - const objectUrl = URL.createObjectURL(blob); - const pdfData = usePDF(`${objectUrl}`); - setTimeout(() => { - pdfSrc.value = pdfData.pdf.value; - numOfPages.value = pdfData.pages.value; - hideLoader(); - }, 1500); - }) - .catch((e) => { - messageError($q, e); - hideLoader(); - }); -} - -function onClose() { - modal.value = false; - pdfSrc.value = undefined; - page.value = 1 -} - -watch(modal, () => { - modal.value && fetchPDF(); -}); - - - - - From b8ad7203cae5436e6f522f9875df10ec199b2818 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 12 Feb 2026 10:23:49 +0700 Subject: [PATCH 6/8] fix: --- .../components/DialogPreviewCommand.vue | 66 ------------------- 1 file changed, 66 deletions(-) diff --git a/src/modules/18_command/components/DialogPreviewCommand.vue b/src/modules/18_command/components/DialogPreviewCommand.vue index 7c8fbab72..d0072270c 100644 --- a/src/modules/18_command/components/DialogPreviewCommand.vue +++ b/src/modules/18_command/components/DialogPreviewCommand.vue @@ -318,72 +318,6 @@ watch( ดาวน์โหลดไฟล์ PDF - - - From ca7e5b247e805d8689452ff7fadfb17f5e2a8a7f Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 12 Feb 2026 13:06:43 +0700 Subject: [PATCH 7/8] fix:evaluate --- .../components/Detail/step/step3.vue | 2 +- .../components/Detail/viewstep/viewPDF.vue | 75 ++++++++++++++++++- .../components/Detail/viewstep/viewStep3.vue | 34 ++++++--- .../components/Detail/viewstep/viewStep7.vue | 32 +++++--- .../store/EvaluateDetail.ts | 2 + 5 files changed, 123 insertions(+), 22 deletions(-) diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue index f061ad143..e078fb23a 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step3.vue @@ -94,7 +94,7 @@ async function getPDF(url: string, type: string) { store.urlDownloadFile = url; const blob = new Blob([res.data]); const objectUrl = URL.createObjectURL(blob); - + store.currentObjectUrl = objectUrl; const pdfData = await usePDF(`${objectUrl}`); setTimeout(() => { store.log = 1; diff --git a/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewPDF.vue b/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewPDF.vue index c4110d1d2..421385123 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewPDF.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewPDF.vue @@ -1,5 +1,5 @@ - + diff --git a/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep3.vue b/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep3.vue index 2afa8c014..5a35b2677 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep3.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep3.vue @@ -10,7 +10,7 @@ import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/Eval /** use*/ const store = useEvaluateDetailStore(); -const modalPerview = ref(false); //แสดง Popup เอกสาร +const modalPerview = ref(false); //แสดง Popup เอกสาร - diff --git a/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep7.vue b/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep7.vue index 7f5e1a28f..28ff29b41 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep7.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep7.vue @@ -42,17 +42,31 @@ const modalPerview = ref(false);
- - - - - + + + - - - + - + diff --git a/src/modules/12_evaluatePersonal/store/EvaluateDetail.ts b/src/modules/12_evaluatePersonal/store/EvaluateDetail.ts index 2a55289aa..ddd12f85c 100644 --- a/src/modules/12_evaluatePersonal/store/EvaluateDetail.ts +++ b/src/modules/12_evaluatePersonal/store/EvaluateDetail.ts @@ -30,6 +30,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => { const urlDownloadFile = ref(""); const pdfSrcStore = ref(); const numOfPagesStore = ref(); + const currentObjectUrl = ref(null); /** คอลัมน์ ใบอนุญาตประกอบวิชาชีพ*/ const columnsCertificates = ref([ @@ -423,6 +424,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => { columnExperience, pdfSrcStore, + currentObjectUrl, urlDownloadFile, numOfPagesStore, log, From 559b03c2f06369f7eb16bd49390f46e688b6fb33 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 13 Feb 2026 14:46:51 +0700 Subject: [PATCH 8/8] fix:call API --- .../components/DialogPreviewCommand.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/modules/18_command/components/DialogPreviewCommand.vue b/src/modules/18_command/components/DialogPreviewCommand.vue index d0072270c..64e10f9bb 100644 --- a/src/modules/18_command/components/DialogPreviewCommand.vue +++ b/src/modules/18_command/components/DialogPreviewCommand.vue @@ -135,8 +135,24 @@ async function fetchDataCommand(type: string) { dataAttachment.value = data; } }) - .catch((e) => { - messageError($q, e); + .catch(async (e) => { + if (type !== "cover") { + try { + const res = await http.get( + config.API.fileByFile( + "ระบบออกคำสั่ง", + newType, + commandId.value, + newType + ) + ); + dataAttachment.value = res.data; + } catch (error) { + messageError($q, e); + } + } else { + messageError($q, e); + } }) .finally(() => { hideLoader();