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

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

View File

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