From 1ebfc83452dab1f3e348f3aa489e36e7f867a87b Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 25 Aug 2025 12:11:16 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=3D=3D>=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=20=20=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=AA?= =?UTF-8?q?=E0=B9=88=E0=B8=87=20ID=20=E0=B8=95=E0=B8=AD=E0=B8=99=20?= =?UTF-8?q?=E0=B8=84=E0=B8=B1=E0=B8=94=E0=B8=A5=E0=B8=AD=E0=B8=87=E0=B9=81?= =?UTF-8?q?=E0=B8=A5=E0=B8=B0=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?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 --- .../components/DialogFormPosition.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/02_organization/components/DialogFormPosition.vue b/src/modules/02_organization/components/DialogFormPosition.vue index 594b1d881..f556432b9 100644 --- a/src/modules/02_organization/components/DialogFormPosition.vue +++ b/src/modules/02_organization/components/DialogFormPosition.vue @@ -280,6 +280,8 @@ function onSubmit() { } else { //ถ้ามีแสดง dialog ยืนยัน dialogConfirm($q, async () => { + const isAddOrCopy = + props.actionType === "ADD" || props.actionType === "COPY"; const positionsData = rows.value.map( (e: RowDetailPositions, index: number) => ({ id: !e.isNew ? e.id : null, //id รายการตำแหน่ง @@ -299,6 +301,11 @@ function onSubmit() { }) ); + // สร้างข้อมูลตำแหน่งใหม่ ถ้าเป็นการเพิ่มหรือคัดลอกไม่เอา ID + const positionNew = isAddOrCopy + ? positionsData.map(({ id, ...rest }) => rest) + : positionsData; + const body = { posMasterNoPrefix: formData.prefixNo, //*Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ) posMasterNo: Number(formData.positionNo), //*เลขที่ตำแหน่ง เป็นตัวเลข @@ -313,16 +320,14 @@ function onSubmit() { orgChild2Id: getOrgIdByLevel(2), orgChild3Id: getOrgIdByLevel(3), orgChild4Id: getOrgIdByLevel(4), - positions: positionsData, + positions: positionNew, }; showLoader(); try { - const isAddOrCopy = - props.actionType === "ADD" || props.actionType === "COPY"; - if (isAddOrCopy) { await http.post(config.API.orgPosMaster, body); + await Promise.all([ props.fetchDataTable?.( reqMaster.value.id,