ต่อ 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

@ -2,6 +2,7 @@ import env from "../index";
const development = `${env.API_URI}/development`;
const developmentOrg = `${env.API_URI}/org`;
const devScholarship = `${env.API_URI}/development/scholarship`;
const developmentReport = `${env.API_URI}/development/report`;
export default {
development,
/** history */
@ -20,4 +21,9 @@ export default {
devScholarship,
devScholarshipByid: (id: string) => `${devScholarship}/${id}`,
/** download File */
developmentReportMain:() =>`${developmentReport}/main`,
developmentReportHistory:() =>`${developmentReport}/history-officer`,
developmentReportHistoryOfficer:() =>`${developmentReport}/history-employee`,
developmentReportScholarship:() =>`${developmentReport}/scholarship`,
};

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,
@ -129,7 +131,25 @@ function onAdd() {
store.statusEdit = false;
router.push(`/development/employee-history/add`);
}
function onDownload() {}
function onDownload() {
showLoader();
http
.get(config.API.developmentReportHistoryOfficer())
.then((res) => {
const dataList = res.data.result;
genReportXLSX(
dataList,
"รายการประวัติฝึกอบรม/ดูงานลูกจ้าง"
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function onEdit(id: string) {
store.statusEdit = true;
@ -255,6 +275,7 @@ onMounted(() => {
dense
icon="mdi-arrow-down-bold-circle-outline"
color="blue"
@click="onDownload"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>

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>

View file

@ -5,6 +5,8 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import genReportXLSX from "@/plugins/genreportxlsx";
/**importType*/
import type {
DataOption,
@ -60,20 +62,20 @@ const visibleColumns = ref<string[]>(["year", "projectName", "org"]);
/** เมนูดาวน์โหลด*/
const itemDownload = ref<ItemsMenu[]>([
{
label: "ดาวน์โหลด 1",
value: "",
label: "Excel",
value: "EXCEL",
icon: "mdi-file-pdf-box",
color: "green",
},
{
label: "ดาวน์โหลด 2",
value: "",
value: "PDF",
icon: "mdi-file-table",
color: "red",
},
{
label: "ดาวน์โหลด 3",
value: "",
value: "WORD",
icon: "mdi-file-word",
color: "blue",
},
@ -143,6 +145,25 @@ function fetchListProjectNew() {
fetchListProject();
}
function onDownload() {
showLoader();
http
.get(config.API.developmentReportMain())
.then((res) => {
const dataList = res.data.result;
genReportXLSX(
dataList,
"รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด"
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
fetchListProject();
});
@ -217,6 +238,16 @@ onMounted(() => {
<div class="row q-gutter-sm">
<div>
<q-btn
flat
round
dense
icon="mdi-arrow-down-bold-circle-outline"
color="blue"
@click="onDownload"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<!-- <q-btn
flat
round
color="blue"
@ -224,7 +255,13 @@ onMounted(() => {
>
<q-menu>
<q-list style="min-width: 100px" dense>
<q-item clickable v-close-popup v-for="items in itemDownload">
<q-item
clickable
v-close-popup
v-for="items in itemDownload"
:key="items.value"
@click="onDownload(items.value)"
>
<q-item-section avatar>
<q-icon :color="items.color" :name="items.icon" />
</q-item-section>
@ -235,7 +272,7 @@ onMounted(() => {
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
</q-btn> -->
</div>
<div>
<q-input

View file

@ -5,6 +5,8 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import genReportXLSX from "@/plugins/genreportxlsx";
import type {
DataOption,
ItemsDownload,
@ -182,6 +184,25 @@ watch(
}
);
function onDownload() {
showLoader();
http
.get(config.API.developmentReportScholarship())
.then((res) => {
const dataList = res.data.result;
genReportXLSX(
dataList,
"รายการข้าราชการฯที่ได้รับทุนการศึกษา/ฝึกอบรม"
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
fetchList();
});
@ -260,6 +281,16 @@ onMounted(() => {
<div class="row q-gutter-sm">
<div>
<q-btn
flat
round
dense
icon="mdi-arrow-down-bold-circle-outline"
color="blue"
@click="onDownload"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<!-- <q-btn
flat
round
color="blue"
@ -278,7 +309,7 @@ onMounted(() => {
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
</q-btn> -->
</div>
<div>
<q-input