Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-04-03 14:22:19 +07:00
commit 9a76465f78
2 changed files with 24 additions and 4 deletions

View file

@ -1,6 +1,7 @@
interface attachments { interface attachments {
name: string; name: string;
url: string; url: string;
isReport: boolean;
} }
interface ResponseInbox { interface ResponseInbox {
body: string; body: string;

View file

@ -5,6 +5,7 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import genReport from "@/plugins/genreport";
import PopupReplyInbox from "@/components/Dialogs/PopupReplyInbox.vue"; import PopupReplyInbox from "@/components/Dialogs/PopupReplyInbox.vue";
import type { import type {
@ -90,7 +91,6 @@ const deleteData = (id: string) => {
dialogRemove($q, () => removeData(id)); dialogRemove($q, () => removeData(id));
}; };
// api
const removeData = async (id: string) => { const removeData = async (id: string) => {
showLoader(); showLoader();
await http await http
@ -114,8 +114,24 @@ const removeData = async (id: string) => {
hideLoader(); hideLoader();
}); });
}; };
const fileOpen = (url: string) => { const fileOpen = (url: string, isReport: boolean, fileName: string) => {
window.open(url, "_blank"); 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 // Dialog Reply
@ -347,7 +363,10 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
v-for="(link, num) in d.payload.attachments" v-for="(link, num) in d.payload.attachments"
:key="num" :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-section>{{ link.name }}</q-item-section>
</q-item> </q-item>
<q-separator /> <q-separator />