Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev

This commit is contained in:
김민식 2025-02-08 17:56:14 +09:00
commit e44c2ca708
7 changed files with 181 additions and 113 deletions

View File

@ -186,7 +186,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
</button>
</>
)}
{canvasSetting.roofSizeSet && canvasSetting.roofSizeSet === 3 && (
{canvasSetting.roofSizeSet && canvasSetting.roofSizeSet == 3 && (
<>
<button className={`btn-frame modal mr5 ${isManualModuleSetup ? 'act' : ''}`} onClick={handleManualModuleSetup}>
{getMessage('modal.module.basic.setting.passivity.placement')}

View File

@ -56,12 +56,14 @@ export default function Module({ setTabNum }) {
}, [installHeight, verticalSnowCover])
useEffect(() => {
if (tempModuleSelectionData.roofConstructions.length > 0) {
if (tempModuleSelectionData.common.moduleItemId && isObjectNotEmpty(tempModuleSelectionData.module)) {
// temp (addedRoofs)
setModuleSelectionData(tempModuleSelectionData)
if (tempModuleSelectionData.roofConstructions.length === addedRoofs.length) {
moduleSelectedDataTrigger(tempModuleSelectionData)
if (isObjectNotEmpty(tempModuleSelectionData)) {
if (tempModuleSelectionData.roofConstructions.length > 0) {
if (tempModuleSelectionData.common.moduleItemId && isObjectNotEmpty(tempModuleSelectionData.module)) {
// temp (addedRoofs)
setModuleSelectionData(tempModuleSelectionData)
if (tempModuleSelectionData.roofConstructions.length === addedRoofs.length) {
moduleSelectedDataTrigger(tempModuleSelectionData)
}
}
}
}

View File

@ -36,17 +36,20 @@ const Placement = forwardRef((props, refs) => {
//
useEffect(() => {
if (moduleSelectionData.roofConstructions.length > 0 && moduleSelectionData.module.itemList.length > 0) {
let initCheckedModule = {}
moduleSelectionData.module.itemList.forEach((obj, index) => {
if (index === 0) {
initCheckedModule = { [obj.itemId]: true }
} else {
initCheckedModule = { ...initCheckedModule, [obj.itemId]: true }
}
})
setSelectedItems(initCheckedModule)
setSelectedModules(moduleSelectionData.module)
if (isObjectNotEmpty(moduleSelectionData)) {
//
if (moduleSelectionData.roofConstructions.length > 0 && moduleSelectionData.module.itemList.length > 0) {
let initCheckedModule = {}
moduleSelectionData.module.itemList.forEach((obj, index) => {
if (index === 0) {
initCheckedModule = { [obj.itemId]: true }
} else {
initCheckedModule = { ...initCheckedModule, [obj.itemId]: true }
}
})
setSelectedItems(initCheckedModule)
setSelectedModules(moduleSelectionData.module)
}
}
}, [moduleSelectionData])

View File

@ -19,6 +19,8 @@ import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
import { useMasterController } from '@/hooks/common/useMasterController'
import { v4 as uuidv4 } from 'uuid'
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
import { isObjectNotEmpty } from '@/util/common-utils'
export function useModuleBasicSetting(tabNum) {
const canvas = useRecoilValue(canvasState)
@ -27,6 +29,7 @@ export function useModuleBasicSetting(tabNum) {
const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState)
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
const { addCanvasMouseEventListener, initEvent, removeMouseEvent, addTargetMouseEventListener } = useEvent()
const { setModuleStatisticsData } = useCircuitTrestle()
const { swalFire } = useSwal()
const compasDeg = useRecoilValue(compasDegAtom)
@ -60,33 +63,41 @@ export function useModuleBasicSetting(tabNum) {
//모듈 선택에서 선택된 값들 넘어옴
useEffect(() => {
if (moduleSelectionData) {
console.log('moduleSelectionData', moduleSelectionData)
console.log('canvasSetting.roofSizeSet', canvasSetting.roofSizeSet)
if (isObjectNotEmpty(moduleSelectionData)) {
if (canvasSetting.roofSizeSet !== '3') {
const common = moduleSelectionData.common
const roofConstructions = moduleSelectionData.roofConstructions
const listParams = roofConstructions.map((item) => {
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)
console.log('roofConstructions', roofConstructions)
//북면 설치 가능 판매점
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
setSaleStoreNorthFlg(true)
if (roofConstructions && roofConstructions.length > 0) {
const listParams = roofConstructions.map((item) => {
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 {
//육지붕 일경우에는 바로 배치면 설치LL
@ -140,6 +151,9 @@ export function useModuleBasicSetting(tabNum) {
}
}, [trestleDetailList])
//선택 배치면 배열`
let selectedModuleInstSurfaceArray = []
//가대 상세 데이터 기준으로 모듈 설치 배치면 생성
const makeModuleInstArea = (roof, trestleDetail) => {
//지붕 객체 반환
@ -272,8 +286,6 @@ export function useModuleBasicSetting(tabNum) {
}
}
let selectedModuleInstSurfaceArray = []
//설치 범위 지정 클릭 이벤트
const toggleSelection = (setupSurface) => {
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
@ -297,6 +309,9 @@ export function useModuleBasicSetting(tabNum) {
canvas?.renderAll()
selectedModuleInstSurfaceArray.push(setupSurface)
console.log('selectedModuleInstSurfaceArray', selectedModuleInstSurfaceArray)
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
} else {
//선택후 재선택하면 선택안됨으로 변경
@ -344,8 +359,10 @@ export function useModuleBasicSetting(tabNum) {
}
useEffect(() => {
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
setSaleStoreNorthFlg(true)
if (canvasSetting.roofSizeSet !== '3') {
if (isObjectNotEmpty(moduleSelectionData) && moduleSelectionData.common.saleStoreNorthFlg === '1') {
setSaleStoreNorthFlg(true)
}
}
}, [isManualModuleSetup])
@ -659,6 +676,7 @@ export function useModuleBasicSetting(tabNum) {
let manualModule = new QPolygon(tempModule.points, { ...moduleOptions, moduleInfo: checkedModule[0] })
canvas?.add(manualModule)
manualDrawModules.push(manualModule)
setModuleStatisticsData()
getModuleStatistics()
} else {
swalFire({ text: getMessage('module.place.overlab') })
@ -821,7 +839,7 @@ export function useModuleBasicSetting(tabNum) {
checkedModule.forEach((module, index) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
let startPoint = flowLines.bottom
const moduleArray = []
@ -910,8 +928,9 @@ export function useModuleBasicSetting(tabNum) {
moduleArray.push(tempModule)
}
} 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) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
let startPoint = flowLines.left
const moduleArray = []
@ -1011,6 +1030,10 @@ export function useModuleBasicSetting(tabNum) {
moduleSetupArray.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) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.top
const moduleArray = []
@ -1123,6 +1146,10 @@ export function useModuleBasicSetting(tabNum) {
moduleSetupArray.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) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.right
const moduleArray = []
@ -1222,6 +1249,10 @@ export function useModuleBasicSetting(tabNum) {
moduleSetupArray.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
}
const bottomTopFlowLine = (surface, module) => {
const bottomTopFlowLine = (surface, width) => {
console.log('bottom', width)
const flowArray = []
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 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 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) // 높이
@ -1476,7 +1509,9 @@ export function useModuleBasicSetting(tabNum) {
return rtnObjArray
}
const leftRightFlowLine = (surface, module) => {
const leftRightFlowLine = (surface, width) => {
console.log('left', width)
const flowArray = []
const leftFlow = surface.lines.reduce(
(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 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 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) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.bottom
@ -2212,7 +2247,7 @@ export function useModuleBasicSetting(tabNum) {
const flatRoofLeftFlowSetupModule = (surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
checkedModule.forEach((module, index) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.left
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
@ -2257,7 +2292,7 @@ export function useModuleBasicSetting(tabNum) {
const flatRoofTopFlowSetupModule = (surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
checkedModule.forEach((module, index) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.top
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
@ -2304,7 +2339,7 @@ export function useModuleBasicSetting(tabNum) {
const flatRoofRightFlowSetupModule = (surfaceMaxLines, moduleSetupArray, moduleSetupSurface, marginWidth, marginHeight) => {
checkedModule.forEach((module, index) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.right
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
@ -2539,14 +2574,14 @@ export function useModuleBasicSetting(tabNum) {
: { width: tmpWidth, height: tmpHeight }
}
const getFlowLines = (moduleSetupSurface, module) => {
const getFlowLines = (moduleSetupSurface, width) => {
let flowLines = {}
flowLines = {
bottom: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'bottom'),
top: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'top'),
left: leftRightFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'left'),
right: leftRightFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'right'),
bottom: bottomTopFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'bottom'),
top: bottomTopFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'top'),
left: leftRightFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'left'),
right: leftRightFlowLine(moduleSetupSurface, width).find((obj) => obj.target === 'right'),
}
return flowLines
}

View File

@ -53,6 +53,8 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
const hajebichiRef = useRef()
const lengthRef = useRef()
const [isChangeInitData, setIsChangeInitData] = useState(false)
//서까래간격 변경
const handleChangeRaftBase = (option) => {
setSelectedRaftBase(option)
@ -107,11 +109,15 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
//리코일에 데이터가 담기는 시점에 시작
useEffect(() => {
if (
isObjectNotEmpty(moduleSelectionData) &&
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex]) &&
isObjectNotEmpty(moduleSelectionData.roofConstructions[tabIndex].trestle) &&
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])
@ -121,18 +127,18 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
}
}, [moduleConstructionSelectionData])
// useEffect(() => {
// if (isExistData) {
// setConstructionListParams({
// ...moduleSelectionInitParams,
// ...roofBaseParams,
// roofBaseCd: selectedRoofBase.roofBaseCd,
// inclCd: addRoof.pitch,
// roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
// raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '',
// })
// }
// }, [selectedRoofBase])
useEffect(() => {
if (isExistData) {
setConstructionListParams({
...moduleSelectionInitParams,
...roofBaseParams,
roofBaseCd: selectedRoofBase.roofBaseCd,
inclCd: addRoof.pitch,
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '',
})
}
}, [selectedRoofBase])
useEffect(() => {
if (
@ -173,9 +179,11 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
//가대메이커 변경 함수
const handleChangeTrestle = (option) => {
option.raftBaseCd = selectedRaftBase.raftBaseCd
setSelectedTrestle(option) //선택값 저장
setConstructionParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' })
if (isObjectNotEmpty(option)) {
option.raftBaseCd = selectedRaftBase.raftBaseCd
setSelectedTrestle(option) //선택값 저장
setConstructionParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' })
}
}
useEffect(() => {
@ -186,13 +194,15 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
//공법 변경
const handleChangeConstMthd = (option) => {
setSelectedConstMthd(option) //선택된값 저장
setRoofBaseParams({
...trestleParams,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: option.constMthdCd,
roofBaseCd: '',
})
if (isObjectNotEmpty(option)) {
setSelectedConstMthd(option) //선택된값 저장
setRoofBaseParams({
...trestleParams,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: option.constMthdCd,
roofBaseCd: '',
})
}
}
useEffect(() => {
@ -202,17 +212,19 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
}, [roofBaseParams])
const handleChangeRoofBase = (option) => {
setConstructionListParams({
...moduleSelectionInitParams,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: selectedConstMthd.constMthdCd,
roofBaseCd: option.roofBaseCd,
inclCd: addRoof.pitch,
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
roofMatlCd: addRoof.roofMatlCd,
})
setSelectedRoofBase(option)
if (isObjectNotEmpty(option)) {
setConstructionListParams({
...moduleSelectionInitParams,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: selectedConstMthd.constMthdCd,
roofBaseCd: option.roofBaseCd,
inclCd: addRoof.pitch,
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
roofMatlCd: addRoof.roofMatlCd,
})
setSelectedRoofBase(option)
}
}
//공법 리스트 변경 함수
@ -275,7 +287,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
construction: selectedConstruction,
}
const index = tempModuleSelectionData.roofConstructions.findIndex((obj) => obj.roofIndex === tabIndex)
const index = moduleSelectionData.roofConstructions.findIndex((obj) => obj.roofIndex === tabIndex)
if (index > -1) {
const newArray = [
@ -301,7 +313,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
if (type === 'trestle') {
//가대 메이커일때
setTrestleList(optionsList.data) //가대 목록
if (isExistData) {
if (isExistData && isObjectNotEmpty(moduleConstructionSelectionData?.trestle)) {
//데이터가 있으면 선택된 가대 메이커를 선택한다
handleChangeTrestle(moduleConstructionSelectionData?.trestle)
} else {
@ -311,7 +323,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
} else if (type === 'construction') {
//공법일때
setConstMthdList(optionsList.data) //공법 목록
if (isExistData) {
if (isExistData && isObjectNotEmpty(moduleConstructionSelectionData?.construction)) {
//데이터가 있으면 선택된 공법을 선택한다
handleChangeConstMthd(moduleConstructionSelectionData?.trestle)
} else {
@ -320,7 +332,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
} else if (type === 'roofBase') {
//지붕밑바탕일때
setRoofBaseList(optionsList.data) //지붕밑바탕 목록
if (isExistData) {
if (isExistData && isObjectNotEmpty(moduleConstructionSelectionData?.trestle)) {
//데이터가 있으면 선택된 지붕밑바탕을 선택한다
handleChangeRoofBase(moduleConstructionSelectionData?.trestle) //선택된 지붕밑바탕을 선택한다
}
@ -330,15 +342,27 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
useEffect(() => {
//모듈이 선택되어있을때
if (moduleSelectionInitOriginData.current.moduleItemId && moduleSelectionInitOriginData.current.moduleTpCd) {
//초기에 들어온 데이터가 수정된 데이터가 값이 다르다면`
if (!isEqualObjects(moduleSelectionInitOriginData.current, moduleSelectionInitParams)) {
resetSelected()
//초기 데이터가 모두 들어있을 경우에 초기 데이터를 저장한다
if (
moduleSelectionInitParams.illuminationTp &&
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) {
moduleSelectionInitOriginData.current = moduleSelectionInitParams
if (
isObjectNotEmpty(moduleSelectionInitOriginData.current) &&
!isEqualObjects(moduleSelectionInitOriginData.current, moduleSelectionInitParams)
) {
resetSelected()
}
}, [moduleSelectionInitParams])

View File

@ -38,6 +38,7 @@ import { usePopup } from '../usePopup'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
import { useCommonCode } from '@/hooks/common/useCommonCode'
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
const defaultDotLineGridSetting = {
INTERVAL: {
@ -120,6 +121,8 @@ export function useCanvasSetting() {
const resetModuleSelectionData = useResetRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
const resetSelectedModules = useResetRecoilState(selectedModuleState) //선택된 모듈
const { trigger: moduleSelectedDataTrigger } = useCanvasPopupStatusController(2)
const [raftCodes, setRaftCodes] = useState([]) // 서까래 정보
const { findCommonCode } = useCommonCode()
const [currentRoof, setCurrentRoof] = useState(null) // 현재 선택된 지붕재 정보
@ -473,6 +476,7 @@ export function useCanvasSetting() {
//모듈 선택 데이터 초기화
resetModuleSelectionData()
moduleSelectedDataTrigger({ common: {}, module: {}, roofConstructions: [] })
const isModuleExist = canvas.getObjects().some((obj) => obj.name === POLYGON_TYPE.MODULE)
if (!isModuleExist) {

View File

@ -196,12 +196,12 @@ export function useCircuitTrestle() {
const tempHeader = [
{ name: getMessage('simulator.table.sub1'), prop: 'name' },
{ name: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.circuit'), prop: 'circuit' },
...moduleSelectionData.module?.itemList?.map((module) => {
return {
name: module.itemNm,
prop: module.itemId,
}
}),
// ...moduleSelectionData.module?.itemList?.map((module) => {
// return {
// name: module.itemNm,
// prop: module.itemId,
// }
// }),
{ name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'wpOut' },
]
const surfaceObjects = {}