모듈 설치면 작업
This commit is contained in:
parent
5d1487bc50
commit
bfc3cc4b91
@ -5,7 +5,6 @@ import { checkedModuleState, currentCanvasPlanState } from '@/store/canvasAtom'
|
|||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
|
||||||
|
|
||||||
const Placement = forwardRef((props, refs) => {
|
const Placement = forwardRef((props, refs) => {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -20,8 +19,7 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
|
|
||||||
const setCheckedModules = useSetRecoilState(checkedModuleState)
|
const setCheckedModules = useSetRecoilState(checkedModuleState)
|
||||||
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
||||||
|
const { makeModuleInitArea } = useModuleBasicSetting(3)
|
||||||
const { trigger: moduleSelectedDataTrigger } = useCanvasPopupStatusController(2)
|
|
||||||
|
|
||||||
//모듈 배치면 생성
|
//모듈 배치면 생성
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -31,6 +29,7 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
if (isChidroriValue) {
|
if (isChidroriValue) {
|
||||||
setIsChidoriNotAble(true)
|
setIsChidoriNotAble(true)
|
||||||
}
|
}
|
||||||
|
makeModuleInitArea(moduleSelectionData)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
|||||||
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
|
// import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
|
||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
|
|
||||||
export function useModuleBasicSetting(tabNum) {
|
export function useModuleBasicSetting(tabNum) {
|
||||||
@ -29,7 +29,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState)
|
const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState)
|
||||||
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
|
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
|
||||||
const { addCanvasMouseEventListener, initEvent, removeMouseEvent, addTargetMouseEventListener } = useEvent()
|
const { addCanvasMouseEventListener, initEvent, removeMouseEvent, addTargetMouseEventListener } = useEvent()
|
||||||
const { setModuleStatisticsData } = useCircuitTrestle()
|
// const { setModuleStatisticsData } = useCircuitTrestle()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
|
||||||
const compasDeg = useRecoilValue(compasDegAtom)
|
const compasDeg = useRecoilValue(compasDegAtom)
|
||||||
@ -52,6 +52,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('basicSetting', basicSetting)
|
// console.log('basicSetting', basicSetting)
|
||||||
|
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
//드래그 여부
|
//드래그 여부
|
||||||
// canvas.selection = true
|
// canvas.selection = true
|
||||||
@ -62,17 +63,13 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
||||||
|
|
||||||
//모듈 선택에서 선택된 값들 넘어옴
|
//모듈 선택에서 선택된 값들 넘어옴
|
||||||
useEffect(() => {
|
const makeModuleInitArea = () => {
|
||||||
console.log('moduleSelectionData', moduleSelectionData)
|
if (isObjectNotEmpty(moduleSelectionData) && tabNum === 3) {
|
||||||
|
|
||||||
console.log('canvasSetting.roofSizeSet', canvasSetting.roofSizeSet)
|
|
||||||
|
|
||||||
if (isObjectNotEmpty(moduleSelectionData)) {
|
|
||||||
if (canvasSetting.roofSizeSet !== '3') {
|
if (canvasSetting.roofSizeSet !== '3') {
|
||||||
const common = moduleSelectionData.common
|
const common = moduleSelectionData.common
|
||||||
const roofConstructions = moduleSelectionData.roofConstructions
|
const roofConstructions = moduleSelectionData.roofConstructions
|
||||||
|
|
||||||
console.log('roofConstructions', roofConstructions)
|
// console.log('roofConstructions', roofConstructions)
|
||||||
|
|
||||||
if (roofConstructions && roofConstructions.length > 0) {
|
if (roofConstructions && roofConstructions.length > 0) {
|
||||||
const listParams = roofConstructions.map((item) => {
|
const listParams = roofConstructions.map((item) => {
|
||||||
@ -109,7 +106,10 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [moduleSelectionData])
|
}
|
||||||
|
// console.log('moduleSelectionData', moduleSelectionData)
|
||||||
|
|
||||||
|
// console.log('canvasSetting.roofSizeSet', canvasSetting.roofSizeSet)
|
||||||
|
|
||||||
//가대 상세 데이터 조회
|
//가대 상세 데이터 조회
|
||||||
const getTrestleDetailListData = async () => {
|
const getTrestleDetailListData = async () => {
|
||||||
@ -310,7 +310,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
selectedModuleInstSurfaceArray.push(setupSurface)
|
selectedModuleInstSurfaceArray.push(setupSurface)
|
||||||
|
|
||||||
console.log('selectedModuleInstSurfaceArray', selectedModuleInstSurfaceArray)
|
// console.log('selectedModuleInstSurfaceArray', selectedModuleInstSurfaceArray)
|
||||||
|
|
||||||
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
|
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
|
||||||
} else {
|
} else {
|
||||||
@ -839,7 +839,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
checkedModule.forEach((module, index) => {
|
checkedModule.forEach((module, index) => {
|
||||||
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
||||||
|
|
||||||
const flowLines = getFlowLines(moduleSetupSurface, width)
|
const flowLines = getFlowLines(moduleSetupSurface, height)
|
||||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||||
let startPoint = flowLines.bottom
|
let startPoint = flowLines.bottom
|
||||||
const moduleArray = []
|
const moduleArray = []
|
||||||
@ -859,17 +859,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
startPoint = { ...startPoint, y1: startPoint.y1 - heightMargin }
|
startPoint = { ...startPoint, y1: startPoint.y1 - heightMargin }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
// else {
|
|
||||||
// //중앙배치가 아닐때도 흐름 방향 기준면으로 양면이 직선이면 가운데 배치
|
|
||||||
// if (flowModuleLine.bottom.type === 'flat' && flowModuleLine.left.type === 'flat' && flowModuleLine.right.type === 'flat') {
|
|
||||||
// //하단 기준으로 양면이 직선이면 하단 방면으로 가운데로 배치
|
|
||||||
// const halfWidthLength = Math.abs(startPoint.x1 + startPoint.x2) / 2 //밑에 길이에서 반을 가른다
|
|
||||||
// const halfModuleWidthLength = width / 2
|
|
||||||
// startPoint = { ...startPoint, x1: halfWidthLength - halfModuleWidthLength }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
||||||
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
|
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
|
||||||
const maxTopEndPoint = surfaceMaxLines.top.y1 //최 상단
|
const maxTopEndPoint = surfaceMaxLines.top.y1 //최 상단
|
||||||
@ -934,6 +924,8 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setupModule.push(moduleArray)
|
setupModule.push(moduleArray)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1055,7 +1047,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
checkedModule.forEach((module, index) => {
|
checkedModule.forEach((module, index) => {
|
||||||
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
||||||
const flowLines = getFlowLines(moduleSetupSurface, width)
|
const flowLines = getFlowLines(moduleSetupSurface, height)
|
||||||
let startPoint = flowLines.top
|
let startPoint = flowLines.top
|
||||||
const moduleArray = []
|
const moduleArray = []
|
||||||
|
|
||||||
@ -1389,9 +1381,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
return hull
|
return hull
|
||||||
}
|
}
|
||||||
|
|
||||||
const bottomTopFlowLine = (surface, width) => {
|
const bottomTopFlowLine = (surface, length) => {
|
||||||
console.log('bottom', width)
|
|
||||||
|
|
||||||
const flowArray = []
|
const flowArray = []
|
||||||
|
|
||||||
const bottomFlow = surface.lines.reduce(
|
const bottomFlow = surface.lines.reduce(
|
||||||
@ -1450,7 +1440,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const angle2 = Math.abs(Math.round(Math.atan(height2 / adjust2) * (180 / Math.PI) * 1000) / 1000)
|
const angle2 = Math.abs(Math.round(Math.atan(height2 / adjust2) * (180 / Math.PI) * 1000) / 1000)
|
||||||
const angle3 = 180 - (angle1 + angle2)
|
const angle3 = 180 - (angle1 + angle2)
|
||||||
|
|
||||||
const charlie = Number(width) + 3 // 평행선길이 약간 여유를 줌
|
const charlie = Number(length) + 3 // 평행선길이 약간 여유를 줌
|
||||||
const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180)
|
const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180)
|
||||||
const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180))
|
const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180))
|
||||||
const h = beta * Math.sin((angle1 * Math.PI) / 180) // 높이
|
const h = beta * Math.sin((angle1 * Math.PI) / 180) // 높이
|
||||||
@ -1467,6 +1457,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log(`index ${index} : finalLine`, pointX1, pointY1, pointX2, pointY2)
|
||||||
|
|
||||||
canvas?.add(finalLine)
|
canvas?.add(finalLine)
|
||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
|
|
||||||
@ -1509,9 +1502,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
return rtnObjArray
|
return rtnObjArray
|
||||||
}
|
}
|
||||||
|
|
||||||
const leftRightFlowLine = (surface, width) => {
|
const leftRightFlowLine = (surface, length) => {
|
||||||
console.log('left', width)
|
|
||||||
|
|
||||||
const flowArray = []
|
const flowArray = []
|
||||||
const leftFlow = surface.lines.reduce(
|
const leftFlow = surface.lines.reduce(
|
||||||
(acc, line, index) => {
|
(acc, line, index) => {
|
||||||
@ -1567,7 +1558,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const angle2 = Math.abs(Math.round(Math.atan(adjust2 / height2) * (180 / Math.PI) * 1000) / 1000)
|
const angle2 = Math.abs(Math.round(Math.atan(adjust2 / height2) * (180 / Math.PI) * 1000) / 1000)
|
||||||
const angle3 = 180 - (angle1 + angle2)
|
const angle3 = 180 - (angle1 + angle2)
|
||||||
|
|
||||||
const charlie = Number(width) + 3 // 평행선길이 약간 여유를 줌
|
const charlie = Number(length) + 3 // 평행선길이 약간 여유를 줌
|
||||||
const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180)
|
const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180)
|
||||||
const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180))
|
const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180))
|
||||||
|
|
||||||
@ -2201,7 +2192,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
checkedModule.forEach((module, index) => {
|
checkedModule.forEach((module, index) => {
|
||||||
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
||||||
|
|
||||||
const flowLines = getFlowLines(moduleSetupSurface, width)
|
const flowLines = getFlowLines(moduleSetupSurface, height)
|
||||||
|
|
||||||
let startPoint = flowLines.bottom
|
let startPoint = flowLines.bottom
|
||||||
|
|
||||||
@ -2292,7 +2283,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const flatRoofTopFlowSetupModule = (surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
|
const flatRoofTopFlowSetupModule = (surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
|
||||||
checkedModule.forEach((module, index) => {
|
checkedModule.forEach((module, index) => {
|
||||||
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
|
||||||
const flowLines = getFlowLines(moduleSetupSurface, width)
|
const flowLines = getFlowLines(moduleSetupSurface, height)
|
||||||
let startPoint = flowLines.top
|
let startPoint = flowLines.top
|
||||||
|
|
||||||
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
||||||
@ -2490,7 +2481,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
const getModuleStatistics = () => {
|
const getModuleStatistics = () => {
|
||||||
const surfaces = canvas.getObjects().filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name)
|
const surfaces = canvas.getObjects().filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name)
|
||||||
console.log('🚀 ~ getModuleStatistics ~ surfaces:', surfaces)
|
// console.log('🚀 ~ getModuleStatistics ~ surfaces:', surfaces)
|
||||||
let totalWpout = 0
|
let totalWpout = 0
|
||||||
let moduleInfo = {}
|
let moduleInfo = {}
|
||||||
const rows = surfaces.map((surface) => {
|
const rows = surfaces.map((surface) => {
|
||||||
@ -2505,7 +2496,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
moduleInfo[module.moduleInfo.itemId].amount++
|
moduleInfo[module.moduleInfo.itemId].amount++
|
||||||
})
|
})
|
||||||
totalWpout += wpOut
|
totalWpout += wpOut
|
||||||
console.log('🚀 ~ moduleData.rows=surfaces.map ~ module:', module)
|
// console.log('🚀 ~ moduleData.rows=surfaces.map ~ module:', module)
|
||||||
const rowObject = {}
|
const rowObject = {}
|
||||||
Object.keys(moduleInfo).forEach((key) => {
|
Object.keys(moduleInfo).forEach((key) => {
|
||||||
rowObject[key] = moduleInfo[key].amount
|
rowObject[key] = moduleInfo[key].amount
|
||||||
@ -2519,8 +2510,8 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('🚀 ~ getModuleStatistics ~ rows:', rows)
|
// console.log('🚀 ~ getModuleStatistics ~ rows:', rows)
|
||||||
console.log('🚀 ~ getModuleStatistics ~ moduleInfo:', moduleInfo)
|
// console.log('🚀 ~ getModuleStatistics ~ moduleInfo:', moduleInfo)
|
||||||
const header = [
|
const header = [
|
||||||
{ name: getMessage('modal.panel.batch.statistic.roof.shape'), prop: 'name' },
|
{ name: getMessage('modal.panel.batch.statistic.roof.shape'), prop: 'name' },
|
||||||
...Object.keys(moduleInfo).map((key) => {
|
...Object.keys(moduleInfo).map((key) => {
|
||||||
@ -2540,7 +2531,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
footer.push(footerData[key])
|
footer.push(footerData[key])
|
||||||
})
|
})
|
||||||
footer.push((totalWpout / 1000).toFixed(3))
|
footer.push((totalWpout / 1000).toFixed(3))
|
||||||
console.log({ header: header, rows, footer: footer })
|
// console.log({ header: header, rows, footer: footer })
|
||||||
setModuleStatistics({ header: header, rows, footer: footer })
|
setModuleStatistics({ header: header, rows, footer: footer })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2574,14 +2565,14 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
: { width: tmpWidth, height: tmpHeight }
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFlowLines = (moduleSetupSurface, width) => {
|
const getFlowLines = (moduleSetupSurface, length) => {
|
||||||
let flowLines = {}
|
let flowLines = {}
|
||||||
|
|
||||||
flowLines = {
|
flowLines = {
|
||||||
bottom: bottomTopFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'bottom'),
|
bottom: bottomTopFlowLine(moduleSetupSurface, length).find((obj) => obj.target === 'bottom'),
|
||||||
top: bottomTopFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'top'),
|
top: bottomTopFlowLine(moduleSetupSurface, length).find((obj) => obj.target === 'top'),
|
||||||
left: leftRightFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'left'),
|
left: leftRightFlowLine(moduleSetupSurface, length).find((obj) => obj.target === 'left'),
|
||||||
right: leftRightFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'right'),
|
right: leftRightFlowLine(moduleSetupSurface, length).find((obj) => obj.target === 'right'),
|
||||||
}
|
}
|
||||||
return flowLines
|
return flowLines
|
||||||
}
|
}
|
||||||
@ -2595,5 +2586,6 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
manualFlatroofModuleSetup,
|
manualFlatroofModuleSetup,
|
||||||
autoFlatroofModuleSetup,
|
autoFlatroofModuleSetup,
|
||||||
checkModuleDisjointObjects,
|
checkModuleDisjointObjects,
|
||||||
|
makeModuleInitArea,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
// setConstMthdList([]) //공법 초기화
|
// setConstMthdList([]) //공법 초기화
|
||||||
// setRoofBaseList([]) //지붕밑바탕 초기화
|
// setRoofBaseList([]) //지붕밑바탕 초기화
|
||||||
// setConstructionList([]) //공법 초기화
|
// setConstructionList([]) //공법 초기화
|
||||||
resetSelected()
|
resetSelected(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
//처마력바 체크
|
//처마력바 체크
|
||||||
@ -114,8 +114,6 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].trestle) &&
|
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].trestle) &&
|
||||||
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].construction)
|
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].construction)
|
||||||
) {
|
) {
|
||||||
// console.log('moduleSelectionData', moduleSelectionData)
|
|
||||||
|
|
||||||
const roofConstructions = moduleSelectionData.roofConstructions.filter((item) => item.roofIndex === tabIndex)[0]
|
const roofConstructions = moduleSelectionData.roofConstructions.filter((item) => item.roofIndex === tabIndex)[0]
|
||||||
setModuleConstructionSelectionData(roofConstructions)
|
setModuleConstructionSelectionData(roofConstructions)
|
||||||
}
|
}
|
||||||
@ -127,6 +125,18 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
}
|
}
|
||||||
}, [moduleConstructionSelectionData])
|
}, [moduleConstructionSelectionData])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
//되돌아왔을때 재호출 하여 선택한다
|
||||||
|
if (isExistData) {
|
||||||
|
setTrestleParams({
|
||||||
|
moduleTpCd: selectedModules.itemTp,
|
||||||
|
roofMatlCd: addRoof.roofMatlCd,
|
||||||
|
raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '',
|
||||||
|
workingWidth: lengthBase,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [isExistData])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isExistData) {
|
if (isExistData) {
|
||||||
setConstructionListParams({
|
setConstructionListParams({
|
||||||
@ -158,6 +168,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
//모듈 변경
|
//모듈 변경
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//lengbase는 무조건 있다고 가정 하고 최초에 실행 방지
|
//lengbase는 무조건 있다고 가정 하고 최초에 실행 방지
|
||||||
|
|
||||||
if (selectedModules) {
|
if (selectedModules) {
|
||||||
//여기서부터 시작
|
//여기서부터 시작
|
||||||
//가대메이커 파라메터 만들기
|
//가대메이커 파라메터 만들기
|
||||||
@ -362,7 +373,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
isObjectNotEmpty(moduleSelectionInitOriginData.current) &&
|
isObjectNotEmpty(moduleSelectionInitOriginData.current) &&
|
||||||
!isEqualObjects(moduleSelectionInitOriginData.current, moduleSelectionInitParams)
|
!isEqualObjects(moduleSelectionInitOriginData.current, moduleSelectionInitParams)
|
||||||
) {
|
) {
|
||||||
resetSelected()
|
resetSelected(2)
|
||||||
}
|
}
|
||||||
}, [moduleSelectionInitParams])
|
}, [moduleSelectionInitParams])
|
||||||
|
|
||||||
@ -372,10 +383,10 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
} else {
|
} else {
|
||||||
setHajebichi(Number(e.target.value))
|
setHajebichi(Number(e.target.value))
|
||||||
}
|
}
|
||||||
resetSelected()
|
resetSelected(3)
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetSelected = () => {
|
const resetSelected = (num) => {
|
||||||
//가대 선택 초기화
|
//가대 선택 초기화
|
||||||
setSelectedTrestle({})
|
setSelectedTrestle({})
|
||||||
|
|
||||||
|
|||||||
@ -10,11 +10,10 @@ import {
|
|||||||
selectedModelsState,
|
selectedModelsState,
|
||||||
seriesState,
|
seriesState,
|
||||||
} from '@/store/circuitTrestleAtom'
|
} from '@/store/circuitTrestleAtom'
|
||||||
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { useContext } from 'react'
|
import { useContext } from 'react'
|
||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { useMessage } from './useMessage'
|
import { useMessage } from './useMessage'
|
||||||
import { useCanvasPopupStatusController } from './common/useCanvasPopupStatusController'
|
|
||||||
|
|
||||||
export function useCircuitTrestle() {
|
export function useCircuitTrestle() {
|
||||||
const [makers, setMakers] = useRecoilState(makersState)
|
const [makers, setMakers] = useRecoilState(makersState)
|
||||||
@ -26,8 +25,7 @@ export function useCircuitTrestle() {
|
|||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { trigger: moduleSelectedDataTrigger } = useCanvasPopupStatusController(2)
|
|
||||||
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
|
||||||
const setModuleStatistics = useSetRecoilState(moduleStatisticsState)
|
const setModuleStatistics = useSetRecoilState(moduleStatisticsState)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const getOptYn = () => {
|
const getOptYn = () => {
|
||||||
@ -62,7 +60,7 @@ export function useCircuitTrestle() {
|
|||||||
// 사용된 모듈아이템 목록
|
// 사용된 모듈아이템 목록
|
||||||
const getUseModuleItemList = () => {
|
const getUseModuleItemList = () => {
|
||||||
console.log('🚀 ~ getUseModuleItemList ~ selectedModules:', selectedModules)
|
console.log('🚀 ~ getUseModuleItemList ~ selectedModules:', selectedModules)
|
||||||
return moduleSelectionData.module?.itemList?.map((m) => {
|
return selectedModules?.itemList?.map((m) => {
|
||||||
return {
|
return {
|
||||||
itemId: m.itemId,
|
itemId: m.itemId,
|
||||||
mixMatlNo: m.mixMatlNo,
|
mixMatlNo: m.mixMatlNo,
|
||||||
@ -73,10 +71,6 @@ export function useCircuitTrestle() {
|
|||||||
// 지붕면 목록
|
// 지붕면 목록
|
||||||
const getRoofSurfaceList = () => {
|
const getRoofSurfaceList = () => {
|
||||||
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
|
||||||
roofSurfaceList.forEach((surface) => {
|
|
||||||
surface.modules = modules.filter((module) => module.surfaceId === surface.id)
|
|
||||||
})
|
|
||||||
roofSurfaceList.sort((a, b) => a.left - b.left || b.top - a.top)
|
roofSurfaceList.sort((a, b) => a.left - b.left || b.top - a.top)
|
||||||
return roofSurfaceList
|
return roofSurfaceList
|
||||||
.map((obj) => {
|
.map((obj) => {
|
||||||
@ -183,22 +177,17 @@ export function useCircuitTrestle() {
|
|||||||
const setPowerConditionerData = () => {}
|
const setPowerConditionerData = () => {}
|
||||||
|
|
||||||
const setModuleStatisticsData = () => {
|
const setModuleStatisticsData = () => {
|
||||||
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
console.log(canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE))
|
||||||
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
if (selectedModules?.length === 0) return
|
||||||
roofSurfaceList.forEach((surface) => {
|
|
||||||
surface.modules = modules.filter((module) => module.surfaceId === surface.id)
|
|
||||||
})
|
|
||||||
// console.log(moduleSelectionData)
|
|
||||||
if (!moduleSelectionData || !moduleSelectionData.module || moduleSelectionData.module?.itemList?.length === 0) return
|
|
||||||
const tempHeader = [
|
const tempHeader = [
|
||||||
{ name: getMessage('simulator.table.sub1'), prop: 'name' },
|
{ name: getMessage('simulator.table.sub1'), prop: 'name' },
|
||||||
{ name: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.circuit'), prop: 'circuit' },
|
{ name: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.circuit'), prop: 'circuit' },
|
||||||
// ...moduleSelectionData.module?.itemList?.map((module) => {
|
...selectedModules?.itemList?.map((module) => {
|
||||||
// return {
|
return {
|
||||||
// name: module.itemNm,
|
name: module.itemNm,
|
||||||
// prop: module.itemId,
|
prop: module.itemId,
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
{ name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'wpOut' },
|
{ name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'wpOut' },
|
||||||
]
|
]
|
||||||
const surfaceObjects = {}
|
const surfaceObjects = {}
|
||||||
@ -247,7 +236,7 @@ export function useCircuitTrestle() {
|
|||||||
circuit: surfaceObjects[key].circuit,
|
circuit: surfaceObjects[key].circuit,
|
||||||
wpOut: parseFloat(surfaceObjects[key].wpOut / 1000),
|
wpOut: parseFloat(surfaceObjects[key].wpOut / 1000),
|
||||||
}
|
}
|
||||||
moduleSelectionData.module.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
tempRow[module.itemId] = surfaceObjects[key][module.itemId]
|
tempRow[module.itemId] = surfaceObjects[key][module.itemId]
|
||||||
})
|
})
|
||||||
tempRows.push(tempRow)
|
tempRows.push(tempRow)
|
||||||
@ -258,7 +247,7 @@ export function useCircuitTrestle() {
|
|||||||
circuit: surfaceObjects[key].circuits[circuit].circuit,
|
circuit: surfaceObjects[key].circuits[circuit].circuit,
|
||||||
wpOut: parseFloat(surfaceObjects[key].circuits[circuit].circuits.wpOut / 1000),
|
wpOut: parseFloat(surfaceObjects[key].circuits[circuit].circuits.wpOut / 1000),
|
||||||
}
|
}
|
||||||
moduleSelectionData.module.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
row[module.itemId] = surfaceObjects[key].circuits[circuit].circuits[module.itemId]
|
row[module.itemId] = surfaceObjects[key].circuits[circuit].circuits[module.itemId]
|
||||||
})
|
})
|
||||||
tempRows.push(row)
|
tempRows.push(row)
|
||||||
@ -270,8 +259,8 @@ export function useCircuitTrestle() {
|
|||||||
circuit: '-',
|
circuit: '-',
|
||||||
wpOut: tempRows.reduce((acc, row) => acc + row.wpOut, 0),
|
wpOut: tempRows.reduce((acc, row) => acc + row.wpOut, 0),
|
||||||
}
|
}
|
||||||
moduleSelectionData.module.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + (row[module.itemId] ?? 0), 0)
|
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + row[module.itemId], 0)
|
||||||
})
|
})
|
||||||
canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user