From 6c936c2b97b9e451cf8779b045e5236aba0dd4b5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 28 Feb 2024 11:16:44 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20?= =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=80?= =?UTF-8?q?=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD?= =?UTF-8?q?=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 + src/api/13_salary/api.salary.ts | 5 +- .../components/SalaryLists/TabMain.vue | 76 +++------ .../13_salary/store/SalaryListsStore.ts | 9 +- src/modules/13_salary/views/salaryLists.vue | 149 +++++++++++++++--- 5 files changed, 152 insertions(+), 89 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 2c115c224..95bfd4f19 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -58,4 +58,6 @@ export default { orgProfileProbation: `${organization}/profile/probation`, activeOrganizationRoot: `${organization}/active/root`, + activeOrganizationRootById: (id: string) => + `${organization}/active/root/${id}`, }; diff --git a/src/api/13_salary/api.salary.ts b/src/api/13_salary/api.salary.ts index 0f9550969..f835154f9 100644 --- a/src/api/13_salary/api.salary.ts +++ b/src/api/13_salary/api.salary.ts @@ -20,8 +20,9 @@ export default { salaryPeriod: () => `${salary}/period`, /** รายการเงินเดือน*/ - keycloakPosition: `${env.API_URI}/org/profile/keycloak/position`, - salaryListPeriodLatest: (id: string) => `${salaryPeriod}/latest/${id}`, + keycloakPositionByid: (id: string) => + `${env.API_URI}/org/profile/keycloak/position/${id}`, + salaryListPeriodLatest: `${salaryPeriod}/latest`, salaryListPeriodQuota: (id: string) => `${salaryPeriod}/quota/${id}`, salaryListPeriodORG: (id: string) => `${salaryPeriod}/org/${id}`, salaryListPeriodProfileById: (id: string) => `${salaryPeriod}/profile/${id}`, diff --git a/src/modules/13_salary/components/SalaryLists/TabMain.vue b/src/modules/13_salary/components/SalaryLists/TabMain.vue index 86037ce8b..d21ade94e 100644 --- a/src/modules/13_salary/components/SalaryLists/TabMain.vue +++ b/src/modules/13_salary/components/SalaryLists/TabMain.vue @@ -28,6 +28,10 @@ const { success, } = useCounterMixin(); +const props = defineProps({ + periodLatest: { type: Object as () => DataPeriodLatest, require: true }, +}); + const splitterModel = ref(13); const itemsTabGroup = ref([ { @@ -90,47 +94,6 @@ const itemsCard = ref([ }, ]); -const rootId = ref(""); -async function fetchKeycloakPosition() { - showLoader(); - await http - .get(config.API.keycloakPosition) - .then((res) => { - const data = res.data.result; - rootId.value = data.rootId; - store.rootId = data.rootId - fetchSalalyPeriod(rootId.value); - }) - .catch((err) => { - console.log(err); - }) - .finally(() => { - hideLoader(); - }); -} - -const dataPeriod = ref(); - -async function fetchSalalyPeriod(id: string) { - showLoader(); - await http - .get(config.API.salaryListPeriodLatest(id)) - .then(async (res) => { - dataPeriod.value = res.data.result; - dataPeriod.value && - store.fetchPeriodLatest(dataPeriod.value, store.tabGroup); - - store.groupId && fetchDataQuota(store.groupId); - store.groupId && fetchDataPeriod(store.groupId); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); -} - async function fetchDataQuota(id: string) { showLoader(); await http @@ -185,7 +148,8 @@ async function changeTabGroup() { formFilter.pageSize = 10; formFilter.keyword = ""; store.tabType = "PENDING"; - dataPeriod.value && store.fetchPeriodLatest(dataPeriod.value, store.tabGroup); + props.periodLatest && + store.fetchPeriodLatest(props?.periodLatest, store.tabGroup); store.groupId && fetchDataQuota(store.groupId); store.groupId && fetchDataPeriod(store.groupId); } @@ -202,7 +166,8 @@ function updatePagination() { } onMounted(async () => { - await fetchKeycloakPosition(); + await fetchDataQuota(store.groupId); + await fetchDataPeriod(store.groupId); }); @@ -275,18 +240,21 @@ 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':''" - + :style=" + index == 1 + ? 'border-top: 1px solid #ccc;' + : index == 3 + ? 'border-bottom: 1px solid #ccc' + : '' + " > - - - + diff --git a/src/modules/13_salary/store/SalaryListsStore.ts b/src/modules/13_salary/store/SalaryListsStore.ts index b0f6705de..7fbfc6374 100644 --- a/src/modules/13_salary/store/SalaryListsStore.ts +++ b/src/modules/13_salary/store/SalaryListsStore.ts @@ -9,13 +9,13 @@ import type { import type { DataPeriodLatest } from "@/modules/13_salary/interface/response/SalaryList"; export const useSalaryListSDataStore = defineStore("salaryListStore", () => { - const titelPage = ref(""); const tabGroup = ref("group1"); const tabType = ref("PENDING"); const groupOp = ref([ { id: "", name: "กลุ่ม1" }, { id: "", name: "กลุ่ม2" }, ]); + const groupId = ref(""); const rootId = ref(""); const roundCode = ref("OCT"); @@ -50,17 +50,10 @@ 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" - ? "รอบพิเศษ" - : data.period === "APR" - ? "รอบเมษายน" - : "รอบตุลาคม"; groupOp.value[0].id = data.group1id; groupOp.value[1].id = data.group2id; } return { - titelPage, tabGroup, tabType, itemMenu, diff --git a/src/modules/13_salary/views/salaryLists.vue b/src/modules/13_salary/views/salaryLists.vue index 10d3ed981..809ed54b7 100644 --- a/src/modules/13_salary/views/salaryLists.vue +++ b/src/modules/13_salary/views/salaryLists.vue @@ -1,4 +1,5 @@ @@ -121,7 +218,7 @@ onMounted(() => {