배치면초기설정 서까래 수정

This commit is contained in:
changkyu choi 2025-01-16 18:14:52 +09:00
parent e8078177f4
commit d73daf1024
2 changed files with 41 additions and 33 deletions

View File

@ -56,20 +56,25 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
]
//
useEffect(() => {
if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return
const raftCodeList = findCommonCode('203800')
setRaftCodes(raftCodeList)
// useEffect(() => {
// if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return
// const raftCodeList = findCommonCode('203800')
// setRaftCodes(raftCodeList)
// console.log('🚀 ~ useEffect ~ >>>>>>>>>>>>> raftCodeList 11 :', raftCodeList)
if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) {
setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet })
} else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) {
setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet })
}
}, [])
// if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) {
// setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet })
// } else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) {
// setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet })
// }
// }, [])
useEffect(() => {
if (addedRoofs.length > 0) {
const raftCodeList = findCommonCode('203800')
setRaftCodes(raftCodeList)
setCurrentRoof({ ...addedRoofs[0] })
}
}, [addedRoofs])
@ -155,20 +160,20 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
...roofInfo,
},
//roofs: addedRoofs,
roofsData: {
roofApply: true,
roofSeq: 0,
roofMatlCd: currentRoof.roofMatlCd,
roofWidth: currentRoof.width,
roofHeight: currentRoof.length,
roofHajebichi: currentRoof.hajebichi,
roofGap: currentRoof.raft,
roofLayout: currentRoof.layout,
roofSizeSet: currentRoof.roofSizeSet,
roofAngleSet: currentRoof.roofAngleSet,
roofPitch: currentRoof.pitch,
roofAngle: currentRoof.angle,
},
// roofsData: {
// roofApply: true,
// roofSeq: 0,
// roofMatlCd: currentRoof.roofMatlCd,
// roofWidth: currentRoof.width,
// roofHeight: currentRoof.length,
// roofHajebichi: currentRoof.hajebichi,
// roofGap: currentRoof.raft,
// roofLayout: currentRoof.layout,
// roofSizeSet: currentRoof.roofSizeSet,
// roofAngleSet: currentRoof.roofAngleSet,
// roofPitch: currentRoof.pitch,
// roofAngle: currentRoof.angle,
// },
})
basicSettingSave()
@ -338,13 +343,13 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
{currentRoof && ['C', 'R'].includes(currentRoof.raftAuth) && (
<div className="flex-ment">
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
{raftCodes.length > 0 && (
{raftCodes?.length > 0 && (
<div className="select-wrap" style={{ width: '160px' }}>
<QSelectBox
options={raftCodes}
ref={roofRef.rafter}
title={
raftCodes.find((r) => r.clCode === (currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft)).clCodeNm
raftCodes?.find((r) => r.clCode === (currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft)).clCodeNm
}
value={currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft}
onChange={(e) => handleRafterChange(e.clCode)}

View File

@ -48,7 +48,7 @@ const defaultDotLineGridSetting = {
LINE: false,
}
let previousRoofMaterialsYn = 'N' // 지붕재 select 정보 비교 후 변경된 것이 없으면 1회만 실행
//let previousRoofMaterialsYn = 'N' // 지붕재 select 정보 비교 후 변경된 것이 없으면 1회만 실행
export function useCanvasSetting() {
const canvas = useRecoilValue(canvasState)
@ -159,21 +159,23 @@ export function useCanvasSetting() {
setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial })
}
const previousObjectNoRef = useRef(null)
const previousRoofMaterialsRef = useRef(null)
useEffect(() => {
// 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
if (roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials)) {
// 지붕재 select 정보 비교 후 변경된 것이 없으면 1회만 실행
if (roofMaterials && previousRoofMaterialsYn === 'N') {
if (!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo
|| roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials)) {
if (roofMaterials) {
fetchBasicSettings()
previousRoofMaterialsYn = 'Y'
}
// 이전 값을 업데이트
previousObjectNoRef.current = correntObjectNo
previousRoofMaterialsRef.current = roofMaterials
}
}, [roofMaterials])
}, [roofMaterials, correntObjectNo])
useEffect(() => {
if (!canvas) {
@ -328,6 +330,7 @@ export function useCanvasSetting() {
roofGap: 'HEI_455',
roofLayout: 'P',
roofPitch: 4,
roofAngle: 21.8,
},
]
}