From 42301c48305db60e81163660bbb3372c4b233626 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 3 Mar 2025 15:04:42 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A2=E0=B8=B0=E0=B9=80?= =?UTF-8?q?=E0=B8=A7=E0=B8=A5=E0=B8=B2=E0=B8=94=E0=B8=B3=E0=B8=A5=E0=B8=87?= =?UTF-8?q?=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/org/api.org.ts | 3 + .../10_registry/02_Government/07_Position.vue | 231 ++++++++++++------ .../10_registry/interface/index/Main.ts | 12 + src/stores/mixin.ts | 14 ++ 4 files changed, 184 insertions(+), 76 deletions(-) diff --git a/src/api/org/api.org.ts b/src/api/org/api.org.ts index 6a32e6a..465982b 100644 --- a/src/api/org/api.org.ts +++ b/src/api/org/api.org.ts @@ -111,6 +111,9 @@ export default { dataUserSalaryNopaidHistoryByType: (emType: string, id: string) => `${org}/profile${emType}/nopaid/history/${id}`, + salaryTenurePosition: (emType: string) => + `${org}/profile${emType}/salary/tenure/user`, + dataUserCertificateHistory: (type: string, id: string) => `${profileOrg}/${type}/history/${id}`, dataUserCertificateHistoryByType: ( diff --git a/src/modules/10_registry/02_Government/07_Position.vue b/src/modules/10_registry/02_Government/07_Position.vue index 113a900..fd2d3a4 100644 --- a/src/modules/10_registry/02_Government/07_Position.vue +++ b/src/modules/10_registry/02_Government/07_Position.vue @@ -7,7 +7,10 @@ import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useDataStore } from "@/stores/data"; -import type { SalaryFormType } from "@/modules/10_registry/interface/index/Main"; +import type { + SalaryFormType, + CardDataPos, +} from "@/modules/10_registry/interface/index/Main"; //history dialog import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; @@ -16,8 +19,14 @@ const link = ref(""); const $q = useQuasar(); const dataPerson = useDataStore(); const mixin = useCounterMixin(); -const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } = - mixin; +const { + showLoader, + hideLoader, + messageError, + date2Thai, + onSearchDataTable, + formatDatePosition, +} = mixin; const idByRow = ref(""); const rows = ref([]); @@ -30,7 +39,20 @@ const checkType = ref( dataPerson.officerType == "OFFICER" ? true : false ); const modalHistory = ref(false); -/** ตัวแปรข้อมูล */ +const cardData = ref([ + { + label: "ระยะเวลาดำรงตำแหน่งในสายงาน", + data: [], + }, + { + label: "ระยะเวลาดำรงตำแหน่งตามระดับ", + data: [], + }, + { + label: "ระยะเวลาดำรงตำแหน่งทางการบริหาร", + data: [], + }, +]); const visibleColumns = ref([ "commandDateAffect", @@ -485,16 +507,69 @@ function onSearch() { ); } +async function fetchDataTenure() { + await http + .get(config.API.salaryTenurePosition(link.value)) + .then((res) => { + const data = res.data.result; + if (data) { + // map ข้อมูลระยะเวลาดำรงตำแหน่ง + const formatData = (list: any) => + list.map((e: any) => ({ + name: e.name ?? "", + time: formatDatePosition(e.year, e.month, e.day), + })); + + // แปลงข้อมูลจาก data + const position = formatData(data.position); //ระยะเวลาดำรงตำแหน่งในสายงาน + const posLevel = formatData(data.posLevel); //ระยะเวลาดำรงตำแหน่งตามระดับ + const posExecutive = formatData(data.posExecutive); //ระยะเวลาดำรงตำแหน่งทางการบริหาร + + // นำข้อมูลไปใส่ใน cardData + cardData.value[0].data = position; + cardData.value[1].data = posLevel; + cardData.value[2].data = posExecutive; + + //เช็คค่า ระยะเวลาดำรงตำแหน่งทางการบริหาร ถ้าไม่มีให้ลบออกจาก cardData + if (posExecutive.length === 0) { + cardData.value.splice(2, 2); + } + } + }) + .catch((err) => { + messageError($q, err); + }); +} + onMounted(async () => { link.value = await dataPerson.getProFileType(); getData(); + fetchDataTenure(); }); +