diff --git a/src/components/floor-plan/modal/basic/BasicSetting.jsx b/src/components/floor-plan/modal/basic/BasicSetting.jsx index 3e22c508..79e12280 100644 --- a/src/components/floor-plan/modal/basic/BasicSetting.jsx +++ b/src/components/floor-plan/modal/basic/BasicSetting.jsx @@ -91,14 +91,14 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { useEffect(() => { if (roofsStore && addedRoofs) { console.log('πŸš€ ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs) - setRoofs( - addedRoofs.map((roof, index) => { - return { - ...roof, - ...roofsStore[index]?.addRoof, - } - }), - ) + // setRoofs( + // addedRoofs.map((roof, index) => { + // return { + // ...roof, + // ...roofsStore[index]?.addRoof, + // } + // }), + // ) setModuleSelectionData({ ...moduleSelectionData, diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index 529b2fcb..b54c12ee 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -1,6 +1,5 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider' import QSelectBox from '@/components/common/select/QSelectBox' -import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting' import { useModuleTrestle } from '@/hooks/module/useModuleTrestle' import { useMessage } from '@/hooks/useMessage' import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom' @@ -46,22 +45,18 @@ 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 [hajebichi, setHajebichi] = useState(trestleState?.roofPitch ?? 0) const [selectedRaftBase, setSelectedRaftBase] = useState(null) const [selectedTrestle, setSelectedTrestle] = useState(null) const [selectedConstMthd, setSelectedConstMthd] = useState(null) const [selectedConstruction, setSelectedConstruction] = useState(null) const [selectedRoofBase, setSelectedRoofBase] = useState(null) const { managementState } = useContext(GlobalDataContext) - const { restoreModuleInstArea } = useModuleBasicSetting() useEffect(() => { if (roofs && !selectedRoof) { setSelectedRoof(roofs[0]) } - - //λͺ¨λ“ˆ μ„€μΉ˜ μ˜μ—­ 볡ꡬ - restoreModuleInstArea() }, [roofs]) useEffect(() => { @@ -201,10 +196,12 @@ const Trestle = forwardRef((props, ref) => { stdWindSpeed: managementState?.standardWindSpeedId ?? '', stdSnowLd: +managementState?.verticalSnowCover ?? '', inclCd: selectedRoof?.pitch.toString() ?? 0, - roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0), + // roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0), + roofPitch: hajebichi ?? 0, constTp: constructionList[index].constTp, mixMatlNo: selectedModules.mixMatlNo, - workingWidth: selectedRoof?.length.toString() ?? '', + // workingWidth: selectedRoof?.length.toString() ?? '', + workingWidth: lengthBase ?? '', // snowGdPossYn: constructionList[index].snowGdPossYn, // cvrYn: constructionList[index].cvrYn, }, @@ -259,14 +256,13 @@ const Trestle = forwardRef((props, ref) => { } }) - console.log('newAddedRoofs', newAddedRoofs) - if (result) { setRoofs(newAddedRoofs) setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newAddedRoofs.map((roof, index) => { return { + roofIndex: index, addRoof: { ...moduleSelectionData.roofConstructions[index]?.addRoof, ...roof.addRoof, @@ -276,8 +272,8 @@ const Trestle = forwardRef((props, ref) => { ...moduleSelectionData.roofConstructions[index]?.trestle, }, construction: { - ...roof.construction, ...moduleSelectionData.roofConstructions[index]?.construction, + ...roof.construction, }, trestleDetail: { ...roof.trestleDetail, @@ -343,7 +339,7 @@ const Trestle = forwardRef((props, ref) => { setLengthBase(e.target.value)} disabled={selectedRoof.lenAuth === 'R'} /> @@ -384,7 +380,7 @@ const Trestle = forwardRef((props, ref) => { type="text" className="input-origin block" disabled={selectedRoof.roofPchAuth === 'R'} - onChange={(e) => handleHajebichiAndLength(e, 'hajebichi')} + onChange={(e) => setHajebichi(e.target.value)} value={hajebichi} /> diff --git a/src/hooks/module/useModuleTrestle.js b/src/hooks/module/useModuleTrestle.js index 178054ef..6d0544e3 100644 --- a/src/hooks/module/useModuleTrestle.js +++ b/src/hooks/module/useModuleTrestle.js @@ -8,8 +8,6 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider' const RAFT_BASE_CODE = '203800' const trestleReducer = (state, action) => { - console.log('πŸš€ ~ trestleReducer ~ state:', state) - console.log('πŸš€ ~ trestleReducer ~ action:', action) switch (action.type) { case 'SET_RAFT_BASE': case 'SET_TRESTLE_MAKER': @@ -21,7 +19,6 @@ const trestleReducer = (state, action) => { ...action.roof, } case 'SET_INITIALIZE': - console.log('SET_INITIALIZE') return { moduleTpCd: action.roof.moduleTpCd ?? '', roofMatlCd: action.roof.roofMatlCd ?? '', @@ -85,7 +82,6 @@ export function useModuleTrestle(props) { useEffect(() => { if (trestleState) { - console.log('πŸš€ ~ useEffect ~ trestleState:', trestleState) handleSetTrestleList() if (!trestleState.trestleMkrCd) { setConstMthdList([]) @@ -168,7 +164,7 @@ export function useModuleTrestle(props) { stdSnowLd: trestleState.stdSnowLd ?? '', inclCd: trestleState.inclCd ?? '', raftBaseCd: trestleState.raftBaseCd ?? '', - roofPitch: trestleState.roofPitch ?? '', + roofPitch: Math.round(trestleState.roofPitch) ?? '', }).then((res) => { if (res?.data) setConstructionList(res.data) }) diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index bc4d246a..428cd853 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -296,7 +296,7 @@ export function useRoofAllocationSetting(id) { }) } - return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd } + return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd, raftBaseCd: roof.raft ? roof.raft : roof.raftBaseCd } }) setBasicSetting((prev) => { @@ -308,7 +308,8 @@ export function useRoofAllocationSetting(id) { const selectedRoofMaterial = newRoofList.find((roof) => roof.selected) setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true) drawDirectionArrow(currentObject) - modifyModuleSelectionData() + setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList }) + // modifyModuleSelectionData() closeAll() basicSettingSave() } @@ -430,7 +431,8 @@ export function useRoofAllocationSetting(id) { setSelectedMenu('surface') /** λͺ¨λ“ˆ 선택 데이터 μ΄ˆκΈ°ν™” */ - modifyModuleSelectionData() + // modifyModuleSelectionData() + setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList }) } /**