Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
e44c2ca708
@ -186,7 +186,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
|||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{canvasSetting.roofSizeSet && canvasSetting.roofSizeSet === 3 && (
|
{canvasSetting.roofSizeSet && canvasSetting.roofSizeSet == 3 && (
|
||||||
<>
|
<>
|
||||||
<button className={`btn-frame modal mr5 ${isManualModuleSetup ? 'act' : ''}`} onClick={handleManualModuleSetup}>
|
<button className={`btn-frame modal mr5 ${isManualModuleSetup ? 'act' : ''}`} onClick={handleManualModuleSetup}>
|
||||||
{getMessage('modal.module.basic.setting.passivity.placement')}
|
{getMessage('modal.module.basic.setting.passivity.placement')}
|
||||||
|
|||||||
@ -56,12 +56,14 @@ export default function Module({ setTabNum }) {
|
|||||||
}, [installHeight, verticalSnowCover])
|
}, [installHeight, verticalSnowCover])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (tempModuleSelectionData.roofConstructions.length > 0) {
|
if (isObjectNotEmpty(tempModuleSelectionData)) {
|
||||||
if (tempModuleSelectionData.common.moduleItemId && isObjectNotEmpty(tempModuleSelectionData.module)) {
|
if (tempModuleSelectionData.roofConstructions.length > 0) {
|
||||||
//저장된 temp데이터가 지붕재(addedRoofs) 개수와 같으면 모듈 선택 저장
|
if (tempModuleSelectionData.common.moduleItemId && isObjectNotEmpty(tempModuleSelectionData.module)) {
|
||||||
setModuleSelectionData(tempModuleSelectionData)
|
//저장된 temp데이터가 지붕재(addedRoofs) 개수와 같으면 모듈 선택 저장
|
||||||
if (tempModuleSelectionData.roofConstructions.length === addedRoofs.length) {
|
setModuleSelectionData(tempModuleSelectionData)
|
||||||
moduleSelectedDataTrigger(tempModuleSelectionData)
|
if (tempModuleSelectionData.roofConstructions.length === addedRoofs.length) {
|
||||||
|
moduleSelectedDataTrigger(tempModuleSelectionData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,17 +36,20 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
|
|
||||||
//최초 지입시 체크
|
//최초 지입시 체크
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (moduleSelectionData.roofConstructions.length > 0 && moduleSelectionData.module.itemList.length > 0) {
|
if (isObjectNotEmpty(moduleSelectionData)) {
|
||||||
let initCheckedModule = {}
|
//두번째 선택한 데이터가를 기반으로 세번째 선택을 체크한다
|
||||||
moduleSelectionData.module.itemList.forEach((obj, index) => {
|
if (moduleSelectionData.roofConstructions.length > 0 && moduleSelectionData.module.itemList.length > 0) {
|
||||||
if (index === 0) {
|
let initCheckedModule = {}
|
||||||
initCheckedModule = { [obj.itemId]: true }
|
moduleSelectionData.module.itemList.forEach((obj, index) => {
|
||||||
} else {
|
if (index === 0) {
|
||||||
initCheckedModule = { ...initCheckedModule, [obj.itemId]: true }
|
initCheckedModule = { [obj.itemId]: true }
|
||||||
}
|
} else {
|
||||||
})
|
initCheckedModule = { ...initCheckedModule, [obj.itemId]: true }
|
||||||
setSelectedItems(initCheckedModule)
|
}
|
||||||
setSelectedModules(moduleSelectionData.module)
|
})
|
||||||
|
setSelectedItems(initCheckedModule)
|
||||||
|
setSelectedModules(moduleSelectionData.module)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [moduleSelectionData])
|
}, [moduleSelectionData])
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,8 @@ 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 { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
|
|
||||||
export function useModuleBasicSetting(tabNum) {
|
export function useModuleBasicSetting(tabNum) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -27,6 +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 { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
|
||||||
const compasDeg = useRecoilValue(compasDegAtom)
|
const compasDeg = useRecoilValue(compasDegAtom)
|
||||||
@ -60,33 +63,41 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
//모듈 선택에서 선택된 값들 넘어옴
|
//모듈 선택에서 선택된 값들 넘어옴
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (moduleSelectionData) {
|
console.log('moduleSelectionData', moduleSelectionData)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
const listParams = roofConstructions.map((item) => {
|
console.log('roofConstructions', roofConstructions)
|
||||||
return {
|
|
||||||
...common,
|
|
||||||
// moduleTpCd: selectedModules.itemTp,
|
|
||||||
roofMatlCd: item.trestle.roofMatlCd,
|
|
||||||
trestleMkrCd: item.trestle.trestleMkrCd,
|
|
||||||
constMthdCd: item.trestle.constMthdCd,
|
|
||||||
roofBaseCd: item.trestle.roofBaseCd,
|
|
||||||
constTp: item.construction.constTp,
|
|
||||||
mixMatlNo: selectedModules.mixMatlNo,
|
|
||||||
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
|
||||||
inclCd: String(item.addRoof.pitch),
|
|
||||||
roofIndex: item.addRoof.index,
|
|
||||||
workingWidth: item.addRoof.lenBase,
|
|
||||||
raftBaseCd: item.trestle.raftBaseCd,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setTrestleDetailParams(listParams)
|
|
||||||
|
|
||||||
//북면 설치 가능 판매점
|
if (roofConstructions && roofConstructions.length > 0) {
|
||||||
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
const listParams = roofConstructions.map((item) => {
|
||||||
setSaleStoreNorthFlg(true)
|
return {
|
||||||
|
...common,
|
||||||
|
// moduleTpCd: selectedModules.itemTp,
|
||||||
|
roofMatlCd: item.trestle.roofMatlCd,
|
||||||
|
trestleMkrCd: item.trestle.trestleMkrCd,
|
||||||
|
constMthdCd: item.trestle.constMthdCd,
|
||||||
|
roofBaseCd: item.trestle.roofBaseCd,
|
||||||
|
constTp: item.construction.constTp,
|
||||||
|
mixMatlNo: selectedModules.mixMatlNo,
|
||||||
|
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
||||||
|
inclCd: String(item.addRoof.pitch),
|
||||||
|
roofIndex: item.addRoof.index,
|
||||||
|
workingWidth: item.addRoof.lenBase,
|
||||||
|
raftBaseCd: item.trestle.raftBaseCd,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTrestleDetailParams(listParams)
|
||||||
|
|
||||||
|
//북면 설치 가능 판매점
|
||||||
|
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
||||||
|
setSaleStoreNorthFlg(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//육지붕 일경우에는 바로 배치면 설치LL
|
//육지붕 일경우에는 바로 배치면 설치LL
|
||||||
@ -140,6 +151,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
}
|
}
|
||||||
}, [trestleDetailList])
|
}, [trestleDetailList])
|
||||||
|
|
||||||
|
//선택 배치면 배열`
|
||||||
|
let selectedModuleInstSurfaceArray = []
|
||||||
|
|
||||||
//가대 상세 데이터 기준으로 모듈 설치 배치면 생성
|
//가대 상세 데이터 기준으로 모듈 설치 배치면 생성
|
||||||
const makeModuleInstArea = (roof, trestleDetail) => {
|
const makeModuleInstArea = (roof, trestleDetail) => {
|
||||||
//지붕 객체 반환
|
//지붕 객체 반환
|
||||||
@ -272,8 +286,6 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let selectedModuleInstSurfaceArray = []
|
|
||||||
|
|
||||||
//설치 범위 지정 클릭 이벤트
|
//설치 범위 지정 클릭 이벤트
|
||||||
const toggleSelection = (setupSurface) => {
|
const toggleSelection = (setupSurface) => {
|
||||||
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
||||||
@ -297,6 +309,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
selectedModuleInstSurfaceArray.push(setupSurface)
|
selectedModuleInstSurfaceArray.push(setupSurface)
|
||||||
|
|
||||||
|
console.log('selectedModuleInstSurfaceArray', selectedModuleInstSurfaceArray)
|
||||||
|
|
||||||
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
|
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
|
||||||
} else {
|
} else {
|
||||||
//선택후 재선택하면 선택안됨으로 변경
|
//선택후 재선택하면 선택안됨으로 변경
|
||||||
@ -344,8 +359,10 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
if (canvasSetting.roofSizeSet !== '3') {
|
||||||
setSaleStoreNorthFlg(true)
|
if (isObjectNotEmpty(moduleSelectionData) && moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
||||||
|
setSaleStoreNorthFlg(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [isManualModuleSetup])
|
}, [isManualModuleSetup])
|
||||||
|
|
||||||
@ -659,6 +676,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
let manualModule = new QPolygon(tempModule.points, { ...moduleOptions, moduleInfo: checkedModule[0] })
|
let manualModule = new QPolygon(tempModule.points, { ...moduleOptions, moduleInfo: checkedModule[0] })
|
||||||
canvas?.add(manualModule)
|
canvas?.add(manualModule)
|
||||||
manualDrawModules.push(manualModule)
|
manualDrawModules.push(manualModule)
|
||||||
|
setModuleStatisticsData()
|
||||||
getModuleStatistics()
|
getModuleStatistics()
|
||||||
} else {
|
} else {
|
||||||
swalFire({ text: getMessage('module.place.overlab') })
|
swalFire({ text: getMessage('module.place.overlab') })
|
||||||
@ -821,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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||||
let startPoint = flowLines.bottom
|
let startPoint = flowLines.bottom
|
||||||
const moduleArray = []
|
const moduleArray = []
|
||||||
@ -910,8 +928,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
moduleArray.push(tempModule)
|
moduleArray.push(tempModule)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
|
//디버깅용
|
||||||
// canvas?.add(tempModule)
|
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
|
||||||
|
canvas?.add(tempModule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -933,7 +952,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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||||
let startPoint = flowLines.left
|
let startPoint = flowLines.left
|
||||||
const moduleArray = []
|
const moduleArray = []
|
||||||
@ -1011,6 +1030,10 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
moduleSetupArray.push(tempModule)
|
moduleSetupArray.push(tempModule)
|
||||||
moduleArray.push(tempModule)
|
moduleArray.push(tempModule)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//디버깅용
|
||||||
|
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
|
||||||
|
canvas?.add(tempModule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1032,7 +1055,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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
let startPoint = flowLines.top
|
let startPoint = flowLines.top
|
||||||
const moduleArray = []
|
const moduleArray = []
|
||||||
|
|
||||||
@ -1123,6 +1146,10 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
moduleSetupArray.push(tempModule)
|
moduleSetupArray.push(tempModule)
|
||||||
moduleArray.push(tempModule)
|
moduleArray.push(tempModule)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//디버깅용
|
||||||
|
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
|
||||||
|
canvas?.add(tempModule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1144,7 +1171,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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
let startPoint = flowLines.right
|
let startPoint = flowLines.right
|
||||||
const moduleArray = []
|
const moduleArray = []
|
||||||
|
|
||||||
@ -1222,6 +1249,10 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
moduleSetupArray.push(tempModule)
|
moduleSetupArray.push(tempModule)
|
||||||
moduleArray.push(tempModule)
|
moduleArray.push(tempModule)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//디버깅용
|
||||||
|
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
|
||||||
|
canvas?.add(tempModule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1358,7 +1389,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
return hull
|
return hull
|
||||||
}
|
}
|
||||||
|
|
||||||
const bottomTopFlowLine = (surface, module) => {
|
const bottomTopFlowLine = (surface, width) => {
|
||||||
|
console.log('bottom', width)
|
||||||
|
|
||||||
const flowArray = []
|
const flowArray = []
|
||||||
|
|
||||||
const bottomFlow = surface.lines.reduce(
|
const bottomFlow = surface.lines.reduce(
|
||||||
@ -1417,7 +1450,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(module.longAxis) / 10 + 3 // 평행선길이 약간 여유를 줌
|
const charlie = Number(width) + 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) // 높이
|
||||||
@ -1476,7 +1509,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
return rtnObjArray
|
return rtnObjArray
|
||||||
}
|
}
|
||||||
|
|
||||||
const leftRightFlowLine = (surface, module) => {
|
const leftRightFlowLine = (surface, width) => {
|
||||||
|
console.log('left', width)
|
||||||
|
|
||||||
const flowArray = []
|
const flowArray = []
|
||||||
const leftFlow = surface.lines.reduce(
|
const leftFlow = surface.lines.reduce(
|
||||||
(acc, line, index) => {
|
(acc, line, index) => {
|
||||||
@ -1532,7 +1567,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(module.shortAxis) / 10 + 3 // 평행선길이 약간 여유를 줌
|
const charlie = Number(width) + 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))
|
||||||
|
|
||||||
@ -2166,7 +2201,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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
|
|
||||||
let startPoint = flowLines.bottom
|
let startPoint = flowLines.bottom
|
||||||
|
|
||||||
@ -2212,7 +2247,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const flatRoofLeftFlowSetupModule = (surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
|
const flatRoofLeftFlowSetupModule = (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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
let startPoint = flowLines.left
|
let startPoint = flowLines.left
|
||||||
|
|
||||||
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
|
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
|
||||||
@ -2257,7 +2292,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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
let startPoint = flowLines.top
|
let startPoint = flowLines.top
|
||||||
|
|
||||||
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
||||||
@ -2304,7 +2339,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const flatRoofRightFlowSetupModule = (surfaceMaxLines, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
|
const flatRoofRightFlowSetupModule = (surfaceMaxLines, 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, module)
|
const flowLines = getFlowLines(moduleSetupSurface, width)
|
||||||
let startPoint = flowLines.right
|
let startPoint = flowLines.right
|
||||||
|
|
||||||
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
|
||||||
@ -2539,14 +2574,14 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
: { width: tmpWidth, height: tmpHeight }
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFlowLines = (moduleSetupSurface, module) => {
|
const getFlowLines = (moduleSetupSurface, width) => {
|
||||||
let flowLines = {}
|
let flowLines = {}
|
||||||
|
|
||||||
flowLines = {
|
flowLines = {
|
||||||
bottom: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'bottom'),
|
bottom: bottomTopFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'bottom'),
|
||||||
top: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'top'),
|
top: bottomTopFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'top'),
|
||||||
left: leftRightFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'left'),
|
left: leftRightFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'left'),
|
||||||
right: leftRightFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'right'),
|
right: leftRightFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'right'),
|
||||||
}
|
}
|
||||||
return flowLines
|
return flowLines
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,8 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
const hajebichiRef = useRef()
|
const hajebichiRef = useRef()
|
||||||
const lengthRef = useRef()
|
const lengthRef = useRef()
|
||||||
|
|
||||||
|
const [isChangeInitData, setIsChangeInitData] = useState(false)
|
||||||
|
|
||||||
//서까래간격 변경
|
//서까래간격 변경
|
||||||
const handleChangeRaftBase = (option) => {
|
const handleChangeRaftBase = (option) => {
|
||||||
setSelectedRaftBase(option)
|
setSelectedRaftBase(option)
|
||||||
@ -107,11 +109,15 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
//리코일에 데이터가 담기는 시점에 시작
|
//리코일에 데이터가 담기는 시점에 시작
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
|
isObjectNotEmpty(moduleSelectionData) &&
|
||||||
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex]) &&
|
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex]) &&
|
||||||
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].trestle) &&
|
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].trestle) &&
|
||||||
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].construction)
|
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].construction)
|
||||||
) {
|
) {
|
||||||
setModuleConstructionSelectionData(moduleSelectionData.roofConstructions[tabIndex])
|
// console.log('moduleSelectionData', moduleSelectionData)
|
||||||
|
|
||||||
|
const roofConstructions = moduleSelectionData.roofConstructions.filter((item) => item.roofIndex === tabIndex)[0]
|
||||||
|
setModuleConstructionSelectionData(roofConstructions)
|
||||||
}
|
}
|
||||||
}, [moduleSelectionData])
|
}, [moduleSelectionData])
|
||||||
|
|
||||||
@ -121,18 +127,18 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
}
|
}
|
||||||
}, [moduleConstructionSelectionData])
|
}, [moduleConstructionSelectionData])
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// if (isExistData) {
|
if (isExistData) {
|
||||||
// setConstructionListParams({
|
setConstructionListParams({
|
||||||
// ...moduleSelectionInitParams,
|
...moduleSelectionInitParams,
|
||||||
// ...roofBaseParams,
|
...roofBaseParams,
|
||||||
// roofBaseCd: selectedRoofBase.roofBaseCd,
|
roofBaseCd: selectedRoofBase.roofBaseCd,
|
||||||
// inclCd: addRoof.pitch,
|
inclCd: addRoof.pitch,
|
||||||
// roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
|
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
|
||||||
// raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '',
|
raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '',
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
// }, [selectedRoofBase])
|
}, [selectedRoofBase])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
@ -173,9 +179,11 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
|
|
||||||
//가대메이커 변경 함수
|
//가대메이커 변경 함수
|
||||||
const handleChangeTrestle = (option) => {
|
const handleChangeTrestle = (option) => {
|
||||||
option.raftBaseCd = selectedRaftBase.raftBaseCd
|
if (isObjectNotEmpty(option)) {
|
||||||
setSelectedTrestle(option) //선택값 저장
|
option.raftBaseCd = selectedRaftBase.raftBaseCd
|
||||||
setConstructionParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' })
|
setSelectedTrestle(option) //선택값 저장
|
||||||
|
setConstructionParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -186,13 +194,15 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
|
|
||||||
//공법 변경
|
//공법 변경
|
||||||
const handleChangeConstMthd = (option) => {
|
const handleChangeConstMthd = (option) => {
|
||||||
setSelectedConstMthd(option) //선택된값 저장
|
if (isObjectNotEmpty(option)) {
|
||||||
setRoofBaseParams({
|
setSelectedConstMthd(option) //선택된값 저장
|
||||||
...trestleParams,
|
setRoofBaseParams({
|
||||||
trestleMkrCd: selectedTrestle.trestleMkrCd,
|
...trestleParams,
|
||||||
constMthdCd: option.constMthdCd,
|
trestleMkrCd: selectedTrestle.trestleMkrCd,
|
||||||
roofBaseCd: '',
|
constMthdCd: option.constMthdCd,
|
||||||
})
|
roofBaseCd: '',
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -202,17 +212,19 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
}, [roofBaseParams])
|
}, [roofBaseParams])
|
||||||
|
|
||||||
const handleChangeRoofBase = (option) => {
|
const handleChangeRoofBase = (option) => {
|
||||||
setConstructionListParams({
|
if (isObjectNotEmpty(option)) {
|
||||||
...moduleSelectionInitParams,
|
setConstructionListParams({
|
||||||
trestleMkrCd: selectedTrestle.trestleMkrCd,
|
...moduleSelectionInitParams,
|
||||||
constMthdCd: selectedConstMthd.constMthdCd,
|
trestleMkrCd: selectedTrestle.trestleMkrCd,
|
||||||
roofBaseCd: option.roofBaseCd,
|
constMthdCd: selectedConstMthd.constMthdCd,
|
||||||
inclCd: addRoof.pitch,
|
roofBaseCd: option.roofBaseCd,
|
||||||
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
|
inclCd: addRoof.pitch,
|
||||||
raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
|
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
|
||||||
roofMatlCd: addRoof.roofMatlCd,
|
raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
|
||||||
})
|
roofMatlCd: addRoof.roofMatlCd,
|
||||||
setSelectedRoofBase(option)
|
})
|
||||||
|
setSelectedRoofBase(option)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//공법 리스트 변경 함수
|
//공법 리스트 변경 함수
|
||||||
@ -275,7 +287,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
construction: selectedConstruction,
|
construction: selectedConstruction,
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = tempModuleSelectionData.roofConstructions.findIndex((obj) => obj.roofIndex === tabIndex)
|
const index = moduleSelectionData.roofConstructions.findIndex((obj) => obj.roofIndex === tabIndex)
|
||||||
|
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
const newArray = [
|
const newArray = [
|
||||||
@ -301,7 +313,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
if (type === 'trestle') {
|
if (type === 'trestle') {
|
||||||
//가대 메이커일때
|
//가대 메이커일때
|
||||||
setTrestleList(optionsList.data) //가대 목록
|
setTrestleList(optionsList.data) //가대 목록
|
||||||
if (isExistData) {
|
if (isExistData && isObjectNotEmpty(moduleConstructionSelectionData?.trestle)) {
|
||||||
//데이터가 있으면 선택된 가대 메이커를 선택한다
|
//데이터가 있으면 선택된 가대 메이커를 선택한다
|
||||||
handleChangeTrestle(moduleConstructionSelectionData?.trestle)
|
handleChangeTrestle(moduleConstructionSelectionData?.trestle)
|
||||||
} else {
|
} else {
|
||||||
@ -311,7 +323,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
} else if (type === 'construction') {
|
} else if (type === 'construction') {
|
||||||
//공법일때
|
//공법일때
|
||||||
setConstMthdList(optionsList.data) //공법 목록
|
setConstMthdList(optionsList.data) //공법 목록
|
||||||
if (isExistData) {
|
if (isExistData && isObjectNotEmpty(moduleConstructionSelectionData?.construction)) {
|
||||||
//데이터가 있으면 선택된 공법을 선택한다
|
//데이터가 있으면 선택된 공법을 선택한다
|
||||||
handleChangeConstMthd(moduleConstructionSelectionData?.trestle)
|
handleChangeConstMthd(moduleConstructionSelectionData?.trestle)
|
||||||
} else {
|
} else {
|
||||||
@ -320,7 +332,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
} else if (type === 'roofBase') {
|
} else if (type === 'roofBase') {
|
||||||
//지붕밑바탕일때
|
//지붕밑바탕일때
|
||||||
setRoofBaseList(optionsList.data) //지붕밑바탕 목록
|
setRoofBaseList(optionsList.data) //지붕밑바탕 목록
|
||||||
if (isExistData) {
|
if (isExistData && isObjectNotEmpty(moduleConstructionSelectionData?.trestle)) {
|
||||||
//데이터가 있으면 선택된 지붕밑바탕을 선택한다
|
//데이터가 있으면 선택된 지붕밑바탕을 선택한다
|
||||||
handleChangeRoofBase(moduleConstructionSelectionData?.trestle) //선택된 지붕밑바탕을 선택한다
|
handleChangeRoofBase(moduleConstructionSelectionData?.trestle) //선택된 지붕밑바탕을 선택한다
|
||||||
}
|
}
|
||||||
@ -330,15 +342,27 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//모듈이 선택되어있을때
|
//모듈이 선택되어있을때
|
||||||
if (moduleSelectionInitOriginData.current.moduleItemId && moduleSelectionInitOriginData.current.moduleTpCd) {
|
//초기 데이터가 모두 들어있을 경우에 초기 데이터를 저장한다
|
||||||
//초기에 들어온 데이터가 수정된 데이터가 값이 다르다면`
|
if (
|
||||||
if (!isEqualObjects(moduleSelectionInitOriginData.current, moduleSelectionInitParams)) {
|
moduleSelectionInitParams.illuminationTp &&
|
||||||
resetSelected()
|
moduleSelectionInitParams.illuminationTpNm &&
|
||||||
|
moduleSelectionInitParams.instHt &&
|
||||||
|
moduleSelectionInitParams.moduleItemId &&
|
||||||
|
moduleSelectionInitParams.moduleTpCd &&
|
||||||
|
moduleSelectionInitParams.saleStoreNorthFlg &&
|
||||||
|
moduleSelectionInitParams.stdSnowLd &&
|
||||||
|
moduleSelectionInitParams.stdWindSpeed
|
||||||
|
) {
|
||||||
|
if (!isObjectNotEmpty(moduleSelectionInitOriginData.current)) {
|
||||||
|
moduleSelectionInitOriginData.current = moduleSelectionInitParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moduleSelectionInitParams.moduleItemId && moduleSelectionInitParams.moduleTpCd) {
|
if (
|
||||||
moduleSelectionInitOriginData.current = moduleSelectionInitParams
|
isObjectNotEmpty(moduleSelectionInitOriginData.current) &&
|
||||||
|
!isEqualObjects(moduleSelectionInitOriginData.current, moduleSelectionInitParams)
|
||||||
|
) {
|
||||||
|
resetSelected()
|
||||||
}
|
}
|
||||||
}, [moduleSelectionInitParams])
|
}, [moduleSelectionInitParams])
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import { usePopup } from '../usePopup'
|
|||||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||||
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
|
|
||||||
const defaultDotLineGridSetting = {
|
const defaultDotLineGridSetting = {
|
||||||
INTERVAL: {
|
INTERVAL: {
|
||||||
@ -120,6 +121,8 @@ export function useCanvasSetting() {
|
|||||||
const resetModuleSelectionData = useResetRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
const resetModuleSelectionData = useResetRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
||||||
const resetSelectedModules = useResetRecoilState(selectedModuleState) //선택된 모듈
|
const resetSelectedModules = useResetRecoilState(selectedModuleState) //선택된 모듈
|
||||||
|
|
||||||
|
const { trigger: moduleSelectedDataTrigger } = useCanvasPopupStatusController(2)
|
||||||
|
|
||||||
const [raftCodes, setRaftCodes] = useState([]) // 서까래 정보
|
const [raftCodes, setRaftCodes] = useState([]) // 서까래 정보
|
||||||
const { findCommonCode } = useCommonCode()
|
const { findCommonCode } = useCommonCode()
|
||||||
const [currentRoof, setCurrentRoof] = useState(null) // 현재 선택된 지붕재 정보
|
const [currentRoof, setCurrentRoof] = useState(null) // 현재 선택된 지붕재 정보
|
||||||
@ -473,6 +476,7 @@ export function useCanvasSetting() {
|
|||||||
|
|
||||||
//모듈 선택 데이터 초기화
|
//모듈 선택 데이터 초기화
|
||||||
resetModuleSelectionData()
|
resetModuleSelectionData()
|
||||||
|
moduleSelectedDataTrigger({ common: {}, module: {}, roofConstructions: [] })
|
||||||
|
|
||||||
const isModuleExist = canvas.getObjects().some((obj) => obj.name === POLYGON_TYPE.MODULE)
|
const isModuleExist = canvas.getObjects().some((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
if (!isModuleExist) {
|
if (!isModuleExist) {
|
||||||
|
|||||||
@ -196,12 +196,12 @@ export function useCircuitTrestle() {
|
|||||||
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) => {
|
// ...moduleSelectionData.module?.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 = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user