download file ทดลองงาน

This commit is contained in:
STW_TTTY\stwtt 2024-08-22 12:05:41 +07:00
parent c63539190d
commit c014962eed
8 changed files with 85 additions and 77 deletions

View file

@ -7,6 +7,8 @@ import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
import genReport from "@/plugins/genreport";
const Header = defineAsyncComponent(
() =>
import(
@ -86,20 +88,22 @@ async function FileDownload(type: string) {
let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value);
showLoader();
await http
.get(config.API.reportEvaluate(type, numTab.id), {
responseType: "blob",
})
.get(config.API.reportEvaluate(type, numTab.id))
.then(async (res) => {
downloadFile(
res,
`แบบประเมินผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}`
const data = res.data.result;
await genReport(
data,
`แบบประเมินผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
type
);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {
hideLoader();
});
}
@ -146,7 +150,7 @@ onMounted(() => {
/>
</q-tab-panel>
</q-tab-panels>
<div v-else class="q-gutter-md">
<div class="flex justify-center items-center q-my-md q-gutter-md">
<q-btn