diff --git a/src/api/15_development/api.development.ts b/src/api/15_development/api.development.ts index b696507c4..595677cfc 100644 --- a/src/api/15_development/api.development.ts +++ b/src/api/15_development/api.development.ts @@ -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`, }; diff --git a/src/modules/15_development/views/EmployeeHistory.vue b/src/modules/15_development/views/EmployeeHistory.vue index 1be63e6d7..00d7bb263 100644 --- a/src/modules/15_development/views/EmployeeHistory.vue +++ b/src/modules/15_development/views/EmployeeHistory.vue @@ -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(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" > ดาวน์โหลด diff --git a/src/modules/15_development/views/History.vue b/src/modules/15_development/views/History.vue index 120459dbd..370d22fc1 100644 --- a/src/modules/15_development/views/History.vue +++ b/src/modules/15_development/views/History.vue @@ -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(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" > ดาวน์โหลด diff --git a/src/modules/15_development/views/MainPage.vue b/src/modules/15_development/views/MainPage.vue index 79aac489f..cb536cc60 100644 --- a/src/modules/15_development/views/MainPage.vue +++ b/src/modules/15_development/views/MainPage.vue @@ -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(["year", "projectName", "org"]); /** เมนูดาวน์โหลด*/ const itemDownload = ref([ { - 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(() => {
+ ดาวน์โหลด + +
{ + const dataList = res.data.result; + genReportXLSX( + dataList, + "รายการข้าราชการฯที่ได้รับทุนการศึกษา/ฝึกอบรม" + ); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +} + onMounted(() => { fetchList(); }); @@ -260,6 +281,16 @@ onMounted(() => {
+ ดาวน์โหลด + +