diff --git a/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx b/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx index dd8b7003..01f08028 100644 --- a/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx +++ b/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx @@ -186,7 +186,7 @@ export default function ContextRoofAllocationSetting(props) { handleChangeInput(e, 'hajebichi', index)} /> @@ -205,8 +205,8 @@ export default function ContextRoofAllocationSetting(props) { // handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index) handleChangePitch(e, index) }} - value={currentAngleType === 'slope' ? roof.pitch : roof.angle} - defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle} + value={currentAngleType === 'slope' ? (roof.pitch || '0') : (roof.angle || '0')} + defaultValue={currentAngleType === 'slope' ? (roof.pitch || '0') : (roof.angle || '0')} /> {pitchText} diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index db39ac3a..417286e4 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -127,21 +127,25 @@ export function useRoofAllocationSetting(id) { } }) } else { - roofsArray = [ - { - planNo: planNo, - roofApply: true, - roofSeq: 0, - roofMatlCd: 'ROOF_ID_WA_53A', - roofWidth: 265, - roofHeight: 235, - roofHajebichi: 0, - roofGap: 'HEI_455', - roofLayout: 'P', - roofPitch: 4, - roofAngle: 21.8, - }, - ] + if(roofList.length > 0){ + roofsArray = roofList + }else{ + roofsArray = [ + { + planNo: planNo, + roofApply: true, + roofSeq: 0, + roofMatlCd: 'ROOF_ID_WA_53A', + roofWidth: 265, + roofHeight: 235, + roofHajebichi: 0, + roofGap: 'HEI_455', + roofLayout: 'P', + roofPitch: 4, + roofAngle: 21.8, + }, + ] + } } /** @@ -182,6 +186,9 @@ export function useRoofAllocationSetting(id) { roofSizeSet: '' + res[0].roofSizeSet, roofAngleSet: '' + res[0].roofAngleSet, }) + //데이터 동기화 + setCurrentRoofList(selectRoofs) + }) } catch (error) { console.error('Data fetching error:', error)