แก้ report

This commit is contained in:
STW_TTTY\stwtt 2024-09-12 11:37:34 +07:00
parent f65eab4e5e
commit b640c7cf0c
4 changed files with 40 additions and 79 deletions

View file

@ -189,7 +189,7 @@ const SaveData = async () => {
const fecthlistRecevice = async () => {
showLoader();
await http
.get(config.API.receiveData())
.get(config.API.receiveData()+`?keyword=`)
.then((res: any) => {
const response = res.data.result;
@ -378,7 +378,7 @@ onMounted(() => {
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="fullname"
row-key="id"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">

View file

@ -8,6 +8,7 @@ import { checkPermission } from "@/utils/permissions";
// import CurrencyInput from "@/components/CurruncyInput.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
import type { QTableProps, QForm } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
@ -16,6 +17,7 @@ import type {
ResponseDataDetail,
rowFile,
} from "@/modules/05_placement/interface/response/Transfer";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue";
import { tokenParsed } from "@/plugins/auth";
@ -67,31 +69,22 @@ const responseData = ref<ResponseDataDetail>({
status: "",
fullname: "",
});
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
const fileDownload = async (no: number, type: string, fileName: string) => {
async function fileDownload(no: number, type: string, fileName: string) {
showLoader();
await http
.get(config.API.reportTransferFile(no, type, id.value), {
responseType: "blob",
})
.get(config.API.reportTransferFile(no, type, id.value))
.then(async (res) => {
downloadFile(res, `${fileName}.${type}`);
const data = res.data.result;
await genReport(data, fileName, type);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
});
};
})
.finally(() => {});
}
const columns = ref<QTableProps["columns"]>([
{