From 13110b71f4f19d34f0c52b8580c32e42c2e69a14 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 28 Feb 2025 17:27:47 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B8=A3=E0=B8=B0=E0=B8=A2=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2=E0=B8=94=E0=B8=B3=E0=B8=A3?= =?UTF-8?q?=E0=B8=87=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87=E0=B8=97=E0=B8=B2=E0=B8=87=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=9A=E0=B8=A3=E0=B8=B4=E0=B8=AB=E0=B8=B2=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/GovernmentInformation/07_Position.vue | 14 +++++++++++--- src/modules/21_report/components/CardPosition.vue | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue index f250c2cbb..6d4aebb50 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue @@ -728,19 +728,27 @@ async function fetchDataTenure() { .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), })); - const position = formatData(data.position); - const posLevel = formatData(data.posLevel); - const posExecutive = formatData(data.posExecutive); + // แปลงข้อมูลจาก 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) => { diff --git a/src/modules/21_report/components/CardPosition.vue b/src/modules/21_report/components/CardPosition.vue index 2e6e783f2..8954a94ad 100644 --- a/src/modules/21_report/components/CardPosition.vue +++ b/src/modules/21_report/components/CardPosition.vue @@ -46,19 +46,27 @@ async function fetchDataTenure() { .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.value[0].data = position; - cardData.value[1].data = posLevel; - cardData.value[2].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) => {