dev #720
@ -7,6 +7,7 @@ import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom'
|
||||
import { roofsState } from '@/store/roofAtom'
|
||||
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||
import { forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState } from 'react'
|
||||
import { logger } from '@/util/logger'
|
||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||
import Swal from 'sweetalert2'
|
||||
import { normalizeDigits } from '@/util/input-utils'
|
||||
@ -175,6 +176,19 @@ const Trestle = forwardRef((props, ref) => {
|
||||
const existingConstruction = constructionList.find((construction) => construction.constTp === trestleState.constTp)
|
||||
if (existingConstruction) {
|
||||
setSelectedConstruction(existingConstruction)
|
||||
// 설치 불가능한 공법이면 강제 해제
|
||||
if (existingConstruction.cvrYn !== 'Y') setCvrChecked(false)
|
||||
if (existingConstruction.snowGdPossYn !== 'Y') setSnowGdChecked(false)
|
||||
const resolvedCvrChecked = existingConstruction.cvrYn === 'Y' ? cvrChecked : false
|
||||
const resolvedSnowGdChecked = existingConstruction.snowGdPossYn === 'Y' ? snowGdChecked : false
|
||||
logger.debug('[Trestle handleConstruction] 복원', {
|
||||
index: constructionList.findIndex((c) => c.constTp === existingConstruction.constTp),
|
||||
constNm: existingConstruction.constNm ?? existingConstruction.constTp,
|
||||
'cvrYn (설치가능여부)': existingConstruction.cvrYn,
|
||||
'cvrChecked (사용자선택)': resolvedCvrChecked,
|
||||
'snowGdPossYn (설치가능여부)': existingConstruction.snowGdPossYn,
|
||||
'snowGdChecked (사용자선택)': resolvedSnowGdChecked,
|
||||
})
|
||||
} else if (autoSelectStep === 'construction') {
|
||||
// 자동 선택: 첫 번째 가능한 construction 선택
|
||||
const availableConstructions = constructionList.filter((construction) => construction.constPossYn === 'Y')
|
||||
@ -411,10 +425,24 @@ const Trestle = forwardRef((props, ref) => {
|
||||
},
|
||||
})
|
||||
|
||||
setCvrYn(constructionList[index].cvrYn)
|
||||
setSnowGdPossYn(constructionList[index].snowGdPossYn)
|
||||
setCvrChecked(true)
|
||||
setSnowGdChecked(false)
|
||||
const newCvrYn = constructionList[index].cvrYn
|
||||
const newCvrChecked = newCvrYn === 'Y'
|
||||
const newSnowGdPossYn = constructionList[index].snowGdPossYn
|
||||
const newSnowGdChecked = newSnowGdPossYn === 'Y'
|
||||
|
||||
setCvrYn(newCvrYn)
|
||||
setSnowGdPossYn(newSnowGdPossYn)
|
||||
setCvrChecked(newCvrChecked)
|
||||
setSnowGdChecked(newSnowGdChecked)
|
||||
|
||||
logger.debug('[Trestle handleConstruction]', {
|
||||
index,
|
||||
constNm: constructionList[index].constNm,
|
||||
'cvrYn (설치가능여부)': newCvrYn,
|
||||
'cvrChecked (사용자선택)': newCvrChecked,
|
||||
'snowGdPossYn (설치가능여부)': newSnowGdPossYn,
|
||||
'snowGdChecked (사용자선택)': newSnowGdChecked,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,10 +470,10 @@ const Trestle = forwardRef((props, ref) => {
|
||||
...constructionList.find((data) => data.constTp === trestleState.constTp),
|
||||
cvrYn: cvrYn,
|
||||
snowGdPossYn: snowGdPossYn,
|
||||
cvrChecked: cvrChecked,
|
||||
snowGdChecked: snowGdChecked,
|
||||
setupCover: cvrChecked ?? false,
|
||||
setupSnowCover: snowGdChecked ?? false,
|
||||
cvrChecked: cvrYn === 'Y' ? cvrChecked : false,
|
||||
snowGdChecked: snowGdPossYn === 'Y' ? snowGdChecked : false,
|
||||
setupCover: cvrYn === 'Y' ? (cvrChecked ?? false) : false,
|
||||
setupSnowCover: snowGdPossYn === 'Y' ? (snowGdChecked ?? false) : false,
|
||||
},
|
||||
trestleDetail: trestleDetail,
|
||||
}
|
||||
@ -481,10 +509,10 @@ const Trestle = forwardRef((props, ref) => {
|
||||
...constructionList.find((data) => trestleState.constTp === data.constTp),
|
||||
cvrYn,
|
||||
snowGdPossYn,
|
||||
cvrChecked,
|
||||
snowGdChecked,
|
||||
setupCover: cvrChecked ?? false,
|
||||
setupSnowCover: snowGdChecked ?? false,
|
||||
cvrChecked: cvrYn === 'Y' ? cvrChecked : false,
|
||||
snowGdChecked: snowGdPossYn === 'Y' ? snowGdChecked : false,
|
||||
setupCover: cvrYn === 'Y' ? (cvrChecked ?? false) : false,
|
||||
setupSnowCover: snowGdPossYn === 'Y' ? (snowGdChecked ?? false) : false,
|
||||
},
|
||||
trestleDetail: trestleDetail,
|
||||
}
|
||||
@ -861,7 +889,11 @@ const Trestle = forwardRef((props, ref) => {
|
||||
disabled={!cvrYn || cvrYn === 'N'}
|
||||
checked={!cvrYn || cvrYn === 'N' ? false : cvrChecked ?? true}
|
||||
// onChange={() => dispatch({ type: 'SET_TRESTLE_DETAIL', roof: { ...trestleState, cvrChecked: !trestleState.cvrChecked } })}
|
||||
onChange={() => setCvrChecked(!cvrChecked)}
|
||||
onChange={() => {
|
||||
const next = !cvrChecked
|
||||
setCvrChecked(next)
|
||||
logger.debug('[처마커버 체크 변경]', { 'cvrYn (설치가능여부)': cvrYn, 'cvrChecked (사용자선택)': next })
|
||||
}}
|
||||
/>
|
||||
<label htmlFor={`ch01`}>{getMessage('modal.module.basic.setting.module.eaves.bar.fitting')}</label>
|
||||
</div>
|
||||
@ -872,7 +904,11 @@ const Trestle = forwardRef((props, ref) => {
|
||||
disabled={!snowGdPossYn || snowGdPossYn === 'N'}
|
||||
checked={snowGdChecked || false}
|
||||
// onChange={() => dispatch({ type: 'SET_TRESTLE_DETAIL', roof: { ...trestleState, snowGdChecked: !trestleState.snowGdChecked } })}
|
||||
onChange={() => setSnowGdChecked(!snowGdChecked)}
|
||||
onChange={() => {
|
||||
const next = !snowGdChecked
|
||||
setSnowGdChecked(next)
|
||||
logger.debug('[눈막이 체크 변경]', { 'snowGdPossYn (설치가능여부)': snowGdPossYn, 'snowGdChecked (사용자선택)': next })
|
||||
}}
|
||||
/>
|
||||
<label htmlFor={`ch02`}>{getMessage('modal.module.basic.setting.module.blind.metal.fitting')}</label>
|
||||
</div>
|
||||
|
||||
@ -5,6 +5,7 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||
import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||
import { isObjectNotEmpty, isEqualObjects } from '@/util/common-utils'
|
||||
import { logger } from '@/util/logger'
|
||||
|
||||
export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) {
|
||||
const globalPitchText = useRecoilValue(pitchTextSelector) //피치 텍스트
|
||||
@ -285,17 +286,58 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
||||
selectedConstruction.setupSnowCover = false //눈막이금구 설치 여부
|
||||
selectedConstruction.selectedIndex = index
|
||||
|
||||
logger.debug('[handleConstruction] 공법 선택', {
|
||||
index,
|
||||
constNm: selectedConstruction.constNm,
|
||||
cvrYn: selectedConstruction.cvrYn,
|
||||
snowGdPossYn: selectedConstruction.snowGdPossYn,
|
||||
moduleConstructionSelectionData,
|
||||
})
|
||||
|
||||
setCvrYn(selectedConstruction.cvrYn)
|
||||
setSnowGdPossYn(selectedConstruction.snowGdPossYn)
|
||||
|
||||
//기존에 선택된 데이터가 있으면 체크한다
|
||||
//기존에 선택된 데이터가 있으면 복원
|
||||
if (moduleConstructionSelectionData && moduleConstructionSelectionData.construction) {
|
||||
selectedConstruction.setupCover = moduleConstructionSelectionData.construction.setupCover || false
|
||||
selectedConstruction.setupSnowCover = moduleConstructionSelectionData.construction.setupSnowCover || false
|
||||
setCvrChecked(selectedConstruction.setupCover)
|
||||
setSnowGdChecked(selectedConstruction.setupSnowCover)
|
||||
logger.debug('[handleConstruction] 기존 데이터 복원', {
|
||||
setupCover: selectedConstruction.setupCover,
|
||||
setupSnowCover: selectedConstruction.setupSnowCover,
|
||||
})
|
||||
} else {
|
||||
// 최초 선택: 설치 가능하면 디폴트 체크
|
||||
const defaultCvr = selectedConstruction.cvrYn === 'Y'
|
||||
const defaultSnowGd = selectedConstruction.snowGdPossYn === 'Y'
|
||||
selectedConstruction.setupCover = defaultCvr
|
||||
selectedConstruction.setupSnowCover = defaultSnowGd
|
||||
setCvrChecked(defaultCvr)
|
||||
setSnowGdChecked(defaultSnowGd)
|
||||
logger.debug('[handleConstruction] 최초 선택 디폴트', {
|
||||
defaultCvr,
|
||||
defaultSnowGd,
|
||||
})
|
||||
}
|
||||
|
||||
// 설치 불가능한 공법이면 강제 해제
|
||||
if (selectedConstruction.cvrYn !== 'Y') {
|
||||
selectedConstruction.setupCover = false
|
||||
setCvrChecked(false)
|
||||
logger.debug('[handleConstruction] 처마커버 강제 해제 (cvrYn !== Y)')
|
||||
}
|
||||
if (selectedConstruction.snowGdPossYn !== 'Y') {
|
||||
selectedConstruction.setupSnowCover = false
|
||||
setSnowGdChecked(false)
|
||||
logger.debug('[handleConstruction] 눈막이 강제 해제 (snowGdPossYn !== Y)')
|
||||
}
|
||||
|
||||
logger.debug('[handleConstruction] 최종 상태', {
|
||||
setupCover: selectedConstruction.setupCover,
|
||||
setupSnowCover: selectedConstruction.setupSnowCover,
|
||||
})
|
||||
|
||||
setSelectedConstruction(selectedConstruction)
|
||||
} else {
|
||||
constructionRef.current.forEach((ref) => {
|
||||
|
||||
@ -315,6 +315,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
// console.log('yInversion', yInversion) //좌우반전
|
||||
|
||||
changeSurfaceLineType(batchSurface)
|
||||
setPolygonLinesActualSize(batchSurface, true)
|
||||
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
})
|
||||
@ -1670,6 +1671,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
drawDirectionArrow(currentObject)
|
||||
setTimeout(() => {
|
||||
changeSurfaceLineType(currentObject)
|
||||
setPolygonLinesActualSize(currentObject, true)
|
||||
currentObject.dirty = true
|
||||
currentObject.setCoords()
|
||||
canvas.renderAll()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user