From d8e43b0d8191ccd9c6b66b8ce3d77ff613df663c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=8B=9D?= <43837214+Minsiki@users.noreply.github.com> Date: Wed, 2 Apr 2025 15:19:00 +0900 Subject: [PATCH 1/2] =?UTF-8?q?BasicSetting=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/modal/basic/BasicSetting.jsx | 2 +- .../floor-plan/modal/basic/step/Trestle.jsx | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/floor-plan/modal/basic/BasicSetting.jsx b/src/components/floor-plan/modal/basic/BasicSetting.jsx index 1f19f950..240d1514 100644 --- a/src/components/floor-plan/modal/basic/BasicSetting.jsx +++ b/src/components/floor-plan/modal/basic/BasicSetting.jsx @@ -42,7 +42,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { const [basicSetting, setBasicSettings] = useRecoilState(basicSettingState) const [isClosePopup, setIsClosePopup] = useState({ close: false, id: 0 }) const [checkedModules, setCheckedModules] = useRecoilState(checkedModuleState) - const [roofs, setRoofs] = useState(null) + const [roofs, setRoofs] = useState(addedRoofs) const { moduleSelectionInitParams, selectedModules, diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index a6c62750..dd5a7529 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -258,9 +258,19 @@ const Trestle = forwardRef((props, ref) => { setRoofs(newAddedRoofs) setModuleSelectionData({ ...moduleSelectionData, - roofConstruction: { - ...newAddedRoofs, - }, + roofConstructions: newAddedRoofs.map((roof) => { + return { + addRoof: { + ...roof.addRoof, + }, + trestle: { + ...roof.trestle, + }, + construction: { + ...roof.construction, + }, + } + }), }) trestleTrigger({ roofConstruction: newAddedRoofs.map((roof) => { From 82632b962e93eaaae4731c1cebbc1e90fc7b3516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=8B=9D?= <43837214+Minsiki@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:55:23 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Trestle=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/modal/basic/step/Trestle.jsx | 11 ++++++++++- src/hooks/module/useModuleTrestle.js | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index dd5a7529..e3d093a7 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -18,6 +18,7 @@ const Trestle = forwardRef((props, ref) => { const [selectedRoof, setSelectedRoof] = useState() const { trestleState, + trestleDetail, dispatch, raftBaseList, trestleList, @@ -171,6 +172,7 @@ const Trestle = forwardRef((props, ref) => { snowGdPossYn, cvrChecked, snowGdChecked, + trestleDetail, } } return { ...roof } @@ -224,6 +226,7 @@ const Trestle = forwardRef((props, ref) => { snowGdPossYn, cvrChecked, snowGdChecked, + trestleDetail, } } return { ...roof } @@ -258,16 +261,22 @@ const Trestle = forwardRef((props, ref) => { setRoofs(newAddedRoofs) setModuleSelectionData({ ...moduleSelectionData, - roofConstructions: newAddedRoofs.map((roof) => { + roofConstructions: newAddedRoofs.map((roof, index) => { return { addRoof: { ...roof.addRoof, + ...moduleSelectionData.roofConstructions[index].addRoof, }, trestle: { ...roof.trestle, + ...moduleSelectionData.roofConstructions[index].trestle, }, construction: { ...roof.construction, + ...moduleSelectionData.roofConstructions[index].construction, + }, + trestleDetail: { + ...roof.trestleDetail, }, } }), diff --git a/src/hooks/module/useModuleTrestle.js b/src/hooks/module/useModuleTrestle.js index d0838b34..178054ef 100644 --- a/src/hooks/module/useModuleTrestle.js +++ b/src/hooks/module/useModuleTrestle.js @@ -64,6 +64,7 @@ export function useModuleTrestle(props) { const [ridgeMargin, setRidgeMargin] = useState(0) const [kerabaMargin, setKerabaMargin] = useState(0) const [trestleState, dispatch] = useReducer(trestleReducer, null) + const [trestleDetail, setTrestleDetail] = useState(null) useEffect(() => { const raftCodeList = findCommonCode(RAFT_BASE_CODE) @@ -90,6 +91,7 @@ export function useModuleTrestle(props) { setConstMthdList([]) setRoofBaseList([]) setConstructionList([]) + setTrestleDetail(null) return } @@ -97,17 +99,20 @@ export function useModuleTrestle(props) { if (!trestleState.constMthdCd) { setRoofBaseList([]) setConstructionList([]) + setTrestleDetail(null) return } handleSetRoofBaseList() if (!trestleState.roofBaseCd) { setConstructionList([]) + setTrestleDetail(null) return } handleSetConstructionList() if (!trestleState.constTp) { + setTrestleDetail(null) return } @@ -193,6 +198,7 @@ export function useModuleTrestle(props) { setEavesMargin(res[0].data.eaveIntvl) setRidgeMargin(res[0].data.ridgeIntvl) setKerabaMargin(res[0].data.kerabaIntvl) + setTrestleDetail(res[0].data) // dispatch({ // type: 'SET_TRESTLE_DETAIL', // roof: { @@ -208,6 +214,7 @@ export function useModuleTrestle(props) { return { trestleState, + trestleDetail, dispatch, raftBaseList, trestleList,