เพิ่ม Report โครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-18 13:31:35 +07:00
parent e3c835228c
commit a55820297a
3 changed files with 68 additions and 5 deletions

View file

@ -117,13 +117,19 @@ const baseDocument = ref<DataDocument[]>([
name: "บัญชี 3", name: "บัญชี 3",
val: "report3", val: "report3",
}, },
{
name: "รายงานสรุปจำนวนกรอบอัตรากำลังของข้าราชการกรุงเทพมหานครสามัญ",
val: "report4",
},
]); ]);
const document = computed(() => { const document = computed(() => {
if (store.typeOrganizational === "draft") { if (store.typeOrganizational === "draft") {
return baseDocument.value; return baseDocument.value;
} else { } else {
return baseDocument.value.filter((e: DataDocument) => e.val === "report2"); return baseDocument.value.filter(
(e: DataDocument) => e.val === "report2" || e.val === "report4"
);
} }
}); });
@ -456,14 +462,17 @@ async function onClickDownloadReport(val: string, name: string) {
showLoader(); showLoader();
await http await http
.get(config.API.orgReport(val) + `/${orgRootId.value}`) .get(config.API.orgReport(val) + `/${orgRootId.value}`)
.then((res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
if (data) { if (data) {
genreport(data, name); await genreport(data, name);
} }
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader();
}); });
} }
@ -487,7 +496,7 @@ watch(
<!-- TOOLBAR --> <!-- TOOLBAR -->
<div class="col-12"> <div class="col-12">
<q-toolbar style="padding: 0"> <q-toolbar style="padding: 0">
<div v-if="store.typeOrganizational === 'draft'&& !store.isLosck"> <div v-if="store.typeOrganizational === 'draft' && !store.isLosck">
<q-btn <q-btn
flat flat
round round
@ -602,7 +611,7 @@ watch(
<q-tr :props="props"> <q-tr :props="props">
<q-td> <q-td>
<q-btn <q-btn
v-if="store.typeOrganizational === 'draft' && !store.isLosck" v-if="store.typeOrganizational === 'draft' && !store.isLosck"
flat flat
color="secondary" color="secondary"
icon="mdi-dots-horizontal-circle-outline" icon="mdi-dots-horizontal-circle-outline"

View file

@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational"; import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import genreport from "@/plugins/genreportxlsx";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -15,6 +16,7 @@ import type { QTableProps } from "quasar";
import type { import type {
ListMenu, ListMenu,
NewPagination, NewPagination,
DataDocumentList,
} from "@/modules/16_positionEmployee/interface/index/Main"; } from "@/modules/16_positionEmployee/interface/index/Main";
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational"; import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
import type { PosMaster2 } from "@/modules/16_positionEmployee/interface/response/organizational"; import type { PosMaster2 } from "@/modules/16_positionEmployee/interface/response/organizational";
@ -101,6 +103,12 @@ const listMenu = ref<ListMenu[]>([
color: "red", color: "red",
}, },
]); ]);
const documentItems = ref<DataDocumentList[]>([
{
name: "รายงานสรุปจำนวนกรอบอัตรากำลังของลูกจ้างประจำกรุงเทพมหานคร",
val: "report4",
},
]);
/** columns*/ /** columns*/
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -327,6 +335,26 @@ function getSummary() {
}); });
} }
/** function DownloadReport*/
async function onClickDownloadReport(val: string, name: string) {
// API
// showLoader();
// await http
// .get(config.API.orgReport(val) + `/${orgRootId.value}`)
// .then(async (res) => {
// const data = res.data.result;
// if (data) {
// await genreport(data, name);
// }
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
}
const pagination = ref({ const pagination = ref({
page: reqMaster.value.page, page: reqMaster.value.page,
rowsPerPage: reqMaster.value.pageSize, rowsPerPage: reqMaster.value.pageSize,
@ -383,6 +411,26 @@ watch(
> >
<q-tooltip>ายตำแหน</q-tooltip> <q-tooltip>ายตำแหน</q-tooltip>
</q-btn> </q-btn>
<q-btn flat round dense color="deep-purple" icon="save_alt">
<q-menu>
<q-list
dense
style="min-width: 100px"
v-for="(item, index) in documentItems"
:key="index"
>
<q-item
clickable
v-close-popup
@click.stop="onClickDownloadReport(item.val, item.name)"
>
<q-item-section>{{ item.name }}</q-item-section>
</q-item>
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
</div> </div>
<q-space /> <q-space />

View file

@ -127,6 +127,11 @@ interface NewPagination {
sortBy: string; sortBy: string;
} }
interface DataDocumentList {
name: string;
val: string;
}
export type { export type {
Pagination, Pagination,
DataOption, DataOption,
@ -144,4 +149,5 @@ export type {
HistoryPostType, HistoryPostType,
FormPositionSelectRef, FormPositionSelectRef,
NewPagination, NewPagination,
DataDocumentList,
}; };