From 35313017137e926b6fd3398aed596ff4fdb37f26 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 30 Jul 2024 10:15:15 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95?= =?UTF-8?q?=E0=B8=B4=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9D=E0=B8=B6=E0=B8=81?= =?UTF-8?q?=E0=B8=AD=E0=B8=9A=E0=B8=A3=E0=B8=A1/=E0=B8=94=E0=B8=B9?= =?UTF-8?q?=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=82=E0=B8=AD=E0=B8=87=E0=B8=82?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=81=E0=B8=A3=E0=B8=B8=E0=B8=87=E0=B9=80=E0=B8=97?= =?UTF-8?q?=E0=B8=9E=E0=B8=A1=E0=B8=AB=E0=B8=B2=E0=B8=99=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=AA=E0=B8=B2=E0=B8=A1=E0=B8=B1=E0=B8=8D=20=3D>=20?= =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../15_development/interface/index/Main.ts | 15 ++- .../15_development/interface/response/Main.ts | 14 ++ src/modules/15_development/views/History.vue | 121 ++++++++++-------- 3 files changed, 96 insertions(+), 54 deletions(-) diff --git a/src/modules/15_development/interface/index/Main.ts b/src/modules/15_development/interface/index/Main.ts index b939579c2..b93162ce3 100644 --- a/src/modules/15_development/interface/index/Main.ts +++ b/src/modules/15_development/interface/index/Main.ts @@ -1,5 +1,5 @@ interface DataOption { - id: string; + id: string | null; name: string; } @@ -89,6 +89,18 @@ interface FormProjectDetail { strategyChildActualNode: number | null; //node ยุทธศาสตร์เป้าหมายตามจริง } +interface DataHistory { + citizenId: string; + id: string; + level: string; + name: string; + position: string; + positionSide: string; + projectName: string; + type: string; + year: number; +} + export type { DataOption, DataOptionCheckBox, @@ -99,4 +111,5 @@ export type { ItemsDownload, FormProjectDetail, DataOptionTechnique, + DataHistory, }; diff --git a/src/modules/15_development/interface/response/Main.ts b/src/modules/15_development/interface/response/Main.ts index 21835f09a..ef659e817 100644 --- a/src/modules/15_development/interface/response/Main.ts +++ b/src/modules/15_development/interface/response/Main.ts @@ -165,6 +165,19 @@ interface DataTree { children: DataTree; } +interface ResHistory { + citizenId: string; + fullName: string; + id: string; + posExecutive: string; + posLevel: string; + posType: string; + position: string; + projectName: string; + root: string; + year: number; +} + export type { ResGroup, ResLevel, @@ -176,4 +189,5 @@ export type { ResRecord, DataStrategic, DataTree, + ResHistory, }; diff --git a/src/modules/15_development/views/History.vue b/src/modules/15_development/views/History.vue index 0d7b43f3f..ce096448c 100644 --- a/src/modules/15_development/views/History.vue +++ b/src/modules/15_development/views/History.vue @@ -5,18 +5,30 @@ import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; import genReportXLSX from "@/plugins/genreportxlsx"; -import genReport from "@/plugins/genreport"; -/**importType*/ +/** + * importType + */ import type { + DataOption, + DataHistory, NewPagination, ItemsMenu, } from "@/modules/15_development/interface/index/Main"; +import type { ResHistory } from "@/modules/15_development/interface/response/Main"; -/** importStore*/ +/** + * importStore + */ import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore"; import { useCounterMixin } from "@/stores/mixin"; +/** use*/ +const router = useRouter(); +const store = useDevelopmentDataStore(); +const $q = useQuasar(); +const { showLoader, hideLoader, messageError } = useCounterMixin(); + const formFilter = reactive({ root: null, page: 1, @@ -24,34 +36,15 @@ const formFilter = reactive({ keyword: "", year: new Date().getFullYear(), }); +const agencyOp = ref([]); // หน่วยงาน +/** + * ข้อมูล Table + */ + +const rows = ref([]); const maxPage = ref(1); const totalList = ref(0); //จำนวนข้อมูลรายการ - -const pagination = ref({ - page: formFilter.page, - rowsPerPage: formFilter.pageSize, -}); - -/** use*/ -const router = useRouter(); -const store = useDevelopmentDataStore(); -const $q = useQuasar(); -const { showLoader, hideLoader, messageError } = useCounterMixin(); -const agencyOp = ref([]); -const rows = ref([]); - -const visibleColumns = ref([ - "year", - "citizenId", - "name", - "position", - "type", - "level", - "positionSide", - "projectName", -]); - const columns = ref([ { name: "year", @@ -128,7 +121,22 @@ const columns = ref([ style: "font-size: 14px", }, ]); +const pagination = ref({ + page: formFilter.page, + rowsPerPage: formFilter.pageSize, +}); +const visibleColumns = ref([ + "year", + "citizenId", + "name", + "position", + "type", + "level", + "positionSide", + "projectName", +]); +/** menuDownload*/ const itemMenu = ref([ { label: "ไฟล์ .xlsx", @@ -144,13 +152,14 @@ const itemMenu = ref([ }, ]); -/** ดึงข้อมูลหน่วยงาน */ +/** + * function เรียกข้อมูหน่วยงาน + */ function fetchListOrg() { showLoader(); http .get(config.API.developmentHistoryListOrg("officer", formFilter.year)) .then(async (res) => { - console.log(res); formFilter.root = null; formFilter.page = 1; rows.value = []; @@ -161,27 +170,26 @@ function fetchListOrg() { })); option.push(...optionNew); agencyOp.value = option; - await getData(); + getData(); }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); }); } -/** ดึงข้อมูลรายการ */ +/** + * function เรียกข้อมูลรายการประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ + */ function getData() { showLoader(); http .post(config.API.developmentHistoryList("officer"), formFilter) .then((res) => { - console.log(res.data.result.data); const data = res.data.result.data; maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); totalList.value = res.data.result.total; - rows.value = data.map((item: any) => ({ + rows.value = data.map((item: ResHistory) => ({ id: item.id ? item.id : null, citizenId: item.citizenId ? item.citizenId : null, name: item.fullName ? item.fullName : null, @@ -201,7 +209,8 @@ function getData() { }); } -/** download file +/** + * function download file * @param type ประเภทของไฟล์ xlsx pdf */ function onDownload(type: string) { @@ -228,7 +237,8 @@ function onDownload(type: string) { }); } -/** edit page +/** + * function redirect รายละเอียด * @param id id ของ row */ function onEdit(id: string) { @@ -245,7 +255,9 @@ function updatePagination(newPagination: NewPagination) { formFilter.pageSize = newPagination.rowsPerPage; } -/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/ +/** + * callbackFunction ทำเมื่อมีการอัปเดท pageSize + */ watch( () => formFilter.pageSize, () => { @@ -354,6 +366,7 @@ onMounted(() => { {{ items.label }} + {{ items.label }} @@ -416,20 +429,6 @@ onMounted(() => { :rows-per-page-options="[10, 25, 50, 100]" @update:pagination="updatePagination" > - + + +