fix ==> ปุ่มดาวน์โหลดไฟล์คำสั่ง
This commit is contained in:
parent
d95042ba0e
commit
9f3ef65f13
2 changed files with 15 additions and 12 deletions
|
|
@ -11,6 +11,7 @@ import PopupReplyInbox from "@/components/Dialogs/PopupReplyInbox.vue";
|
|||
import type {
|
||||
ResponseInbox,
|
||||
DataInbox,
|
||||
attachments,
|
||||
} from "@/interface/response/dashboard/dashboard";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
|
@ -114,14 +115,18 @@ const removeData = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
const fileOpen = (url: string, isReport: boolean, fileName: string) => {
|
||||
if (isReport) {
|
||||
const fileOpen = async (attachmentsData: attachments) => {
|
||||
if (attachmentsData.isReport) {
|
||||
showLoader();
|
||||
http
|
||||
.get(url)
|
||||
await http
|
||||
.get(attachmentsData.url)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
await genReport(data, fileName, "pdf");
|
||||
const result = res.data;
|
||||
if (attachmentsData.isTemplate) {
|
||||
await genReport(result.result, attachmentsData.name, "pdf");
|
||||
} else {
|
||||
window.open(result.downloadUrl, "_blank");
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -130,7 +135,7 @@ const fileOpen = (url: string, isReport: boolean, fileName: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
window.open(url, "_blank");
|
||||
window.open(attachmentsData.url, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -363,10 +368,7 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
|
|||
v-for="(link, num) in d.payload.attachments"
|
||||
:key="num"
|
||||
>
|
||||
<q-item
|
||||
clickable
|
||||
@click="fileOpen(link.url, link.isReport, link.name)"
|
||||
>
|
||||
<q-item clickable @click="fileOpen(link)">
|
||||
<q-item-section>{{ link.name }}</q-item-section>
|
||||
</q-item>
|
||||
<q-separator />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue