Merge remote-tracking branch 'origin/qcast-pub' into feature/yj-layoutSetup

This commit is contained in:
김민식 2025-04-07 18:22:01 +09:00
commit 9976ff59d6
5 changed files with 221 additions and 180 deletions

View File

@ -84,13 +84,8 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
useModuleBasicSetting(tabNum)
const { updateObjectDate } = useMasterController()
useEffect(() => {
if (managementState) console.log('managementState', managementState)
}, [managementState])
useEffect(() => {
if (roofsStore && addedRoofs) {
console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs)
setRoofs(
addedRoofs.map((roof, index) => {
return {
@ -104,15 +99,10 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
...moduleSelectionData,
roofConstructions: roofsStore.map((roof) => {
return {
addRoof: {
...roof.addRoof,
},
construction: {
...roof.construction,
},
trestle: {
...roof.trestle,
},
roofIndex: roof.index,
addRoof: roof.addRoof,
construction: roof.construction,
trestle: roof.trestle,
}
}),
})
@ -148,9 +138,9 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
const handleBtnNextStep = () => {
if (tabNum === 1) {
console.log('moduleSelectionData', moduleSelectionData)
orientationRef.current.handleNextStep()
setAddedRoofs(roofs)
setTabNum(tabNum + 1)
return
} else if (tabNum === 2) {
if (basicSetting.roofSizeSet !== '3') {
@ -169,14 +159,17 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
// })
// return
// }
if (!trestleRef.current.isComplete()) {
trestleRef.current.isComplete().then((res) => {
if (!res) {
Swal.fire({
title: getMessage('construction.length.difference'),
icon: 'warning',
})
return
} else {
// setTabNum(tabNum + 1)
}
})
//
} else {
if (!isObjectNotEmpty(moduleSelectionData.module)) {
@ -186,11 +179,11 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
})
return
}
}
}
setTabNum(tabNum + 1)
}
}
}
const placementFlatRef = {
setupLocation: useRef('south'),
@ -262,6 +255,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
const trestleProps = {
roofs,
setRoofs,
tabNum,
setTabNum,
moduleSelectionData,
setModuleSelectionData,

View File

@ -15,7 +15,7 @@ export const Orientation = forwardRef((props, ref) => {
const [hasAnglePassivity, setHasAnglePassivity] = useState(false)
const basicSetting = useRecoilValue(basicSettingState)
const [addedRoofs, setAddedRoofs] = useRecoilState(addedRoofsState) //
const setRoofsStore = useSetRecoilState(roofsState)
const [roofsStore, setRoofsStore] = useRecoilState(roofsState)
const [roofTab, setRoofTab] = useState(0) //
const {
roofs,
@ -67,7 +67,6 @@ export const Orientation = forwardRef((props, ref) => {
useEffect(() => {
if (selectedSurfaceType) {
console.log(roughnessCodes, selectedSurfaceType)
setInputRoughness(roughnessCodes.find((code) => code.clCode === managementState?.surfaceTypeValue))
}
}, [selectedSurfaceType])
@ -78,7 +77,6 @@ export const Orientation = forwardRef((props, ref) => {
useEffect(() => {
if (managementState?.installHeight && managementState?.installHeight) {
console.log('🚀 ~ useEffect ~ managementState:', managementState)
setSelectedSurfaceType(roughnessCodes.find((code) => code.clCode === managementState?.surfaceTypeValue))
setInputInstallHeight(managementState?.installHeight)
setStandardWindSpeed(windSpeedCodes.find((code) => code.clCode === managementState?.standardWindSpeedId))
@ -87,10 +85,11 @@ export const Orientation = forwardRef((props, ref) => {
}, [managementState])
useEffect(() => {
if (moduleSelectionData) {
console.log('moduleSelectionData', moduleSelectionData)
if (addedRoofs) {
setRoofs(addedRoofs)
// setAddedRoofs(roofsStore)
}
}, [moduleSelectionData])
}, [addedRoofs])
useImperativeHandle(ref, () => ({
handleNextStep,
@ -127,6 +126,7 @@ export const Orientation = forwardRef((props, ref) => {
module: {
...selectedModules,
},
common,
})
orientationTrigger({
compasDeg: inputCompasDeg,
@ -166,6 +166,7 @@ export const Orientation = forwardRef((props, ref) => {
}
const isComplete = () => {
if (!selectedModules) return false
if (basicSetting && basicSetting.roofSizeSet !== '3') {
if (inputInstallHeight <= 0) {
return false
@ -211,19 +212,28 @@ export const Orientation = forwardRef((props, ref) => {
const newRoofs = addedRoofs.map((roof) => {
return {
...roof,
trestle: {
lengthBase: null,
trestleMkrCd: null,
constMthdCd: null,
constTp: null,
roofBaseCd: null,
ridgeMargin: null,
kerabaMargin: null,
eavesMargin: null,
roofPchBase: null,
},
addRoof: {
...roof.addRoof,
lengthBase: null,
eavesMargin: null,
kerabaMargin: null,
ridgeMargin: null,
},
construction: {
constTp: null,
cvrYn: 'N',
snowGdPossYn: 'N',
cvrChecked: false,
snowGdChecked: false,
},
}
})
// setRoofs(newRoofs)

View File

@ -7,16 +7,16 @@ import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom'
import { roofsState } from '@/store/roofAtom'
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
import { isObjectNotEmpty } from '@/util/common-utils'
import { forwardRef, useContext, useEffect, useImperativeHandle, useState } from 'react'
import { forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState } from 'react'
import { useRecoilState, useRecoilValue } from 'recoil'
const Trestle = forwardRef((props, ref) => {
const { setTabNum, trestleTrigger, roofs, setRoofs, moduleSelectionData, setModuleSelectionData } = props
const { tabNum, setTabNum, trestleTrigger, roofs, setRoofs, moduleSelectionData, setModuleSelectionData } = props
const { getMessage } = useMessage()
// const [selectedTrestle, setSelectedTrestle] = useState()
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
const pitchText = useRecoilValue(pitchTextSelector)
const [selectedRoof, setSelectedRoof] = useState()
const [selectedRoof, setSelectedRoof] = useState(null)
const {
trestleState,
trestleDetail,
@ -54,6 +54,8 @@ const Trestle = forwardRef((props, ref) => {
const [selectedRoofBase, setSelectedRoofBase] = useState(null)
const { managementState } = useContext(GlobalDataContext)
const { restoreModuleInstArea } = useModuleBasicSetting()
const [flag, setFlag] = useState(false)
const tempModuleSelectionData = useRef(null)
useEffect(() => {
if (roofs && !selectedRoof) {
@ -64,9 +66,23 @@ const Trestle = forwardRef((props, ref) => {
restoreModuleInstArea()
}, [roofs])
useEffect(() => {}, [moduleSelectionData])
useEffect(() => {
if (flag && moduleSelectionData) {
if (JSON.stringify(tempModuleSelectionData.current) === JSON.stringify(moduleSelectionData)) {
setTabNum(tabNum + 1)
}
}
}, [flag, moduleSelectionData])
useEffect(() => {
if (selectedRoof) {
dispatch({ type: 'SET_INITIALIZE', roof: { ...selectedRoof, moduleTpCd: selectedModules.itemTp } })
setHajebichi(selectedRoof.hajebichi)
setEavesMargin(selectedRoof?.eavesMargin ?? 0)
setRidgeMargin(selectedRoof?.ridgeMargin ?? 0)
setKerabaMargin(selectedRoof?.kerabaMargin ?? 0)
dispatch({ type: 'SET_INITIALIZE', roof: { ...selectedRoof, ...moduleSelectionData } })
}
}, [selectedRoof])
@ -88,7 +104,7 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => {
if (constructionList.length > 0) {
setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.constTp) ?? null)
setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null)
}
}, [constructionList])
@ -124,7 +140,7 @@ const Trestle = forwardRef((props, ref) => {
roof: {
moduleTpCd: selectedModules.itemTp ?? '',
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
raftBaseCd: selectedRaftBase.clCode,
raftBaseCd: selectedRaftBase?.clCode,
trestleMkrCd: e.trestleMkrCd,
},
})
@ -137,7 +153,7 @@ const Trestle = forwardRef((props, ref) => {
roof: {
moduleTpCd: selectedModules.itemTp ?? '',
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
raftBaseCd: selectedRaftBase.clCode,
raftBaseCd: selectedRaftBase?.clCode,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: e.constMthdCd,
},
@ -151,7 +167,7 @@ const Trestle = forwardRef((props, ref) => {
roof: {
moduleTpCd: selectedModules.itemTp ?? '',
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
raftBaseCd: selectedRaftBase.clCode,
raftBaseCd: selectedRaftBase?.clCode,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: selectedConstMthd.constMthdCd,
roofBaseCd: e.roofBaseCd,
@ -169,17 +185,24 @@ const Trestle = forwardRef((props, ref) => {
if (i === selectedRoof.index) {
return {
...selectedRoof,
...trestleState,
eavesMargin,
ridgeMargin,
kerabaMargin,
cvrYn,
snowGdPossYn,
cvrChecked,
snowGdChecked,
roofIndex: roof.index,
trestle: {
lengthBase: lengthBase,
...selectedRaftBase,
...selectedTrestle,
...selectedConstMthd,
...selectedRoofBase,
},
construction: {
...constructionList.find((data) => data.constTp === trestleState.constTp),
},
trestleDetail: trestleDetail,
}
}
return { ...roof }
return roof
})
setRoofs(newAddedRoofs)
setSelectedRoof(newAddedRoofs[index])
@ -192,7 +215,7 @@ const Trestle = forwardRef((props, ref) => {
roof: {
moduleTpCd: selectedModules.itemTp ?? '',
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
raftBaseCd: selectedRaftBase.clCode,
raftBaseCd: selectedRaftBase?.clCode,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: selectedConstMthd.constMthdCd,
roofBaseCd: selectedRoofBase.roofBaseCd,
@ -200,7 +223,7 @@ const Trestle = forwardRef((props, ref) => {
instHt: managementState?.installHeight ?? '',
stdWindSpeed: managementState?.standardWindSpeedId ?? '',
stdSnowLd: +managementState?.verticalSnowCover ?? '',
inclCd: selectedRoof?.pitch.toString() ?? 0,
inclCd: selectedRoof?.pitch ?? 0,
roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
constTp: constructionList[index].constTp,
mixMatlNo: selectedModules.mixMatlNo,
@ -217,83 +240,91 @@ const Trestle = forwardRef((props, ref) => {
}
}
const isComplete = () => {
const isComplete = async () => {
const newAddedRoofs = roofs.map((roof, i) => {
if (i === selectedRoof?.index) {
if (i === selectedRoof?.roofIndex) {
return {
...selectedRoof,
addRoof: roof,
trestle: trestleState,
eavesMargin,
ridgeMargin,
kerabaMargin,
cvrYn,
snowGdPossYn,
cvrChecked,
snowGdChecked,
trestleDetail,
roofIndex: roof.index,
trestle: {
lengthBase: lengthBase,
...selectedRaftBase,
...selectedTrestle,
...selectedConstMthd,
...selectedRoofBase,
},
construction: {
...constructionList.find((data) => data.constTp === trestleState.constTp),
},
trestleDetail: trestleDetail,
}
}
return { ...roof }
return roof
})
let result = true
newAddedRoofs.forEach((roof) => {
if (roof.eavesMargin && roof.ridgeMargin && roof.kerabaMargin) {
return true
if (!roof?.eavesMargin || !roof?.ridgeMargin || !roof?.kerabaMargin) result = false
if (!roof.trestle?.trestleMkrCd) result = false
if (!roof.trestle?.constMthdCd) result = false
if (!roof.trestle?.roofBaseCd) result = false
if (!roof.construction?.constTp) result = false
if (roof.lenAuth === 'C') {
if (!roof.trestle?.lengthBase) result = false
}
if (['C', 'R'].includes(roof.raftAuth)) {
if (!roof?.raftBaseCd) result = false
}
if (!roof.trestleMkrCd) result = false
if (!roof.constMthdCd) result = false
if (!roof.roofBaseCd) result = false
if (!roof.constTp) result = false
if (selectedRoof.lenAuth === 'C') {
if (!trestleState?.lengthBase) result = false
}
if (['C', 'R'].includes(selectedRoof.raftAuth)) {
if (!roof.raftBaseCd) result = false
}
if (['C', 'R'].includes(selectedRoof.roofPchAuth)) {
if (!roof.roofPchBase) result = false
if (['C', 'R'].includes(roof.roofPchAuth)) {
if (!roof?.roofPchBase) result = false
}
})
console.log('newAddedRoofs', newAddedRoofs)
const newRoofs = newAddedRoofs.map((roof) => {
const { addRoof, trestle, construction, ...rest } = roof
return rest
})
if (result) {
setRoofs(newAddedRoofs)
setModuleSelectionData({
...moduleSelectionData,
roofConstructions: newAddedRoofs.map((roof, index) => {
return {
roofConstructions: newAddedRoofs.map((roof, index) => ({
roofIndex: roof.index,
addRoof: {
...moduleSelectionData.roofConstructions[index]?.addRoof,
...roof.addRoof,
},
trestle: {
...moduleSelectionData.roofConstructions[index]?.trestle,
...roof.trestle,
},
construction: {
...roof.construction,
...moduleSelectionData.roofConstructions[index]?.construction,
},
trestleDetail: {
...roof.trestleDetail,
},
}
}),
trestle: roof.trestle,
addRoof: newRoofs[index],
construction: roof.construction,
trestleDetail: roof.trestleDetail,
})),
})
trestleTrigger({
roofConstruction: newAddedRoofs.map((roof) => {
return {
setFlag(true)
tempModuleSelectionData.current = {
...moduleSelectionData,
roofConstructions: newAddedRoofs.map((roof, index) => ({
roofIndex: roof.index,
addRoof: {
...roof,
},
trestle: roof.trestle,
addRoof: newRoofs[index],
construction: roof.construction,
trestleDetail: roof.trestleDetail,
})),
}
const updatePromises = [
// new Promise((resolve) => {
// resolve()
// }),
new Promise((resolve) => {
setRoofs(newRoofs)
resolve()
}),
new Promise((resolve) => {
trestleTrigger({
roofConstruction: newAddedRoofs.map((roof, index) => ({
roofIndex: roof.index,
addRoof: newRoofs[index],
trestle: {
...selectedTrestle,
raftBaseCd: roof.raftBaseCd,
@ -305,14 +336,21 @@ const Trestle = forwardRef((props, ref) => {
setupSnowCover: roof.snowGdYn === 'Y',
selectedIndex: roof.index,
},
}
}),
})),
})
resolve()
}),
]
await Promise.all(updatePromises)
return true
}
return result
return false
}
const getFlag = () => {}
useImperativeHandle(ref, () => ({
isComplete,
}))

View File

@ -20,24 +20,24 @@ const trestleReducer = (state, action) => {
}
case 'SET_INITIALIZE':
return {
moduleTpCd: action.roof.moduleTpCd ?? '',
roofMatlCd: action.roof.roofMatlCd ?? '',
raftBaseCd: action.roof.raftBaseCd ?? null,
trestleMkrCd: action.roof.trestleMkrCd ?? null,
constMthdCd: action.roof.constMthdCd ?? null,
constTp: action.roof.constTp ?? null,
roofBaseCd: action.roof.roofBaseCd ?? null,
moduleTpCd: action.roof.module?.itemTp ?? '',
roofMatlCd: action.roof?.roofMatlCd ?? '',
raftBaseCd: action.roof?.raftBaseCd ?? null,
trestleMkrCd: action.roof.roofConstructions[action.roof.index].trestle?.trestleMkrCd ?? null,
constMthdCd: action.roof.roofConstructions[action.roof.index].trestle?.constMthdCd ?? null,
constTp: action.roof.roofConstructions[action.roof.index].construction?.constTp ?? null,
roofBaseCd: action.roof.roofConstructions[action.roof.index].trestle?.roofBaseCd ?? null,
workingWidth: action.roof.workingWidth ?? 0,
lengthBase: action.roof.length ?? 0,
illuminationTp: action.roof.illuminationTp ?? null,
instHt: action.roof.instHt ?? null,
stdWindSpeed: action.roof.stdWindSpeed ?? null,
stdSnowLd: action.roof.stdSnowLd ?? null,
inclCd: action.roof.inclCd ?? null,
roofPitch: action.roof.roofPchBase ?? 0,
eavesMargin: action.roof.eavesMargin ?? null,
ridgeMargin: action.roof.ridgeMargin ?? null,
kerabaMargin: action.roof.kerabaMargin ?? null,
lengthBase: action.roof.roofConstructions[action.roof.index].addRoof?.length ?? 0,
illuminationTp: action.roof.common.illuminationTp ?? null,
instHt: action.roof.common.instHt ?? null,
stdWindSpeed: action.roof.common.stdWindSpeed ?? null,
stdSnowLd: action.roof.common.stdSnowLd ?? null,
inclCd: action.roof.roofConstructions[action.roof.index].addRoof?.pitch ?? null,
roofPitch: action.roof.roofConstructions[action.roof.index].addRoof?.roofPchBase ?? 0,
eavesMargin: action.roof.roofConstructions[action.roof.index].addRoof?.eavesMargin ?? null,
ridgeMargin: action.roof.roofConstructions[action.roof.index].addRoof?.ridgeMargin ?? null,
kerabaMargin: action.roof.roofConstructions[action.roof.index].addRoof?.kerabaMargin ?? null,
}
default:
return state
@ -71,19 +71,19 @@ export function useModuleTrestle(props) {
setConstMthdList([])
setRoofBaseList([])
setConstructionList([])
setEavesMargin(selectedRoof?.eavesMargin ?? 0)
setRidgeMargin(selectedRoof?.ridgeMargin ?? 0)
setKerabaMargin(selectedRoof?.kerabaMargin ?? 0)
setCvrYn(selectedRoof?.cvrYn ?? 'N')
setCvrChecked(selectedRoof?.cvrChecked ?? false)
setSnowGdPossYn(selectedRoof?.snowGdPossYn ?? 'N')
setSnowGdChecked(selectedRoof?.snowGdChecked ?? false)
// setEavesMargin(selectedRoof?.addRoof?.eavesMargin ?? 0)
// setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0)
// setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0)
setCvrYn(selectedRoof?.construction?.cvrYn ?? 'N')
setCvrChecked(selectedRoof?.construction?.cvrChecked ?? false)
setSnowGdPossYn(selectedRoof?.construction?.snowGdPossYn ?? 'N')
setSnowGdChecked(selectedRoof?.construction?.snowGdChecked ?? false)
}, [selectedRoof])
useEffect(() => {
if (trestleState) {
handleSetTrestleList()
if (!trestleState.trestleMkrCd) {
if (!trestleState?.trestleMkrCd) {
setConstMthdList([])
setRoofBaseList([])
setConstructionList([])
@ -92,7 +92,7 @@ export function useModuleTrestle(props) {
}
handleSetConstMthdList()
if (!trestleState.constMthdCd) {
if (!trestleState?.constMthdCd) {
setRoofBaseList([])
setConstructionList([])
setTrestleDetail(null)
@ -100,19 +100,19 @@ export function useModuleTrestle(props) {
}
handleSetRoofBaseList()
if (!trestleState.roofBaseCd) {
if (!trestleState?.roofBaseCd) {
setConstructionList([])
setTrestleDetail(null)
return
}
handleSetConstructionList()
if (!trestleState.constTp) {
if (!trestleState?.constTp) {
setTrestleDetail(null)
return
}
if (!trestleState.eavesMargin) {
if (!trestleState?.eavesMargin) {
handleSetTrestleDetailData()
}
}
@ -120,9 +120,9 @@ export function useModuleTrestle(props) {
const handleSetTrestleList = () => {
getTrestleList({
moduleTpCd: trestleState.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '',
moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState?.roofMatlCd ?? '',
raftBaseCd: trestleState?.raftBaseCd ?? '',
}).then((res) => {
if (res?.data) setTrestleList(res.data)
})
@ -130,10 +130,10 @@ export function useModuleTrestle(props) {
const handleSetConstMthdList = () => {
getTrestleList({
moduleTpCd: trestleState.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '',
trestleMkrCd: trestleState.trestleMkrCd ?? '',
moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState?.roofMatlCd ?? '',
raftBaseCd: trestleState?.raftBaseCd ?? '',
trestleMkrCd: trestleState?.trestleMkrCd ?? '',
}).then((res) => {
if (res?.data) setConstMthdList(res.data)
})
@ -141,11 +141,11 @@ export function useModuleTrestle(props) {
const handleSetRoofBaseList = () => {
getTrestleList({
moduleTpCd: trestleState.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '',
trestleMkrCd: trestleState.trestleMkrCd ?? '',
constMthdCd: trestleState.constMthdCd ?? '',
moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState?.roofMatlCd ?? '',
raftBaseCd: trestleState?.raftBaseCd ?? '',
trestleMkrCd: trestleState?.trestleMkrCd ?? '',
constMthdCd: trestleState?.constMthdCd ?? '',
}).then((res) => {
if (res?.data) setRoofBaseList(res.data)
})
@ -153,11 +153,11 @@ export function useModuleTrestle(props) {
const handleSetConstructionList = () => {
getConstructionList({
moduleTpCd: trestleState.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '',
trestleMkrCd: trestleState.trestleMkrCd ?? '',
constMthdCd: trestleState.constMthdCd ?? '',
roofBaseCd: trestleState.roofBaseCd ?? '',
moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState?.roofMatlCd ?? '',
trestleMkrCd: trestleState?.trestleMkrCd ?? '',
constMthdCd: trestleState?.constMthdCd ?? '',
roofBaseCd: trestleState?.roofBaseCd ?? '',
illuminationTp: trestleState.illuminationTp ?? '',
instHt: trestleState.instHt ?? '',
stdWindSpeed: trestleState.stdWindSpeed ?? '',

View File

@ -296,7 +296,7 @@ export function useRoofAllocationSetting(id) {
})
}
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd, raftBaseCd: roof.raft ? roof.raft : roof.raftBaseCd }
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd }
})
setBasicSetting((prev) => {
@ -308,8 +308,7 @@ export function useRoofAllocationSetting(id) {
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true)
drawDirectionArrow(currentObject)
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
// modifyModuleSelectionData()
modifyModuleSelectionData()
closeAll()
basicSettingSave()
}
@ -550,9 +549,9 @@ export function useRoofAllocationSetting(id) {
* 모듈 선택에서 선택한 데이터 초기화
*/
const modifyModuleSelectionData = () => {
if (moduleSelectionData.roofConstructions.length > 0) {
if (moduleSelectionData.roofConstructions?.length > 0) {
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: [] })
moduleSelectedDataTrigger({ roofConstructions: [] })
moduleSelectedDataTrigger({ ...moduleSelectionData, roofConstructions: [] })
}
}