Compare commits
No commits in common. "a13995dec1f2ee89bbbe488cdc04971ff36a5160" and "1f08fc73f7622cd54b5c4ec7fcdf4323cdec59f6" have entirely different histories.
a13995dec1
...
1f08fc73f7
@ -18,11 +18,6 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
||||||
const pitchText = useRecoilValue(pitchTextSelector)
|
const pitchText = useRecoilValue(pitchTextSelector)
|
||||||
const [selectedRoof, setSelectedRoof] = useState(null)
|
const [selectedRoof, setSelectedRoof] = useState(null)
|
||||||
const [isAutoSelecting, setIsAutoSelecting] = useState(false) // 자동 선택 중인지 상태
|
|
||||||
const [autoSelectTimeout, setAutoSelectTimeout] = useState(null) // 타임아웃 참조
|
|
||||||
const autoSelectTimeoutRef = useRef(null)
|
|
||||||
// 공통 타임아웃 설정 (밀리초)
|
|
||||||
const AUTO_SELECT_TIMEOUT = 700 // API 호출 완료 대기 시간
|
|
||||||
const {
|
const {
|
||||||
trestleState,
|
trestleState,
|
||||||
trestleDetail,
|
trestleDetail,
|
||||||
@ -68,7 +63,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (roofs && roofs.length > 0 && !selectedRoof) {
|
if (roofs && !selectedRoof) {
|
||||||
console.log("roofs:::::", roofs.length)
|
console.log("roofs:::::", roofs.length)
|
||||||
setLengthBase(roofs[0].length);
|
setLengthBase(roofs[0].length);
|
||||||
setSelectedRoof(roofs[0])
|
setSelectedRoof(roofs[0])
|
||||||
@ -76,12 +71,12 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
if (selectedRoof && selectedRoof.lenAuth === "C") {
|
if (selectedRoof && selectedRoof.lenAuth === "C") {
|
||||||
onChangeLength(selectedRoof.length);
|
onChangeLength(selectedRoof.length);
|
||||||
}
|
}
|
||||||
if (selectedRoof && ["C", "R"].includes(selectedRoof.raftAuth) && roofs && roofs.length > 0) {
|
if (selectedRoof && ["C", "R"].includes(selectedRoof.raftAuth)) {
|
||||||
onChangeRaftBase(roofs[0]);
|
onChangeRaftBase(roofs[0]);
|
||||||
}
|
}
|
||||||
//모듈 설치 영역 복구
|
//모듈 설치 영역 복구
|
||||||
restoreModuleInstArea()
|
restoreModuleInstArea()
|
||||||
}, [roofs, selectedRoof]) // selectedRoof 추가
|
}, [roofs])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (flag && moduleSelectionData) {
|
if (flag && moduleSelectionData) {
|
||||||
@ -166,7 +161,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (constructionList.length > 0) {
|
if (constructionList.length > 0) {
|
||||||
const existingConstruction = constructionList.find((construction) => construction.constTp === trestleState.constTp)
|
const existingConstruction = constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp)
|
||||||
if (existingConstruction) {
|
if (existingConstruction) {
|
||||||
setSelectedConstruction(existingConstruction)
|
setSelectedConstruction(existingConstruction)
|
||||||
} else if (autoSelectStep === 'construction') {
|
} else if (autoSelectStep === 'construction') {
|
||||||
@ -257,7 +252,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
// 다음 단계(가대메이커) 자동 선택 설정 - 지연 실행
|
// 다음 단계(가대메이커) 자동 선택 설정 - 지연 실행
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setAutoSelectStep('trestle')
|
setAutoSelectStep('trestle')
|
||||||
}, AUTO_SELECT_TIMEOUT) // API 호출 완료를 위한 더 긴 지연
|
}, 500) // API 호출 완료를 위한 더 긴 지연
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeHajebichi = (e) => {
|
const onChangeHajebichi = (e) => {
|
||||||
@ -287,7 +282,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
// 다음 단계(가대메이커) 자동 선택 설정 - 지연 실행
|
// 다음 단계(가대메이커) 자동 선택 설정 - 지연 실행
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setAutoSelectStep('trestle')
|
setAutoSelectStep('trestle')
|
||||||
}, AUTO_SELECT_TIMEOUT)
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeTrestleMaker = (e) => {
|
const onChangeTrestleMaker = (e) => {
|
||||||
@ -310,7 +305,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
// API 호출 완료 후 다음 단계(공법) 자동 선택 설정
|
// API 호출 완료 후 다음 단계(공법) 자동 선택 설정
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setAutoSelectStep('constMthd')
|
setAutoSelectStep('constMthd')
|
||||||
}, AUTO_SELECT_TIMEOUT)
|
}, 300)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeConstMthd = (e) => {
|
const onChangeConstMthd = (e) => {
|
||||||
@ -330,21 +325,10 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// 기존 타임아웃 취소
|
|
||||||
if (autoSelectTimeoutRef.current) {
|
|
||||||
clearTimeout(autoSelectTimeoutRef.current)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 자동 선택 중 상태 활성화
|
|
||||||
setIsAutoSelecting(true)
|
|
||||||
|
|
||||||
// API 호출 완료 후 다음 단계(지붕밑바탕) 자동 선택 설정
|
// API 호출 완료 후 다음 단계(지붕밑바탕) 자동 선택 설정
|
||||||
const timeoutId = setTimeout(() => {
|
setTimeout(() => {
|
||||||
setAutoSelectStep('roofBase')
|
setAutoSelectStep('roofBase')
|
||||||
setIsAutoSelecting(false)
|
}, 300)
|
||||||
}, AUTO_SELECT_TIMEOUT)
|
|
||||||
|
|
||||||
autoSelectTimeoutRef.current = timeoutId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeRoofBase = (e) => {
|
const onChangeRoofBase = (e) => {
|
||||||
@ -372,7 +356,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
// API 호출 완료 후 다음 단계(construction) 자동 선택 설정
|
// API 호출 완료 후 다음 단계(construction) 자동 선택 설정
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setAutoSelectStep('construction')
|
setAutoSelectStep('construction')
|
||||||
}, AUTO_SELECT_TIMEOUT)
|
}, 300)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleConstruction = (index) => {
|
const handleConstruction = (index) => {
|
||||||
@ -467,7 +451,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
...selectedRoofBase,
|
...selectedRoofBase,
|
||||||
},
|
},
|
||||||
construction: {
|
construction: {
|
||||||
...constructionList.find((data) => newAddedRoofs[index].construction.constTp === data.constTp),
|
...constructionList.find((data) => data.constTp === trestleState.constTp),
|
||||||
cvrYn,
|
cvrYn,
|
||||||
snowGdPossYn,
|
snowGdPossYn,
|
||||||
cvrChecked,
|
cvrChecked,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user