From c9f02871c20ee81ab4db9b6402418a8f74849606 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 6 Mar 2025 17:15:41 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5?= =?UTF-8?q?=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=20=3D=3D>=20=E0=B8=95=E0=B8=B3=E0=B9=81?= =?UTF-8?q?=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 --- .../GovernmentInformation/07_Position.vue | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 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 51f4051c9..08f6f263b 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue @@ -789,18 +789,26 @@ async function fetchDataTenure() { })); // แปลงข้อมูลจาก data - const position = formatData(data.position); //ระยะเวลาดำรงตำแหน่งในสายงาน - const posLevel = formatData(data.posLevel); //ระยะเวลาดำรงตำแหน่งตามระดับ - const posExecutive = formatData(data.posExecutive); //ระยะเวลาดำรงตำแหน่งทางการบริหาร + const position = data.position ? formatData(data.position) : []; //ระยะเวลาดำรงตำแหน่งในสายงาน + const posLevel = data.posLevel ? formatData(data.posLevel) : []; //ระยะเวลาดำรงตำแหน่งตามระดับ + const posExecutive = data.posExecutive + ? formatData(data.posExecutive) + : []; //ระยะเวลาดำรงตำแหน่งทางการบริหาร // นำข้อมูลไปใส่ใน cardData cardData.value[0].data = position; cardData.value[1].data = posLevel; - cardData.value[2].data = posExecutive; + if (empType.value !== "-employee") { + cardData.value[2].data = posExecutive; + } //เช็คค่า ระยะเวลาดำรงตำแหน่งทางการบริหาร ถ้าไม่มีให้ลบออกจาก cardData - if (posExecutive.length === 0) { - cardData.value.splice(2, 2); + if ( + posExecutive.length === 0 && + empType.value !== "-employee" && + cardData.value.length > 2 + ) { + cardData.value.splice(2, 1); } } }) @@ -813,9 +821,13 @@ async function fetchDataTenure() { onMounted(async () => { try { showLoader(); + if (empType.value === "-employee") { + cardData.value.splice(2, 1); + } await Promise.all([ fetchListSalary(), - empType.value === "" ? fetchDataTenure() : Promise.resolve(), + fetchDataTenure(), + // empType.value === "" ? : Promise.resolve(), ]); } finally { hideLoader(); @@ -824,7 +836,7 @@ onMounted(async () => {