From 02062ee4d190e4696c2634c5ae5a1ed9fe40b7cc Mon Sep 17 00:00:00 2001 From: ysCha Date: Fri, 5 Jun 2026 15:51:46 +0900 Subject: [PATCH] =?UTF-8?q?[1529]=20=EC=8B=9C=EA=B3=B5=EB=B2=95=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20constTp=20=EB=A7=A4=ED=95=91=20=E2=80=94?= =?UTF-8?q?=20WORK=5FLV=5FID=5F-2(=E6=A8=99=E6=BA=96=E6=96=BD=E5=B7=A5?= =?UTF-8?q?=E2=85=A1)=20=EC=8B=A0=EA=B7=9C=20=ED=95=AD=EB=AA=A9=20?= =?UTF-8?q?=EB=8C=80=EC=9D=91=20+=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=20?= =?UTF-8?q?=EB=B0=80=EB=A6=BC=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4 --- .../modal/basic/step/ModuleTabContents.jsx | 62 ++++++++----------- .../floor-plan/modal/basic/step/Trestle.jsx | 34 +++++----- src/hooks/module/useModuleTabContents.js | 11 ++-- 3 files changed, 50 insertions(+), 57 deletions(-) diff --git a/src/components/floor-plan/modal/basic/step/ModuleTabContents.jsx b/src/components/floor-plan/modal/basic/step/ModuleTabContents.jsx index 9fd7da9a..70f1f1ab 100644 --- a/src/components/floor-plan/modal/basic/step/ModuleTabContents.jsx +++ b/src/components/floor-plan/modal/basic/step/ModuleTabContents.jsx @@ -1,6 +1,5 @@ import { useState, useEffect } from 'react' import { useMessage } from '@/hooks/useMessage' -import { isObjectNotEmpty } from '@/util/common-utils' import QSelectBox from '@/components/common/select/QSelectBox' import { useModuleTabContents } from '@/hooks/module/useModuleTabContents' import { useRecoilValue } from 'recoil' @@ -170,41 +169,32 @@ export default function ModuleTabContents({ tabIndex, addRoof, setAddedRoofs, ro
- - - - - + {/* 2026-06-05 공법 버튼을 배열 인덱스 대신 constTp로 매핑 — API 응답 항목 추가/순서변경(예: 標準施工(Ⅱ) WORK_LV_ID_-2) 시 인덱스 밀림 방지. 운영(구 API)엔 -2가 없어 optional 은 데이터 있을 때만 렌더 */} + {[ + { constTp: 'WORK_LV_ID_-1', label: '標準施工(Ⅰ)' }, + { constTp: 'WORK_LV_ID_-2', label: '標準施工(Ⅱ)', optional: true }, + { constTp: 'WORK_LV_ID_1', label: '標準施工' }, + { constTp: 'WORK_LV_ID_3', label: '強化施工' }, + { constTp: 'WORK_LV_ID_4', label: '多設施工' }, + { constTp: 'WORK_LV_ID_5', label: '多設施工(II)' }, + ].map(({ constTp, label, optional }) => { + const index = constructionList.findIndex((c) => c.constTp === constTp) + const item = index > -1 ? constructionList[index] : null + if (optional && !item) return null + const enabled = item && item.constPossYn === 'Y' + return ( + + ) + })}
diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index dd2e64ca..98a4c4ee 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -217,7 +217,7 @@ const Trestle = forwardRef((props, ref) => { }, [constructionList, autoSelectStep]) const getConstructionState = (index) => { - if (constructionList && constructionList.length > 0) { + if (index > -1 && constructionList && constructionList.length > 0 && constructionList[index]) { if (constructionList[index].constPossYn === 'Y') { if (trestleState && trestleState.constTp === constructionList[index].constTp) { return 'blue' @@ -865,21 +865,23 @@ const Trestle = forwardRef((props, ref) => {
- - - - - + {/* 2026-06-05 공법 버튼을 배열 인덱스 대신 constTp로 매핑 — API 응답 항목 추가/순서변경(예: 標準施工(II) WORK_LV_ID_-2) 시 인덱스 밀림 방지. 운영(구 API)엔 -2가 없어 optional 은 데이터 있을 때만 렌더 */} + {[ + { constTp: 'WORK_LV_ID_-1', label: `${getMessage('modal.module.basic.setting.module.standard.construction')}(I)` }, + { constTp: 'WORK_LV_ID_-2', label: `${getMessage('modal.module.basic.setting.module.standard.construction')}(II)`, optional: true }, + { constTp: 'WORK_LV_ID_1', label: getMessage('modal.module.basic.setting.module.standard.construction') }, + { constTp: 'WORK_LV_ID_3', label: getMessage('modal.module.basic.setting.module.enforce.construction') }, + { constTp: 'WORK_LV_ID_4', label: getMessage('modal.module.basic.setting.module.multiple.construction') }, + { constTp: 'WORK_LV_ID_5', label: `${getMessage('modal.module.basic.setting.module.multiple.construction')}(II)` }, + ].map(({ constTp, label, optional }) => { + const index = constructionList.findIndex((c) => c.constTp === constTp) + if (optional && index === -1) return null + return ( + + ) + })}
diff --git a/src/hooks/module/useModuleTabContents.js b/src/hooks/module/useModuleTabContents.js index 5f82f939..7fe24f64 100644 --- a/src/hooks/module/useModuleTabContents.js +++ b/src/hooks/module/useModuleTabContents.js @@ -175,9 +175,10 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab isObjectNotEmpty(moduleConstructionSelectionData?.construction) && moduleConstructionSelectionData?.construction.hasOwnProperty('constPossYn') ///키가 있으면 ) { - const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex - const construction = constructionList[selectedIndex] - if (construction.constPossYn === 'Y') { + // 2026-06-05 저장값 복원도 constTp 기준 — 항목 추가/순서변경으로 selectedIndex 가 어긋나는 문제 방지 + const selectedIndex = constructionList.findIndex((c) => c.constTp === moduleConstructionSelectionData.construction.constTp) + const construction = selectedIndex > -1 ? constructionList[selectedIndex] : null + if (construction && construction.constPossYn === 'Y') { handleConstruction(selectedIndex) } } @@ -268,7 +269,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab const handleConstruction = (index) => { if (index > -1) { const isPossibleIndex = constructionRef.current - .map((el, i) => (el.classList.contains('white') || el.classList.contains('blue') ? i : -1)) + .map((el, i) => (el && (el.classList.contains('white') || el.classList.contains('blue')) ? i : -1)) .filter((index) => index !== -1) isPossibleIndex.forEach((index) => { @@ -341,7 +342,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab setSelectedConstruction(selectedConstruction) } else { constructionRef.current.forEach((ref) => { - ref.classList.remove('blue') + if (ref) ref.classList.remove('blue') }) } }