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 - - - -