diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx index c8ece93c..ce0d093e 100644 --- a/src/components/floor-plan/modal/basic/step/Trestle.jsx +++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx @@ -239,6 +239,7 @@ const Trestle = forwardRef((props, ref) => { if (i === selectedRoof.index) { return { ...selectedRoof, + hajebichi, eavesMargin, ridgeMargin, kerabaMargin, @@ -268,8 +269,6 @@ const Trestle = forwardRef((props, ref) => { } const isComplete = async () => { - console.log('roofs', roofs) - const newAddedRoofs = roofs.map((roof, i) => { if (i === selectedRoof?.index) { return { @@ -300,7 +299,6 @@ const Trestle = forwardRef((props, ref) => { }) let result = true - console.log('newAddedRoofs', newAddedRoofs) newAddedRoofs.forEach((roof) => { if (!roof?.eavesMargin || !roof?.ridgeMargin || !roof?.kerabaMargin) result = false if (!roof.trestle?.trestleMkrCd) result = false @@ -461,7 +459,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 026f6b2c..14e93de3 100644 --- a/src/hooks/module/useModuleTrestle.js +++ b/src/hooks/module/useModuleTrestle.js @@ -23,6 +23,7 @@ const trestleReducer = (state, action) => { return { moduleTpCd: action.roof.module?.itemTp ?? '', roofMatlCd: action.roof?.roofMatlCd ?? '', + hajebichi: action.roof?.hajebichi ?? 0, raftBaseCd: action.roof?.raftBaseCd ?? null, trestleMkrCd: action.roof.trestle?.trestleMkrCd ?? null, constMthdCd: action.roof.trestle?.constMthdCd ?? null, @@ -80,7 +81,7 @@ export function useModuleTrestle(props) { // setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0) // setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0) - setHajebichi(selectedRoof?.trestle?.hajebichi ?? 0) + setHajebichi(selectedRoof?.hajebichi ?? 0) setEavesMargin(selectedRoof?.eavesMargin ?? 0) setRidgeMargin(selectedRoof?.ridgeMargin ?? 0) setKerabaMargin(selectedRoof?.kerabaMargin ?? 0) diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 675f2f7c..797985aa 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -28,6 +28,7 @@ import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupSta import { outerLinePointsState } from '@/store/outerLineAtom' import { QcastContext } from '@/app/QcastProvider' import { usePlan } from '@/hooks/usePlan' +import { roofsState } from '@/store/roofAtom' export function useRoofAllocationSetting(id) { const canvas = useRecoilValue(canvasState) @@ -54,7 +55,7 @@ export function useRoofAllocationSetting(id) { const { setIsGlobalLoading } = useContext(QcastContext) const { setSurfaceShapePattern } = useRoofFn() const { saveCanvas } = usePlan() - + const [roofsStore, setRoofsStore] = useRecoilState(roofsState) const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) const resetPoints = useResetRecoilState(outerLinePointsState) @@ -265,6 +266,8 @@ export function useRoofAllocationSetting(id) { newRoofList[0].selected = true } setCurrentRoofList(newRoofList) + setRoofsStore(newRoofList) + setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList }) } /** @@ -305,12 +308,14 @@ export function useRoofAllocationSetting(id) { setRoofList(newRoofList) setRoofMaterials(newRoofList) + setRoofsStore(newRoofList) const selectedRoofMaterial = newRoofList.find((roof) => roof.selected) setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true) drawDirectionArrow(currentObject) modifyModuleSelectionData() closeAll() basicSettingSave() + setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList }) } /** @@ -419,7 +424,7 @@ export function useRoofAllocationSetting(id) { }) setRoofMaterials(newRoofList) - + setRoofsStore(newRoofList) /** 외곽선 삭제 */ const removeTargets = canvas.getObjects().filter((obj) => obj.name === 'outerLinePoint' || obj.name === 'outerLine') removeTargets.forEach((obj) => {