diff --git a/src/modules/14_KPI/interface/index/Main.ts b/src/modules/14_KPI/interface/index/Main.ts index 4c53fb84e..663e03ecd 100644 --- a/src/modules/14_KPI/interface/index/Main.ts +++ b/src/modules/14_KPI/interface/index/Main.ts @@ -1,6 +1,20 @@ interface DataOption { - id: string; - name: string; - } + id: string; + name: string; +} -export type {DataOption}; +interface ItemsMenu { + label: string; + value: string; + icon: string; + color: string; +} + +interface NewPagination { + descending: boolean; + page: number; + rowsPerPage: number; + sortBy: string; +} + +export type { DataOption, ItemsMenu,NewPagination }; diff --git a/src/modules/14_KPI/interface/request/Main.ts b/src/modules/14_KPI/interface/request/Main.ts index 800fa3163..9df4698fc 100644 --- a/src/modules/14_KPI/interface/request/Main.ts +++ b/src/modules/14_KPI/interface/request/Main.ts @@ -1,13 +1,14 @@ -interface FormCompetency { - competencyType: string; - competencyName: string; - definition: string; - level_1: string; - level_2: string; - level_3: string; - level_4: string; - level_5: string; - evaluation: string; +interface FormQueryRound { + page: number; + pageSize: number; + year: number; + keyword: string; } -export type { FormCompetency }; +interface FormRound { + durationKPI: string; + startDate: Date | null; + endDate: Date | null; +} + +export type { FormQueryRound, FormRound }; diff --git a/src/modules/14_KPI/interface/response/Main.ts b/src/modules/14_KPI/interface/response/Main.ts index e4ea7770c..da7e92931 100644 --- a/src/modules/14_KPI/interface/response/Main.ts +++ b/src/modules/14_KPI/interface/response/Main.ts @@ -1 +1,14 @@ -export type {}; +interface ResRound { + createdAt: Date; + createdFullName: string; + createdUserId: Date; + durationKPI: string; + endDate: Date; + id: Date; + lastUpdateFullName: string; + lastUpdateUserId: Date; + lastUpdatedAt: Date; + startDate: Date; +} + +export type { ResRound }; diff --git a/src/modules/14_KPI/views/round.vue b/src/modules/14_KPI/views/round.vue index 76812a118..9629d1560 100644 --- a/src/modules/14_KPI/views/round.vue +++ b/src/modules/14_KPI/views/round.vue @@ -5,6 +5,17 @@ import { useRouter } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; +import type { + DataOption, + ItemsMenu, + NewPagination, +} from "@/modules/14_KPI/interface/index/Main"; +import type { + FormQueryRound, + FormRound, +} from "@/modules/14_KPI/interface/request/Main"; +import type { ResRound } from "@/modules/14_KPI/interface/response/Main"; + import DialogHeader from "@/components/DialogHeader.vue"; /** importStore*/ @@ -25,7 +36,7 @@ const { } = useCounterMixin(); /** หัวตาราง */ -const rows = ref([]); +const rows = ref([]); const columns = ref([ { name: "durationKPI", @@ -61,7 +72,7 @@ const columns = ref([ ]); const visibleColumns = ref(["durationKPI", "startDate", "endDate"]); -const itemMenu = ref([ +const itemMenu = ref([ { label: "เปิดรอบ", value: "open", @@ -82,7 +93,7 @@ const itemMenu = ref([ }, ]); -const roundOp = ref([ +const roundOp = ref([ { id: "APR", name: "รอบเมษายน" }, { id: "OCT", @@ -90,7 +101,7 @@ const roundOp = ref([ }, ]); -const formQuery = reactive({ +const formQuery = reactive({ page: 1, pageSize: 10, year: new Date().getFullYear(), @@ -98,7 +109,7 @@ const formQuery = reactive({ }); const totalList = ref(1); -const formData = reactive({ +const formData = reactive({ durationKPI: "", startDate: null, endDate: null, @@ -112,7 +123,7 @@ function fetchList() { `?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&year=${formQuery.year}` ) .then((res) => { - const data = res.data.result.data; + const data: ResRound[] = res.data.result.data; totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize); rows.value = data; }) @@ -203,12 +214,13 @@ function onCloseRounde() { "ต้องการยืนยันการปิดรอบนี้หรือไม่ ?" ); } + function onDeleteRound(id: string) { dialogRemove($q, () => { showLoader(); http .delete(config.API.kpiPeriodById(id)) - .then((res) => { + .then(() => { success($q, "ลบข้อมูลสำเร็จ"); fetchList(); }) @@ -222,15 +234,15 @@ function onDeleteRound(id: string) { } function connvertName(val: string) { - const findData = roundOp.value.find((e: any) => e.id === val); - return findData.name; + const findData = roundOp.value.find((e: DataOption) => e.id === val); + return findData?.name; } /** * function updatePagination * @param newPagination ข้อมูล Pagination ใหม่ */ -function updatePagination(newPagination: any) { +function updatePagination(newPagination: NewPagination) { formQuery.page = 1; formQuery.pageSize = newPagination.rowsPerPage; } @@ -373,7 +385,7 @@ onMounted(() => { dense class="custom-header-table" :visible-columns="visibleColumns" - :rows-per-page-options="[2, 10, 25, 50, 100]" + :rows-per-page-options="[10, 25, 50, 100]" @update:pagination="updatePagination" >