เพิ่ม 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",
val: "report3",
},
{
name: "รายงานสรุปจำนวนกรอบอัตรากำลังของข้าราชการกรุงเทพมหานครสามัญ",
val: "report4",
},
]);
const document = computed(() => {
if (store.typeOrganizational === "draft") {
return baseDocument.value;
} 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();
await http
.get(config.API.orgReport(val) + `/${orgRootId.value}`)
.then((res) => {
.then(async (res) => {
const data = res.data.result;
if (data) {
genreport(data, name);
await genreport(data, name);
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -487,7 +496,7 @@ watch(
<!-- TOOLBAR -->
<div class="col-12">
<q-toolbar style="padding: 0">
<div v-if="store.typeOrganizational === 'draft'&& !store.isLosck">
<div v-if="store.typeOrganizational === 'draft' && !store.isLosck">
<q-btn
flat
round
@ -602,7 +611,7 @@ watch(
<q-tr :props="props">
<q-td>
<q-btn
v-if="store.typeOrganizational === 'draft' && !store.isLosck"
v-if="store.typeOrganizational === 'draft' && !store.isLosck"
flat
color="secondary"
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 { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import genreport from "@/plugins/genreportxlsx";
import config from "@/app.config";
import http from "@/plugins/http";
@ -15,6 +16,7 @@ import type { QTableProps } from "quasar";
import type {
ListMenu,
NewPagination,
DataDocumentList,
} from "@/modules/16_positionEmployee/interface/index/Main";
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
import type { PosMaster2 } from "@/modules/16_positionEmployee/interface/response/organizational";
@ -101,6 +103,12 @@ const listMenu = ref<ListMenu[]>([
color: "red",
},
]);
const documentItems = ref<DataDocumentList[]>([
{
name: "รายงานสรุปจำนวนกรอบอัตรากำลังของลูกจ้างประจำกรุงเทพมหานคร",
val: "report4",
},
]);
/** 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({
page: reqMaster.value.page,
rowsPerPage: reqMaster.value.pageSize,
@ -383,6 +411,26 @@ watch(
>
<q-tooltip>ายตำแหน</q-tooltip>
</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>
<q-space />

View file

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