ต่อ API ดาวน์โหลดรายงาน

This commit is contained in:
STW_TTTY\stwtt 2024-04-09 16:26:10 +07:00
parent 2948ebdc2f
commit 1bdd71d9f2
5 changed files with 124 additions and 9 deletions

View file

@ -14,6 +14,8 @@ import { useDevelopmentDataStore } from "@/modules/15_development/store/developm
import { useCounterMixin } from "@/stores/mixin";
import { useRoute, useRouter } from "vue-router";
import genReportXLSX from "@/plugins/genreportxlsx";
const maxPage = ref<number>(1);
const pagination = ref({
page: 1,
@ -138,7 +140,24 @@ function onAdd() {
store.statusEdit = false;
router.push(`/development/history/add`);
}
function onDownload() {}
function onDownload() {
showLoader();
http
.get(config.API.developmentReportHistory())
.then((res) => {
const dataList = res.data.result;
genReportXLSX(
dataList,
"รายการประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ"
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function onEdit(id: string) {
store.statusEdit = true;
@ -261,6 +280,7 @@ onMounted(() => {
dense
icon="mdi-arrow-down-bold-circle-outline"
color="blue"
@click="onDownload"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>