From f28baeb1584d2a5ab04abc4bed67872612040550 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 9 May 2024 18:32:57 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9C=E0=B8=B9?= =?UTF-8?q?=E0=B9=89=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=20=3D>=20=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableD.vue | 90 +++++++ src/main.ts | 55 +++-- .../08_KPI/components/Evaluator/01_TabAll.vue | 91 +++++++ .../components/Evaluator/02_TabOther.vue | 104 ++++++++ src/modules/08_KPI/store.ts | 15 +- src/modules/08_KPI/stores/evaluator.ts | 7 + src/modules/08_KPI/views/mainEvaluator.vue | 224 +++++++++++------- 7 files changed, 472 insertions(+), 114 deletions(-) create mode 100644 src/components/TableD.vue create mode 100644 src/modules/08_KPI/components/Evaluator/01_TabAll.vue create mode 100644 src/modules/08_KPI/components/Evaluator/02_TabOther.vue create mode 100644 src/modules/08_KPI/stores/evaluator.ts diff --git a/src/components/TableD.vue b/src/components/TableD.vue new file mode 100644 index 0000000..1c1fbdc --- /dev/null +++ b/src/components/TableD.vue @@ -0,0 +1,90 @@ + + + + diff --git a/src/main.ts b/src/main.ts index 6e90f59..98cedae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,38 +1,43 @@ -import { createApp, defineAsyncComponent } from "vue" -import App from "./App.vue" -import router from "./router" -import { Dialog, Notify, Quasar } from "quasar" -import th from "quasar/lang/th" -import quasarUserOptions from "./quasar-user-options" -import { createPinia } from "pinia" -import "@vuepic/vue-datepicker/dist/main.css" +import { createApp, defineAsyncComponent } from "vue"; +import App from "./App.vue"; +import router from "./router"; +import { Dialog, Notify, Quasar } from "quasar"; +import th from "quasar/lang/th"; +import quasarUserOptions from "./quasar-user-options"; +import { createPinia } from "pinia"; +import "@vuepic/vue-datepicker/dist/main.css"; -import "quasar/src/css/index.sass" -import http from "./plugins/http" +import "quasar/src/css/index.sass"; +import http from "./plugins/http"; // import OpenLayersMap from "vue3-openlayers"; // import './assets/main.css' -const app = createApp(App) -const pinia = createPinia() +const app = createApp(App); +const pinia = createPinia(); -app.use(router) -app.use(pinia) +app.use(router); +app.use(pinia); app.use(Quasar, { - plugins: { - Notify, - Dialog, - }, - lang: th, -}) + plugins: { + Notify, + Dialog, + }, + lang: th, +}); // app.use(OpenLayersMap /* options */); app.component( - "datepicker", - defineAsyncComponent(() => import("@vuepic/vue-datepicker")) -) + "datepicker", + defineAsyncComponent(() => import("@vuepic/vue-datepicker")) +); -app.config.globalProperties.$http = http +app.component( + "d-table", + defineAsyncComponent(() => import("@/components/TableD.vue")) +); -app.mount("#app") +app.config.globalProperties.$http = http; + +app.mount("#app"); diff --git a/src/modules/08_KPI/components/Evaluator/01_TabAll.vue b/src/modules/08_KPI/components/Evaluator/01_TabAll.vue new file mode 100644 index 0000000..52995a3 --- /dev/null +++ b/src/modules/08_KPI/components/Evaluator/01_TabAll.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/modules/08_KPI/components/Evaluator/02_TabOther.vue b/src/modules/08_KPI/components/Evaluator/02_TabOther.vue new file mode 100644 index 0000000..927140e --- /dev/null +++ b/src/modules/08_KPI/components/Evaluator/02_TabOther.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/modules/08_KPI/store.ts b/src/modules/08_KPI/store.ts index 0ef9c19..55d3a72 100644 --- a/src/modules/08_KPI/store.ts +++ b/src/modules/08_KPI/store.ts @@ -1,8 +1,16 @@ import { defineStore } from "pinia"; -import { ref } from "vue"; +import { ref, reactive } from "vue"; import type { DataOptions } from "./interface/index/Main"; export const useKpiDataStore = defineStore("KPIDate", () => { + const tabMainevaluator = ref("1"); + const yearRound = ref(new Date().getFullYear()); + const formQuery = reactive({ + page: 1, + pageSize: 10, + round: "", + keyword: "", + }); const tabMain = ref("1"); const dataProfile = ref({ profileId: null, @@ -326,5 +334,10 @@ export const useKpiDataStore = defineStore("KPIDate", () => { excusiveIndicator2ScoreVal, excusiveIndicatorScore, excusiveIndicatorScoreVal, + + //รายการการประเมินผลการปฏิบัติราชการระดับบุคคล + tabMainevaluator, + formQuery, + yearRound, }; }); diff --git a/src/modules/08_KPI/stores/evaluator.ts b/src/modules/08_KPI/stores/evaluator.ts new file mode 100644 index 0000000..8056f7b --- /dev/null +++ b/src/modules/08_KPI/stores/evaluator.ts @@ -0,0 +1,7 @@ +import { defineStore } from "pinia"; +import { ref } from "vue"; + +export const useKPIEvaluatorDataStore = defineStore("KPIEvaluator", () => { + const tabMain = ref(""); + return { tabMain }; +}); diff --git a/src/modules/08_KPI/views/mainEvaluator.vue b/src/modules/08_KPI/views/mainEvaluator.vue index 97e994e..b788435 100644 --- a/src/modules/08_KPI/views/mainEvaluator.vue +++ b/src/modules/08_KPI/views/mainEvaluator.vue @@ -8,23 +8,21 @@ import http from "@/plugins/http"; import type { DataOptions } from "@/modules/08_KPI/interface/index/Main"; import type { QTableProps } from "quasar"; +import TabAll from "@/modules/08_KPI/components/Evaluator/01_TabAll.vue"; +import TabOther from "@/modules/08_KPI/components/Evaluator/02_TabOther.vue"; + import { useCounterMixin } from "@/stores/mixin"; import { useKpiDataStore } from "@/modules/08_KPI/store"; const $q = useQuasar(); const router = useRouter(); const store = useKpiDataStore(); +const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin(); -const { showLoader, hideLoader, messageError, date2Thai, dialogConfirm } = - useCounterMixin(); - -const filterKeyword = ref(""); - -const rows = ref(); +const dataListMain = ref(); const year = ref(new Date().getFullYear()); -const round = ref(""); const roundOp = ref([]); const visibleColumns = ref([ @@ -83,18 +81,15 @@ const columns = ref([ }, ]); -const formQuery = reactive({ - page: 1, - pageSize: 10, -}); -const totalList = ref(1); +const totalList = ref(0); +const maxPage = ref(1); -function fetchRoundOption() { +function fetchRoundOption(type: boolean = false) { showLoader(); http .get( config.API.kpiPeriod + - `?page=${1}&pageSize=${10}&keyword=${""}&year=${year.value}` + `?page=${1}&pageSize=${10}&keyword=${""}&year=${store.yearRound}` ) .then((res) => { const data = res.data.result.data; @@ -108,7 +103,9 @@ function fetchRoundOption() { : "", })); roundOp.value = list; - round.value = ""; + if (type) { + store.formQuery.round = ""; + } fetchList(); }) .catch((err) => { @@ -121,15 +118,44 @@ function fetchRoundOption() { function fetchList() { showLoader(); + const formTab1 = { + page: store.formQuery.page, + pageSize: store.formQuery.pageSize, + kpiPeriodId: store.formQuery.round, + keyword: store.formQuery.keyword, + }; + 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 - .get( - config.API.kpiEvaluation + - `/admin?page=${formQuery.page}&pageSize=${formQuery.pageSize}&kpiPeriodId=${round.value}&keyword=${filterKeyword.value}` - ) + .post(config.API.kpiEvaluation + `/admin`, body) .then((res) => { const data = res.data.result; - totalList.value = Math.ceil(data.total / formQuery.pageSize); - rows.value = data.data; + maxPage.value = Math.ceil(data.total / store.formQuery.pageSize); + totalList.value = data.total; + dataListMain.value = data.data; }) .catch((err) => { messageError($q, err); @@ -140,37 +166,31 @@ function fetchList() { } function changRound() { - formQuery.page = 1; + store.formQuery.page = 1; fetchList(); } -function redirectViewDetail(id: string) { - router.push(`/KPI-evaluator/${id}`); -} - /** * function updatePagination * @param newPagination ข้อมูล Pagination ใหม่ */ function updatePagination(newPagination: any) { - formQuery.page = 1; - formQuery.pageSize = newPagination.rowsPerPage; + store.formQuery.page = 1; + store.formQuery.pageSize = newPagination.rowsPerPage; } -const pagination = ref({ - sortBy: "desc", - descending: false, - page: 1, - rowsPerPage: 10, -}); - watch( - () => formQuery.pageSize, + () => store.formQuery.pageSize, () => { fetchList(); } ); +function onChangTab() { + store.formQuery.page = 1; + fetchList(); +} + onMounted(async () => { fetchRoundOption(); }); @@ -198,12 +218,12 @@ onMounted(async () => {