From 3d4acad8e5e4dbfe9367649ca99263f813d53ca3 Mon Sep 17 00:00:00 2001 From: waruneeta Date: Wed, 28 Feb 2024 07:58:34 +0700 Subject: [PATCH] =?UTF-8?q?updated=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/02_organizational/api.organization.ts | 2 + .../components/SalaryLists/TabMain.vue | 9 +- src/modules/13_salary/interface/index/Main.ts | 7 + .../13_salary/store/SalaryListsStore.ts | 14 +- src/modules/13_salary/views/salaryLists.vue | 174 ++++++++++++++++++ 5 files changed, 202 insertions(+), 4 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 5bec17793..2c115c224 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -56,4 +56,6 @@ export default { orgPosPlacement: `${orgPos}/placement/search`, orgPosFind: `${organization}/find/node`, orgProfileProbation: `${organization}/profile/probation`, + + activeOrganizationRoot: `${organization}/active/root`, }; diff --git a/src/modules/13_salary/components/SalaryLists/TabMain.vue b/src/modules/13_salary/components/SalaryLists/TabMain.vue index 0efa98b25..86037ce8b 100644 --- a/src/modules/13_salary/components/SalaryLists/TabMain.vue +++ b/src/modules/13_salary/components/SalaryLists/TabMain.vue @@ -42,7 +42,7 @@ const itemsTabGroup = ref([ const itemsTabType = ref([ { - lable: "รายชื่อถือครอง", + lable: "รายชื่อคนครอง", name: "tab1", type: "PENDING", }, @@ -98,6 +98,7 @@ async function fetchKeycloakPosition() { .then((res) => { const data = res.data.result; rootId.value = data.rootId; + store.rootId = data.rootId fetchSalalyPeriod(rootId.value); }) .catch((err) => { @@ -264,7 +265,7 @@ onMounted(async () => { v-model="store.tabType" vertical dense - class="text-grey" + class="text-grey-black" active-color="blue-5" active-class="bg-blue-1" indicator-color="blue-5" @@ -274,6 +275,8 @@ onMounted(async () => { v-for="(item, index) in itemsTabType" :key="index" class="row" + :style="index==1?'border-top: 1px solid #ccc;':index==3?'border-bottom: 1px solid #ccc':''" + > { } .q-tabs--vertical .q-tab { - padding: 0 50px; + padding: 0 20px; } diff --git a/src/modules/13_salary/interface/index/Main.ts b/src/modules/13_salary/interface/index/Main.ts index 925340fe2..df1743c80 100644 --- a/src/modules/13_salary/interface/index/Main.ts +++ b/src/modules/13_salary/interface/index/Main.ts @@ -3,6 +3,12 @@ interface DataOption { name: string; } +interface DataOptionShort { + id: string; + name: string; + shortCode: string +} + interface NewPagination { descending: boolean; page: number; @@ -45,4 +51,5 @@ export type { ItemsMenu, ObjectSalaryRef, ObjectSalaryRateRef, + DataOptionShort }; diff --git a/src/modules/13_salary/store/SalaryListsStore.ts b/src/modules/13_salary/store/SalaryListsStore.ts index b36e2cc4e..85e2cbc89 100644 --- a/src/modules/13_salary/store/SalaryListsStore.ts +++ b/src/modules/13_salary/store/SalaryListsStore.ts @@ -10,6 +10,8 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => { const tabGroup = ref("group1"); const tabType = ref("PENDING"); const groupId = ref(""); + const rootId = ref(""); + const roundCode = ref("OCT"); /** List Menu*/ const itemMenu = ref([ { @@ -40,6 +42,7 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => { function fetchPeriodLatest(data: DataPeriodLatest, type: string) { groupId.value = type === "group1" ? data.group1id : data.group2id; + roundCode.value = data.period; titelPage.value = data.period === "SPECIAL" ? "รอบพิเศษ" @@ -47,5 +50,14 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => { ? "รอบเมษายน" : "รอบตุลาคม"; } - return { titelPage, tabGroup, tabType, itemMenu, groupId, fetchPeriodLatest }; + return { + titelPage, + tabGroup, + tabType, + itemMenu, + groupId, + fetchPeriodLatest, + rootId, + roundCode, + }; }); diff --git a/src/modules/13_salary/views/salaryLists.vue b/src/modules/13_salary/views/salaryLists.vue index 3a1d38f46..cbb9d9a75 100644 --- a/src/modules/13_salary/views/salaryLists.vue +++ b/src/modules/13_salary/views/salaryLists.vue @@ -2,7 +2,116 @@ import TabGroup from "@/modules/13_salary/components/SalaryLists/TabMain.vue"; import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore"; +import { onMounted, ref } from "vue"; +import type { + DataOption, + DataOptionShort, +} from "@/modules/13_salary/interface/index/Main"; +import config from "@/app.config"; +import http from "@/plugins/http"; +import { useCounterMixin } from "@/stores/mixin"; +import { useQuasar } from "quasar"; + +const { messageError } = useCounterMixin(); + const store = useSalaryListSDataStore(); +const $q = useQuasar(); + +const roundFilter = ref(); +const roundOptions = ref([]); +const agencyFilter = ref(); +const agencyOptions = ref(); +const snapFilter = ref(); +const snapOptions = ref(); +// const tabMain = ref("first_snapshot"); + +async function getAgency() { + await http + .get(config.API.activeOrganizationRoot) + .then(async (res) => { + const data = res.data.result; + + agencyOptions.value = await data.map((x: any) => ({ + id: x.id, + name: x.orgRootName, + })); + + agencyFilter.value = store.rootId; + }) + .catch((err) => { + messageError($q, err); + }); +} + +async function getRound() { + http + .get(config.API.salaryPeriod() + `?page=1&pageSise=10&keyword=&year=0`) + .then(async (res) => { + const data = res.data.result.data; + roundOptions.value = await data.map((x: any) => ({ + id: x.id, + shortCode: x.period, + name: + (x.period === "OCT" + ? "รอบตุลาคม " + : x.period === "SPECIAL" + ? "รอบพิเศษ" + : "รอบเมษายน ") + + (Number(x.year) + 543), + })); + + roundFilter.value = await (roundOptions.value + ? roundOptions.value[0] + : ""); + + await getSnap(roundFilter.value.shortCode); + }) + .catch((e) => { + messageError($q, e); + }); +} + +function getSnap(code: string) { + snapOptions.value = + code === "OCT" + ? [ + { + id: "OCT1", + name: "1 กันยายน", + }, + { + id: "OCT2", + name: "1 ตุลาคม", + }, + ] + : code === "APR" + ? [ + { + id: "APR1", + name: "1 มีนาคม", + }, + { + id: "APR2", + name: "1 เมษายน", + }, + ] + : [ + { + id: "SPECIAL", + name: "พิเศษ", + }, + ]; + snapFilter.value = snapOptions.value[0].id; +} + +function onChangeRound() { + getSnap(roundFilter.value.shortCode); +} + +onMounted(() => { + getAgency(); + getRound(); +});