diff --git a/src/modules/08_KPI/components/Evaluator/01_TabAll.vue b/src/modules/08_KPI/components/Evaluator/01_TabAll.vue index 52995a3..3a4b976 100644 --- a/src/modules/08_KPI/components/Evaluator/01_TabAll.vue +++ b/src/modules/08_KPI/components/Evaluator/01_TabAll.vue @@ -3,13 +3,20 @@ import { ref } from "vue"; import { useRouter } from "vue-router"; import type { QTableProps } from "quasar"; +import type { ResEvaluatorAssessor } from "@/modules/08_KPI/interface/response/index"; +import type { FormQuery } from "@/modules/08_KPI/interface/request/index"; + const router = useRouter(); -const visibleColumns = defineModel("visibleColumns", {}); -const columns = defineModel("columns", {}); -const rows = defineModel("rows", {}); -const formQuery = defineModel("formQuery", {}); -const total = defineModel("total", {}); -const maxPage = defineModel("maxPage", {}); +const visibleColumns = defineModel("visibleColumns", { + required: true, +}); +const columns = defineModel("columns", { + required: true, +}); +const rows = defineModel("rows", { required: true }); +const formQuery = defineModel("formQuery", { required: true }); +const total = defineModel("total", { required: true }); +const maxPage = defineModel("maxPage", { required: true }); const props = defineProps({ updatePagination: { type: Function }, diff --git a/src/modules/08_KPI/components/Evaluator/02_TabOther.vue b/src/modules/08_KPI/components/Evaluator/02_TabOther.vue index 927140e..5e0e98c 100644 --- a/src/modules/08_KPI/components/Evaluator/02_TabOther.vue +++ b/src/modules/08_KPI/components/Evaluator/02_TabOther.vue @@ -1,23 +1,45 @@ diff --git a/src/modules/08_KPI/interface/index/Main.ts b/src/modules/08_KPI/interface/index/Main.ts index 80143f3..a1fe878 100644 --- a/src/modules/08_KPI/interface/index/Main.ts +++ b/src/modules/08_KPI/interface/index/Main.ts @@ -1,8 +1,12 @@ interface DataOptions { - id:string - name:string + id: string; + name: string; +} +interface Pagination { + descending: boolean; + page: number; + rowsPerPage: number; + sortBy: string; } -export type { - DataOptions -} \ No newline at end of file +export type { DataOptions, Pagination }; diff --git a/src/modules/08_KPI/interface/request/index.ts b/src/modules/08_KPI/interface/request/index.ts index c8eb73b..5d00e30 100644 --- a/src/modules/08_KPI/interface/request/index.ts +++ b/src/modules/08_KPI/interface/request/index.ts @@ -53,6 +53,13 @@ interface FormComment { reason: string; } +interface FormQuery { + page: number; + pageSize: number; + round: string; + keyword: string; +} + export type { FormProfile, FormDataAssigned, @@ -60,4 +67,5 @@ export type { ListCriteria, ListCapacity, FormComment, + FormQuery, }; diff --git a/src/modules/08_KPI/interface/response/index.ts b/src/modules/08_KPI/interface/response/index.ts index a217a31..c93bb00 100644 --- a/src/modules/08_KPI/interface/response/index.ts +++ b/src/modules/08_KPI/interface/response/index.ts @@ -12,4 +12,33 @@ interface ResEvaluator { type: string; } -export type { ResEvaluator }; +interface ResRound { + createdAt: string; + createdFullName: string; + createdUserId: string; + durationKPI: string; + endDate: string; + id: string; + isActive: boolean; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + startDate: string; + year: number; +} +interface ResEvaluatorAssessor { + commanderHighId: string | null; + commanderId: string | null; + createdAt: string; + evaluationResults: string; + evaluationStatus: string; + evaluatorId: string; + firstname: string; + id: string; + kpiPeriodId: string; + lastname: string; + prefix: string; + profileId: string; +} + +export type { ResEvaluator, ResRound, ResEvaluatorAssessor }; diff --git a/src/modules/08_KPI/store.ts b/src/modules/08_KPI/store.ts index 55d3a72..824ac16 100644 --- a/src/modules/08_KPI/store.ts +++ b/src/modules/08_KPI/store.ts @@ -1,16 +1,19 @@ import { defineStore } from "pinia"; import { ref, reactive } from "vue"; import type { DataOptions } from "./interface/index/Main"; +import type { FormQuery } from "@/modules/08_KPI/interface/request/index"; export const useKpiDataStore = defineStore("KPIDate", () => { const tabMainevaluator = ref("1"); const yearRound = ref(new Date().getFullYear()); - const formQuery = reactive({ + const formQuery = reactive({ page: 1, pageSize: 10, round: "", keyword: "", }); + const selected = ref([]); + const tabMain = ref("1"); const dataProfile = ref({ profileId: null, @@ -339,5 +342,6 @@ export const useKpiDataStore = defineStore("KPIDate", () => { tabMainevaluator, formQuery, yearRound, + selected, }; }); diff --git a/src/modules/08_KPI/views/mainEvaluator.vue b/src/modules/08_KPI/views/mainEvaluator.vue index b788435..2b0c680 100644 --- a/src/modules/08_KPI/views/mainEvaluator.vue +++ b/src/modules/08_KPI/views/mainEvaluator.vue @@ -5,8 +5,15 @@ import { useQuasar } from "quasar"; import config from "@/app.config"; import http from "@/plugins/http"; -import type { DataOptions } from "@/modules/08_KPI/interface/index/Main"; import type { QTableProps } from "quasar"; +import type { + DataOptions, + Pagination, +} from "@/modules/08_KPI/interface/index/Main"; +import type { + ResRound, + ResEvaluatorAssessor, +} from "@/modules/08_KPI/interface/response/index"; import TabAll from "@/modules/08_KPI/components/Evaluator/01_TabAll.vue"; import TabOther from "@/modules/08_KPI/components/Evaluator/02_TabOther.vue"; @@ -19,9 +26,7 @@ const router = useRouter(); const store = useKpiDataStore(); const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin(); -const dataListMain = ref(); - -const year = ref(new Date().getFullYear()); +const dataListMain = ref([]); const roundOp = ref([]); @@ -93,7 +98,7 @@ function fetchRoundOption(type: boolean = false) { ) .then((res) => { const data = res.data.result.data; - const list = data.map((e: any) => ({ + const list = data.map((e: ResRound) => ({ id: e.id, name: e.durationKPI === "OCT" @@ -118,36 +123,21 @@ function fetchRoundOption(type: boolean = false) { function fetchList() { showLoader(); - const formTab1 = { + const body = { page: store.formQuery.page, pageSize: store.formQuery.pageSize, kpiPeriodId: store.formQuery.round, keyword: store.formQuery.keyword, + status: + store.tabMainevaluator === "2" + ? "NEW" + : store.tabMainevaluator === "4" + ? "APPROVE" + : store.tabMainevaluator === "5" + ? "EVALUATING" + : undefined, + reqedit: store.tabMainevaluator === "3" ? "NEW" : undefined, }; - const formTab2 = { - page: store.formQuery.page, - pageSize: store.formQuery.pageSize, - kpiPeriodId: store.formQuery.round, - keyword: store.formQuery.keyword, - status: "NEW_EVALUATOR", - }; - - const formTab3 = { - page: store.formQuery.page, - pageSize: store.formQuery.pageSize, - kpiPeriodId: store.formQuery.round, - keyword: store.formQuery.keyword, - reqedit: "EVALUATOR", - }; - - const body = - store.tabMainevaluator === "1" - ? formTab1 - : store.tabMainevaluator === "2" - ? formTab2 - : store.tabMainevaluator === "3" - ? formTab3 - : ""; http .post(config.API.kpiEvaluation + `/admin`, body) @@ -174,7 +164,7 @@ function changRound() { * function updatePagination * @param newPagination ข้อมูล Pagination ใหม่ */ -function updatePagination(newPagination: any) { +function updatePagination(newPagination: Pagination) { store.formQuery.page = 1; store.formQuery.pageSize = newPagination.rowsPerPage; } @@ -189,6 +179,7 @@ watch( function onChangTab() { store.formQuery.page = 1; fetchList(); + store.selected = []; } onMounted(async () => { @@ -316,7 +307,7 @@ onMounted(async () => { { label="รออนุมัติแก้ไขข้อตกลง" @click="onChangTab" /> + + @@ -366,6 +367,32 @@ onMounted(async () => { :fetchList="fetchList" /> + + + + + + + +