diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index 3c0d8e8a..c8ece93c 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -31,6 +31,10 @@ const Trestle = forwardRef((props, ref) => { setEavesMargin, setRidgeMargin, setKerabaMargin, + lengthBase, + setLengthBase, + hajebichi, + setHajebichi, cvrYn, cvrChecked, snowGdPossYn, @@ -44,8 +48,6 @@ const Trestle = forwardRef((props, ref) => { }) const selectedModules = useRecoilValue(selectedModuleState) //선택된 모듈 // const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) - const [lengthBase, setLengthBase] = useState(0) - const [hajebichi, setHajebichi] = useState(0) const [selectedRaftBase, setSelectedRaftBase] = useState(null) const [selectedTrestle, setSelectedTrestle] = useState(null) const [selectedConstMthd, setSelectedConstMthd] = useState(null) @@ -75,11 +77,6 @@ const Trestle = forwardRef((props, ref) => { useEffect(() => { if (selectedRoof) { - setHajebichi(selectedRoof.hajebichi) - setEavesMargin(selectedRoof?.eavesMargin ?? 0) - setRidgeMargin(selectedRoof?.ridgeMargin ?? 0) - setKerabaMargin(selectedRoof?.kerabaMargin ?? 0) - setLengthBase(Math.round(selectedRoof?.lenBase ?? 0)) if (moduleSelectionData?.roofConstructions?.length >= selectedRoof.index + 1) { const { construction, trestle, trestleDetail } = moduleSelectionData?.roofConstructions[selectedRoof.index] dispatch({ @@ -223,10 +220,10 @@ const Trestle = forwardRef((props, ref) => { inclCd: selectedRoof?.pitch ?? 0, roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0), constTp: constructionList[index].constTp, + snowGdPossYn: constructionList[index].snowGdPossYn, + cvrYn: constructionList[index].cvrYn, mixMatlNo: selectedModules.mixMatlNo, workingWidth: selectedRoof?.length?.toString() ?? '', - // snowGdPossYn: constructionList[index].snowGdPossYn, - // cvrYn: constructionList[index].cvrYn, }, }) @@ -247,6 +244,7 @@ const Trestle = forwardRef((props, ref) => { kerabaMargin, roofIndex: selectedRoof.index, trestle: { + hajebichi: hajebichi, lengthBase: lengthBase, ...selectedRaftBase, ...selectedTrestle, @@ -255,6 +253,10 @@ const Trestle = forwardRef((props, ref) => { }, construction: { ...constructionList.find((data) => data.constTp === trestleState.constTp), + cvrYn: cvrYn, + snowGdPossYn: snowGdPossYn, + cvrChecked: cvrChecked, + snowGdChecked: snowGdChecked, }, trestleDetail: trestleDetail, } @@ -278,6 +280,7 @@ const Trestle = forwardRef((props, ref) => { roofIndex: roof.index, trestle: { lengthBase: lengthBase, + hajebichi: hajebichi, ...selectedRaftBase, ...selectedTrestle, ...selectedConstMthd, @@ -285,6 +288,10 @@ const Trestle = forwardRef((props, ref) => { }, construction: { ...constructionList.find((data) => data.constTp === trestleState.constTp), + cvrYn, + snowGdPossYn, + cvrChecked, + snowGdChecked, }, trestleDetail: trestleDetail, } @@ -357,7 +364,8 @@ const Trestle = forwardRef((props, ref) => { raftBaseCd: roof.raftBaseCd, }, construction: { - ...constructionList.find((construction) => newAddedRoofs[index].construction.constTp === construction.constTp), + // ...constructionList.find((construction) => newAddedRoofs[index].construction.constTp === construction.constTp), + ...roof.construction, roofIndex: roof.index, setupCover: roof.cvrYn === 'Y', setupSnowCover: roof.snowGdYn === 'Y', @@ -380,8 +388,6 @@ const Trestle = forwardRef((props, ref) => { return false } - const getFlag = () => {} - useImperativeHandle(ref, () => ({ isComplete, })) @@ -553,7 +559,7 @@ const Trestle = forwardRef((props, ref) => { dispatch({ type: 'SET_TRESTLE_DETAIL', roof: { ...trestleState, snowGdChecked: !trestleState.snowGdChecked } })} onChange={() => setSnowGdChecked(!snowGdChecked)} diff --git a/src/hooks/module/useModuleTrestle.js b/src/hooks/module/useModuleTrestle.js index 60b1a7fb..5c50a706 100644 --- a/src/hooks/module/useModuleTrestle.js +++ b/src/hooks/module/useModuleTrestle.js @@ -54,6 +54,9 @@ export function useModuleTrestle(props) { const [roofBaseList, setRoofBaseList] = useState([]) const [constructionList, setConstructionList] = useState([]) const { getTrestleList, getConstructionList, getTrestleDetailList } = useMasterController() + + const [lengthBase, setLengthBase] = useState(0) + const [hajebichi, setHajebichi] = useState(0) const [cvrYn, setCvrYn] = useState('N') const [cvrChecked, setCvrChecked] = useState(false) const [snowGdPossYn, setSnowGdPossYn] = useState('N') @@ -76,6 +79,12 @@ export function useModuleTrestle(props) { // setEavesMargin(selectedRoof?.addRoof?.eavesMargin ?? 0) // setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0) // setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0) + + setHajebichi(selectedRoof?.trestle?.hajebichi ?? 0) + setEavesMargin(selectedRoof?.eavesMargin ?? 0) + setRidgeMargin(selectedRoof?.ridgeMargin ?? 0) + setKerabaMargin(selectedRoof?.kerabaMargin ?? 0) + setLengthBase(Math.round(selectedRoof?.trestle?.lengthBase ?? 0)) setCvrYn(selectedRoof?.construction?.cvrYn ?? 'N') setCvrChecked(selectedRoof?.construction?.cvrChecked ?? false) setSnowGdPossYn(selectedRoof?.construction?.snowGdPossYn ?? 'N') @@ -224,6 +233,7 @@ export function useModuleTrestle(props) { setRidgeMargin(res[0].data.ridgeIntvl) setKerabaMargin(res[0].data.kerabaIntvl) setTrestleDetail(res[0].data) + // dispatch({ // type: 'SET_TRESTLE_DETAIL', // roof: { @@ -255,6 +265,14 @@ export function useModuleTrestle(props) { handleSetRoofBaseList, handleSetConstructionList, handleSetTrestleDetailData, + lengthBase, + setLengthBase, + hajebichi, + setHajebichi, + cvrYn, + cvrChecked, + snowGdPossYn, + snowGdChecked, eavesMargin, ridgeMargin, kerabaMargin,