Merge branch 'nice' into develop
This commit is contained in:
commit
9a76465f78
2 changed files with 24 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
interface attachments {
|
||||
name: string;
|
||||
url: string;
|
||||
isReport: boolean;
|
||||
}
|
||||
interface ResponseInbox {
|
||||
body: string;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import genReport from "@/plugins/genreport";
|
||||
|
||||
import PopupReplyInbox from "@/components/Dialogs/PopupReplyInbox.vue";
|
||||
import type {
|
||||
|
|
@ -90,7 +91,6 @@ const deleteData = (id: string) => {
|
|||
dialogRemove($q, () => removeData(id));
|
||||
};
|
||||
|
||||
//รอ api ลบ
|
||||
const removeData = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -114,8 +114,24 @@ const removeData = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
const fileOpen = (url: string) => {
|
||||
window.open(url, "_blank");
|
||||
const fileOpen = (url: string, isReport: boolean, fileName: string) => {
|
||||
if (isReport) {
|
||||
showLoader();
|
||||
http
|
||||
.get(url)
|
||||
.then(async (res) => {
|
||||
const data = res.data;
|
||||
await genReport(data, fileName, "pdf");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
// Dialog Reply
|
||||
|
|
@ -347,7 +363,10 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
|
|||
v-for="(link, num) in d.payload.attachments"
|
||||
:key="num"
|
||||
>
|
||||
<q-item clickable @click="fileOpen(link.url)">
|
||||
<q-item
|
||||
clickable
|
||||
@click="fileOpen(link.url, link.isReport, link.name)"
|
||||
>
|
||||
<q-item-section>{{ link.name }}</q-item-section>
|
||||
</q-item>
|
||||
<q-separator />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue