trestleDetail 작업
This commit is contained in:
parent
597aaa6d42
commit
00a201704b
@ -84,6 +84,18 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
|||||||
useModuleBasicSetting(tabNum)
|
useModuleBasicSetting(tabNum)
|
||||||
const { updateObjectDate } = useMasterController()
|
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(() => {
|
useEffect(() => {
|
||||||
if (roofsStore && addedRoofs) {
|
if (roofsStore && addedRoofs) {
|
||||||
setRoofs(
|
setRoofs(
|
||||||
@ -113,18 +125,6 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
|||||||
}
|
}
|
||||||
}, [roofsStore, addedRoofs])
|
}, [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(() => {
|
useEffect(() => {
|
||||||
if (basicSetting.roofSizeSet !== '3') {
|
if (basicSetting.roofSizeSet !== '3') {
|
||||||
manualModuleSetup()
|
manualModuleSetup()
|
||||||
|
|||||||
@ -266,6 +266,8 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isComplete = async () => {
|
const isComplete = async () => {
|
||||||
|
console.log('roofs', roofs)
|
||||||
|
|
||||||
const newAddedRoofs = roofs.map((roof, i) => {
|
const newAddedRoofs = roofs.map((roof, i) => {
|
||||||
if (i === selectedRoof?.index) {
|
if (i === selectedRoof?.index) {
|
||||||
return {
|
return {
|
||||||
@ -291,6 +293,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
let result = true
|
let result = true
|
||||||
|
console.log('newAddedRoofs', newAddedRoofs)
|
||||||
newAddedRoofs.forEach((roof) => {
|
newAddedRoofs.forEach((roof) => {
|
||||||
if (!roof?.eavesMargin || !roof?.ridgeMargin || !roof?.kerabaMargin) result = false
|
if (!roof?.eavesMargin || !roof?.ridgeMargin || !roof?.kerabaMargin) result = false
|
||||||
if (!roof.trestle?.trestleMkrCd) result = false
|
if (!roof.trestle?.trestleMkrCd) result = false
|
||||||
|
|||||||
@ -91,16 +91,10 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const roofConstructions = moduleSelectionData.roofConstructions
|
const roofConstructions = moduleSelectionData.roofConstructions
|
||||||
|
|
||||||
if (roofConstructions && roofConstructions.length > 0) {
|
if (roofConstructions && roofConstructions.length > 0) {
|
||||||
const listParams = roofConstructions.map((item) => {
|
//roofIndex 넣기
|
||||||
return {
|
const roofConstructionArray = roofConstructions.map((detail) => ({ ...detail.trestleDetail, roofIndex: detail.roofIndex }))
|
||||||
...common,
|
|
||||||
...item.addRoof,
|
setTrestleDetailList(roofConstructionArray)
|
||||||
...item.trestle,
|
|
||||||
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
|
||||||
inclCd: String(item.addRoof.pitch),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setTrestleDetailParams(listParams)
|
|
||||||
|
|
||||||
//북면 설치 가능 판매점
|
//북면 설치 가능 판매점
|
||||||
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
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(() => {
|
useEffect(() => {
|
||||||
|
console.log('trestleDetailList', trestleDetailList)
|
||||||
|
|
||||||
if (trestleDetailList.length > 0) {
|
if (trestleDetailList.length > 0) {
|
||||||
let rowColArray = []
|
let rowColArray = []
|
||||||
//지붕을 가져옴
|
//지붕을 가져옴
|
||||||
@ -147,11 +128,11 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
|
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
|
||||||
|
|
||||||
trestleDetailList.forEach((detail) => {
|
trestleDetailList.forEach((detail) => {
|
||||||
if (detail.data !== null) {
|
if (isObjectNotEmpty(detail)) {
|
||||||
if (Number(detail.data.roofIndex) === roofIndex) {
|
if (Number(detail.roofIndex) === roofIndex) {
|
||||||
//roof에 상세 데이터 추가
|
//roof에 상세 데이터 추가
|
||||||
roof.set({
|
roof.set({
|
||||||
trestleDetail: detail.data,
|
trestleDetail: detail,
|
||||||
stroke: roofOutlineColor(roofIndex),
|
stroke: roofOutlineColor(roofIndex),
|
||||||
strokeWidth: 7,
|
strokeWidth: 7,
|
||||||
})
|
})
|
||||||
@ -162,7 +143,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
line.attributes = { ...line.attributes, offset: getOffset(offsetObjects.addRoof, line.attributes.type) }
|
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) => {
|
trestleDetailList.forEach((detail) => {
|
||||||
const moduleRowArray = []
|
const moduleRowArray = []
|
||||||
if (detail.data !== null && detail.data.module.length > 0) {
|
if (isObjectNotEmpty(detail) && detail.module.length > 0) {
|
||||||
detail.data.module.forEach((module) => {
|
detail.module.forEach((module) => {
|
||||||
moduleRowArray.push({ moduleMaxRows: module.moduleMaxRows, mixModuleMaxRows: module.mixModuleMaxRows })
|
moduleRowArray.push({ moduleMaxRows: module.moduleMaxRows, mixModuleMaxRows: module.mixModuleMaxRows })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -407,6 +388,8 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
//모듈,회로에서 다른메뉴 -> 배치면으로 갈 경수 초기화
|
//모듈,회로에서 다른메뉴 -> 배치면으로 갈 경수 초기화
|
||||||
const restoreModuleInstArea = () => {
|
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)
|
const setupArea = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE || obj.name === POLYGON_TYPE.OBJECT_SURFACE)
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export function useModuleSelection(props) {
|
|||||||
getModuleData(roofsIds)
|
getModuleData(roofsIds)
|
||||||
|
|
||||||
//모듈설치면 초기화
|
//모듈설치면 초기화
|
||||||
restoreModuleInstArea()
|
// restoreModuleInstArea()
|
||||||
resetStatisticsData()
|
resetStatisticsData()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user