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

@ -6,6 +6,8 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
const $q = useQuasar();
const isEdit = ref<boolean>(true);
const router = useRouter();
@ -917,21 +919,21 @@ function downloadFile(response: any, filename: string) {
async function clickdownloadFile(type: string) {
showLoader();
await http
.get(config.API.reportAssign(type, assignId.value), {
responseType: "blob",
})
.then((res) => {
downloadFile(
res,
`แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}.${type}`
.get(config.API.reportAssign(type, assignId.value))
.then(async (res) => {
const data = res.data.result;
await genReport(
data,
`แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}`,
type
);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
/** เช็ค จำนวนเดือน เเละ วันที่เริ่ม ไม่เท่ากับ undefined*/
@ -1088,7 +1090,7 @@ onMounted(async () => {
<div v-else class="col-12 row q-gutter-md">
<div>แบบมอบหมายงานการทดลองปฏหนาทราชการ</div>
<q-btn
v-if="!isEdit && !checkRoutePermisson"
v-if="!isEdit"
size="12px"
flat
dense