From 2afdcc4f9434fb1804d4bf891c9868df390c44ac Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 25 Aug 2025 15:16:48 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=3D=3D>=20=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=A3=E0=B8=B1=E0=B8=99=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=88=E0=B8=87=20=20=E0=B9=82=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=AD?= =?UTF-8?q?=E0=B8=B1=E0=B8=95=E0=B8=A3=E0=B8=B2=E0=B8=81=E0=B8=B3=E0=B8=A5?= =?UTF-8?q?=E0=B8=B1=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../02_organization/components/MainView.vue | 24 ++++++++++++------- .../02_organization/components/TableMain.vue | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/modules/02_organization/components/MainView.vue b/src/modules/02_organization/components/MainView.vue index 8d2138358..97840779a 100644 --- a/src/modules/02_organization/components/MainView.vue +++ b/src/modules/02_organization/components/MainView.vue @@ -118,18 +118,24 @@ async function fetchDataTable(id: string, level: number, action: boolean) { .then(async (res) => { const dataMain: PosMaster[] = []; totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize); - totalData.value = res.data.result.total; res.data.result.data.forEach((e: PosMaster) => { const p = e.positions; - if (p.length !== 0) { - const a = p.find((el: Position) => el.positionIsSelected === true); - const { id, ...rest } = a ? a : p[0]; - const test = { - ...e, - ...rest, - }; - dataMain.push(test); + let positionData = {}; + + if (p?.length > 0) { + const selectedPos = p.find( + (el: Position) => el.positionIsSelected === true + ); + const targetPosition = selectedPos || p[0]; + const { id, ...rest } = targetPosition; + positionData = rest; } + + const newDataMain = { + ...e, + ...positionData, + }; + dataMain.push(newDataMain); }); posMaster.value = store.fetchPosMaster(dataMain); }) diff --git a/src/modules/02_organization/components/TableMain.vue b/src/modules/02_organization/components/TableMain.vue index 8cbdd1b2b..fd4294361 100644 --- a/src/modules/02_organization/components/TableMain.vue +++ b/src/modules/02_organization/components/TableMain.vue @@ -1050,7 +1050,7 @@ watch( v-model:reqMaster="reqMaster" :fetchDataTable="props.fetchDataTable" :getSummary="getSummary" - :is-position-holder="isPositionHolder" + v-model:is-position-holder="isPositionHolder" :position-holder-info="positionHolderInfo" />