diff --git a/src/modules/18_command/components/Step/View0_Digital.vue b/src/modules/18_command/components/Step/View0_Digital.vue index 8e973cc32..d747a1661 100644 --- a/src/modules/18_command/components/Step/View0_Digital.vue +++ b/src/modules/18_command/components/Step/View0_Digital.vue @@ -11,8 +11,10 @@ import config from "@/app.config"; import type { QTableProps } from "quasar"; import type { DataOption } from "@/modules/18_command/interface/index/Main"; +import type { DataFileDownload } from "@/modules/18_command/interface/response/Main"; import DialogHeader from "@/components/DialogHeader.vue"; +import PerviewPDF from "@/modules/18_command/components/Step/PerviewPDF.vue"; const $q = useQuasar(); const route = useRoute(); @@ -110,20 +112,23 @@ const isCheckOrder = ref(true); //เช็ครอออกคำส const isLoad = ref(false); //แสดงโหลด +const isPersonSign = ref(false); //ผู้มีอำนาจลงนาม + +const modalPerView = ref(false); + /** * ฟังก์ชันยืนยันการส่งให้ผู้มีอำนาจลงนามอนุมัติ */ function onConfirmDraft() { if ( store?.dataCommand?.commandNo !== "" && - store?.dataCommand?.commandAffectDate !== null && store?.dataCommand?.commandExcecuteDate !== null ) { modalSelect.value = true; } else { dialogMessageNotify( $q, - "ไม่สามารถดำเนินการต่อได้ กรุณากรอกเลขที่คำสั่ง วันที่ลงนาม และวันที่คำสั่งมีผลให้ครบ" + "ไม่สามารถดำเนินการต่อได้ กรุณากรอกเลขที่คำสั่ง และวันที่คำสั่งมีผลให้ครบ" ); } } @@ -174,6 +179,7 @@ function onSubmitComment() { function onCloseDialog() { modalSelect.value = false; modalComment.value = false; + isPersonSign.value = false; } async function fetchDoc(group: string) { @@ -253,11 +259,13 @@ async function uploadFileDoc(uploadUrl: string, file: any, group: string) { }); } +const dataFile = ref(); + /** * ดาวน์โหลดลิงก์ไฟล์ * @param fileName file name */ -function downloadFile(file: any, group: string) { +function downloadFile(file: any, group: string, isView: boolean = false) { let type = group === "order" ? "คำสั่ง" : "แนบท้าย"; showLoader(); http @@ -270,8 +278,13 @@ function downloadFile(file: any, group: string) { ) ) .then((res) => { - const data = res.data.downloadUrl; - window.open(data, "_blank"); + const data = res.data; + dataFile.value = data; + if (isView) { + modalPerView.value = true; + } else { + window.open(data.downloadUrl, "_blank"); + } }) .catch((e) => { messageError($q, e); @@ -317,6 +330,17 @@ onMounted(async () => { > คำสั่ง + + ดูไฟล์คำสั่ง + { > เอกสารแนบท้าย + + ดูไฟล์เอกสารแนบท้าย + { icon="mdi-download" @click.prevent="downloadFile(fileTailer, 'tailer')" > - ดาวน์โหลดไฟล์คำสั่ง + ดาวน์โหลดไฟล์แนบท้าย
@@ -650,6 +685,10 @@ onMounted(async () => { + +
+ +
@@ -694,6 +733,11 @@ onMounted(async () => { + +