From c0c3295b04385f14433f02d58295c19f481ce490 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: Thu, 8 May 2025 13:21:54 +0900 Subject: [PATCH] =?UTF-8?q?[1027]=20:=20[=E3=80=90HANASYS=20DESIGN?= =?UTF-8?q?=E3=80=91=E6=A8=AA=E8=91=BA=E3=81=AB=E4=BD=BF=E7=94=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B=E9=87=91=E5=85=B7=E3=81=AE=E9=9B=A2=E9=9A=94=E3=81=AB?= =?UTF-8?q?=E3=81=A4=E3=81=84=E3=81=A6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [작업내용] : length 변경시 하위 필드 초기화 --- .../floor-plan/modal/basic/step/Trestle.jsx | 21 +++++++++++++++---- src/hooks/module/useModuleTrestle.js | 17 ++++++++++++++- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index b184670e..6a1ef3e2 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -124,7 +124,6 @@ const Trestle = forwardRef((props, ref) => { useEffect(() => { if (constructionList.length > 0) { - console.log(constructionList) setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null) } else { setSelectedConstruction(null) @@ -144,6 +143,19 @@ const Trestle = forwardRef((props, ref) => { return 'no-click' } + const onChangeLength = (e) => { + setLengthBase(e) + dispatch({ + type: 'SET_LENGTH', + roof: { + length: e, + moduleTpCd: selectedModules.itemTp ?? '', + roofMatlCd: selectedRoof?.roofMatlCd ?? '', + raftBaseCd: selectedRaftBase?.clCode, + }, + }) + } + const onChangeRaftBase = (e) => { setSelectedRaftBase(e) dispatch({ @@ -225,7 +237,8 @@ const Trestle = forwardRef((props, ref) => { snowGdPossYn: constructionList[index].snowGdPossYn, cvrYn: constructionList[index].cvrYn, mixMatlNo: selectedModules.mixMatlNo, - workingWidth: selectedRoof?.length?.toString() ?? '', + // workingWidth: selectedRoof?.length?.toString() ?? '', + workingWidth: lengthBase, }, }) @@ -242,7 +255,7 @@ const Trestle = forwardRef((props, ref) => { return { ...selectedRoof, hajebichi, - lenBase: lengthBase, + length: lengthBase, eavesMargin, ridgeMargin, kerabaMargin, @@ -518,7 +531,7 @@ const Trestle = forwardRef((props, ref) => { type="text" className="input-origin block" value={lengthBase} - onChange={(e) => setLengthBase(e.target.value)} + onChange={(e) => onChangeLength(e.target.value)} disabled={selectedRoof.lenAuth === 'R'} /> diff --git a/src/hooks/module/useModuleTrestle.js b/src/hooks/module/useModuleTrestle.js index 361ad541..e89d6089 100644 --- a/src/hooks/module/useModuleTrestle.js +++ b/src/hooks/module/useModuleTrestle.js @@ -10,6 +10,7 @@ const RAFT_BASE_CODE = '203800' const trestleReducer = (state, action) => { switch (action.type) { + case 'SET_LENGTH': case 'SET_RAFT_BASE': case 'SET_TRESTLE_MAKER': case 'SET_CONST_MTHD': @@ -96,11 +97,15 @@ export function useModuleTrestle(props) { useEffect(() => { if (trestleState) { handleSetTrestleList() + if (!trestleState?.trestleMkrCd) { setConstMthdList([]) setRoofBaseList([]) setConstructionList([]) setTrestleDetail(null) + setEavesMargin(0) + setRidgeMargin(0) + setKerabaMargin(0) return } @@ -109,6 +114,9 @@ export function useModuleTrestle(props) { setRoofBaseList([]) setConstructionList([]) setTrestleDetail(null) + setEavesMargin(0) + setRidgeMargin(0) + setKerabaMargin(0) return } @@ -116,12 +124,18 @@ export function useModuleTrestle(props) { if (!trestleState?.roofBaseCd) { setConstructionList([]) setTrestleDetail(null) + setEavesMargin(0) + setRidgeMargin(0) + setKerabaMargin(0) return } handleSetConstructionList() if (!trestleState?.constTp) { setTrestleDetail(null) + setEavesMargin(0) + setRidgeMargin(0) + setKerabaMargin(0) return } @@ -224,7 +238,8 @@ export function useModuleTrestle(props) { constTp: trestleState.constTp ?? '', mixMatlNo: trestleState.mixMatlNo ?? '', roofPitch: trestleState.roofPitch ?? '', - workingWidth: trestleState.workingWidth ?? '', + // workingWidth: trestleState.length ?? '', + workingWidth: lengthBase ?? '', }, ]) .then((res) => {