trestleDetail 작업

This commit is contained in:
yjnoh 2025-04-08 17:43:19 +09:00
parent 597aaa6d42
commit 00a201704b
4 changed files with 30 additions and 44 deletions

View File

@ -84,6 +84,18 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
useModuleBasicSetting(tabNum)
const { updateObjectDate } = useMasterController()
useEffect(() => {
let hasModules = canvas
.getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
.some((obj) => obj.modules?.length > 0)
if (hasModules) {
orientationRef.current.handleNextStep()
setTabNum(3)
}
}, [])
useEffect(() => {
if (roofsStore && addedRoofs) {
setRoofs(
@ -113,18 +125,6 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
}
}, [roofsStore, addedRoofs])
useEffect(() => {
let hasModules = canvas
.getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
.some((obj) => obj.modules?.length > 0)
if (hasModules) {
orientationRef.current.handleNextStep()
setTabNum(3)
}
}, [])
useEffect(() => {
if (basicSetting.roofSizeSet !== '3') {
manualModuleSetup()

View File

@ -266,6 +266,8 @@ const Trestle = forwardRef((props, ref) => {
}
const isComplete = async () => {
console.log('roofs', roofs)
const newAddedRoofs = roofs.map((roof, i) => {
if (i === selectedRoof?.index) {
return {
@ -291,6 +293,7 @@ const Trestle = forwardRef((props, ref) => {
})
let result = true
console.log('newAddedRoofs', newAddedRoofs)
newAddedRoofs.forEach((roof) => {
if (!roof?.eavesMargin || !roof?.ridgeMargin || !roof?.kerabaMargin) result = false
if (!roof.trestle?.trestleMkrCd) result = false

View File

@ -91,16 +91,10 @@ export function useModuleBasicSetting(tabNum) {
const roofConstructions = moduleSelectionData.roofConstructions
if (roofConstructions && roofConstructions.length > 0) {
const listParams = roofConstructions.map((item) => {
return {
...common,
...item.addRoof,
...item.trestle,
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
inclCd: String(item.addRoof.pitch),
}
})
setTrestleDetailParams(listParams)
//roofIndex 넣기
const roofConstructionArray = roofConstructions.map((detail) => ({ ...detail.trestleDetail, roofIndex: detail.roofIndex }))
setTrestleDetailList(roofConstructionArray)
//북면 설치 가능 판매점
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
@ -119,23 +113,10 @@ export function useModuleBasicSetting(tabNum) {
}
}
//가대 상세 데이터 조회
const getTrestleDetailListData = async () => {
const trestleDetailList = await getTrestleDetailList(trestleDetailParams)
if (trestleDetailList.length > 0) {
setTrestleDetailList(trestleDetailList)
}
}
//가대 상세 데이터 파라메터 담기면 실행
useEffect(() => {
if (trestleDetailParams.length > 0) {
getTrestleDetailListData(trestleDetailParams)
}
}, [trestleDetailParams])
//가대 상세 데이터 들어오면 실행
useEffect(() => {
console.log('trestleDetailList', trestleDetailList)
if (trestleDetailList.length > 0) {
let rowColArray = []
//지붕을 가져옴
@ -147,11 +128,11 @@ export function useModuleBasicSetting(tabNum) {
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
trestleDetailList.forEach((detail) => {
if (detail.data !== null) {
if (Number(detail.data.roofIndex) === roofIndex) {
if (isObjectNotEmpty(detail)) {
if (Number(detail.roofIndex) === roofIndex) {
//roof에 상세 데이터 추가
roof.set({
trestleDetail: detail.data,
trestleDetail: detail,
stroke: roofOutlineColor(roofIndex),
strokeWidth: 7,
})
@ -162,7 +143,7 @@ export function useModuleBasicSetting(tabNum) {
line.attributes = { ...line.attributes, offset: getOffset(offsetObjects.addRoof, line.attributes.type) }
})
//배치면 설치 영역
makeModuleInstArea(roof, detail.data)
makeModuleInstArea(roof, detail)
}
}
})
@ -170,8 +151,8 @@ export function useModuleBasicSetting(tabNum) {
trestleDetailList.forEach((detail) => {
const moduleRowArray = []
if (detail.data !== null && detail.data.module.length > 0) {
detail.data.module.forEach((module) => {
if (isObjectNotEmpty(detail) && detail.module.length > 0) {
detail.module.forEach((module) => {
moduleRowArray.push({ moduleMaxRows: module.moduleMaxRows, mixModuleMaxRows: module.mixModuleMaxRows })
})
}
@ -407,6 +388,8 @@ export function useModuleBasicSetting(tabNum) {
//모듈,회로에서 다른메뉴 -> 배치면으로 갈 경수 초기화
const restoreModuleInstArea = () => {
console.log('tabnum', tabNum)
//설치면 삭제
const setupArea = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE || obj.name === POLYGON_TYPE.OBJECT_SURFACE)

View File

@ -96,7 +96,7 @@ export function useModuleSelection(props) {
getModuleData(roofsIds)
//모듈설치면 초기화
restoreModuleInstArea()
// restoreModuleInstArea()
resetStatisticsData()
}, [])