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

View File

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

View File

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

View File

@ -20,24 +20,24 @@ const trestleReducer = (state, action) => {
} }
case 'SET_INITIALIZE': case 'SET_INITIALIZE':
return { return {
moduleTpCd: action.roof.moduleTpCd ?? '', moduleTpCd: action.roof.module?.itemTp ?? '',
roofMatlCd: action.roof.roofMatlCd ?? '', roofMatlCd: action.roof?.roofMatlCd ?? '',
raftBaseCd: action.roof.raftBaseCd ?? null, raftBaseCd: action.roof?.raftBaseCd ?? null,
trestleMkrCd: action.roof.trestleMkrCd ?? null, trestleMkrCd: action.roof.roofConstructions[action.roof.index].trestle?.trestleMkrCd ?? null,
constMthdCd: action.roof.constMthdCd ?? null, constMthdCd: action.roof.roofConstructions[action.roof.index].trestle?.constMthdCd ?? null,
constTp: action.roof.constTp ?? null, constTp: action.roof.roofConstructions[action.roof.index].construction?.constTp ?? null,
roofBaseCd: action.roof.roofBaseCd ?? null, roofBaseCd: action.roof.roofConstructions[action.roof.index].trestle?.roofBaseCd ?? null,
workingWidth: action.roof.workingWidth ?? 0, workingWidth: action.roof.workingWidth ?? 0,
lengthBase: action.roof.length ?? 0, lengthBase: action.roof.roofConstructions[action.roof.index].addRoof?.length ?? 0,
illuminationTp: action.roof.illuminationTp ?? null, illuminationTp: action.roof.common.illuminationTp ?? null,
instHt: action.roof.instHt ?? null, instHt: action.roof.common.instHt ?? null,
stdWindSpeed: action.roof.stdWindSpeed ?? null, stdWindSpeed: action.roof.common.stdWindSpeed ?? null,
stdSnowLd: action.roof.stdSnowLd ?? null, stdSnowLd: action.roof.common.stdSnowLd ?? null,
inclCd: action.roof.inclCd ?? null, inclCd: action.roof.roofConstructions[action.roof.index].addRoof?.pitch ?? null,
roofPitch: action.roof.roofPchBase ?? 0, roofPitch: action.roof.roofConstructions[action.roof.index].addRoof?.roofPchBase ?? 0,
eavesMargin: action.roof.eavesMargin ?? null, eavesMargin: action.roof.roofConstructions[action.roof.index].addRoof?.eavesMargin ?? null,
ridgeMargin: action.roof.ridgeMargin ?? null, ridgeMargin: action.roof.roofConstructions[action.roof.index].addRoof?.ridgeMargin ?? null,
kerabaMargin: action.roof.kerabaMargin ?? null, kerabaMargin: action.roof.roofConstructions[action.roof.index].addRoof?.kerabaMargin ?? null,
} }
default: default:
return state return state
@ -71,19 +71,19 @@ export function useModuleTrestle(props) {
setConstMthdList([]) setConstMthdList([])
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
setEavesMargin(selectedRoof?.eavesMargin ?? 0) // setEavesMargin(selectedRoof?.addRoof?.eavesMargin ?? 0)
setRidgeMargin(selectedRoof?.ridgeMargin ?? 0) // setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0)
setKerabaMargin(selectedRoof?.kerabaMargin ?? 0) // setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0)
setCvrYn(selectedRoof?.cvrYn ?? 'N') setCvrYn(selectedRoof?.construction?.cvrYn ?? 'N')
setCvrChecked(selectedRoof?.cvrChecked ?? false) setCvrChecked(selectedRoof?.construction?.cvrChecked ?? false)
setSnowGdPossYn(selectedRoof?.snowGdPossYn ?? 'N') setSnowGdPossYn(selectedRoof?.construction?.snowGdPossYn ?? 'N')
setSnowGdChecked(selectedRoof?.snowGdChecked ?? false) setSnowGdChecked(selectedRoof?.construction?.snowGdChecked ?? false)
}, [selectedRoof]) }, [selectedRoof])
useEffect(() => { useEffect(() => {
if (trestleState) { if (trestleState) {
handleSetTrestleList() handleSetTrestleList()
if (!trestleState.trestleMkrCd) { if (!trestleState?.trestleMkrCd) {
setConstMthdList([]) setConstMthdList([])
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
@ -92,7 +92,7 @@ export function useModuleTrestle(props) {
} }
handleSetConstMthdList() handleSetConstMthdList()
if (!trestleState.constMthdCd) { if (!trestleState?.constMthdCd) {
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
@ -100,19 +100,19 @@ export function useModuleTrestle(props) {
} }
handleSetRoofBaseList() handleSetRoofBaseList()
if (!trestleState.roofBaseCd) { if (!trestleState?.roofBaseCd) {
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
return return
} }
handleSetConstructionList() handleSetConstructionList()
if (!trestleState.constTp) { if (!trestleState?.constTp) {
setTrestleDetail(null) setTrestleDetail(null)
return return
} }
if (!trestleState.eavesMargin) { if (!trestleState?.eavesMargin) {
handleSetTrestleDetailData() handleSetTrestleDetailData()
} }
} }
@ -120,9 +120,9 @@ export function useModuleTrestle(props) {
const handleSetTrestleList = () => { const handleSetTrestleList = () => {
getTrestleList({ getTrestleList({
moduleTpCd: trestleState.moduleTpCd ?? '', moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '', roofMatlCd: trestleState?.roofMatlCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '', raftBaseCd: trestleState?.raftBaseCd ?? '',
}).then((res) => { }).then((res) => {
if (res?.data) setTrestleList(res.data) if (res?.data) setTrestleList(res.data)
}) })
@ -130,10 +130,10 @@ export function useModuleTrestle(props) {
const handleSetConstMthdList = () => { const handleSetConstMthdList = () => {
getTrestleList({ getTrestleList({
moduleTpCd: trestleState.moduleTpCd ?? '', moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '', roofMatlCd: trestleState?.roofMatlCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '', raftBaseCd: trestleState?.raftBaseCd ?? '',
trestleMkrCd: trestleState.trestleMkrCd ?? '', trestleMkrCd: trestleState?.trestleMkrCd ?? '',
}).then((res) => { }).then((res) => {
if (res?.data) setConstMthdList(res.data) if (res?.data) setConstMthdList(res.data)
}) })
@ -141,11 +141,11 @@ export function useModuleTrestle(props) {
const handleSetRoofBaseList = () => { const handleSetRoofBaseList = () => {
getTrestleList({ getTrestleList({
moduleTpCd: trestleState.moduleTpCd ?? '', moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '', roofMatlCd: trestleState?.roofMatlCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '', raftBaseCd: trestleState?.raftBaseCd ?? '',
trestleMkrCd: trestleState.trestleMkrCd ?? '', trestleMkrCd: trestleState?.trestleMkrCd ?? '',
constMthdCd: trestleState.constMthdCd ?? '', constMthdCd: trestleState?.constMthdCd ?? '',
}).then((res) => { }).then((res) => {
if (res?.data) setRoofBaseList(res.data) if (res?.data) setRoofBaseList(res.data)
}) })
@ -153,11 +153,11 @@ export function useModuleTrestle(props) {
const handleSetConstructionList = () => { const handleSetConstructionList = () => {
getConstructionList({ getConstructionList({
moduleTpCd: trestleState.moduleTpCd ?? '', moduleTpCd: trestleState?.moduleTpCd ?? '',
roofMatlCd: trestleState.roofMatlCd ?? '', roofMatlCd: trestleState?.roofMatlCd ?? '',
trestleMkrCd: trestleState.trestleMkrCd ?? '', trestleMkrCd: trestleState?.trestleMkrCd ?? '',
constMthdCd: trestleState.constMthdCd ?? '', constMthdCd: trestleState?.constMthdCd ?? '',
roofBaseCd: trestleState.roofBaseCd ?? '', roofBaseCd: trestleState?.roofBaseCd ?? '',
illuminationTp: trestleState.illuminationTp ?? '', illuminationTp: trestleState.illuminationTp ?? '',
instHt: trestleState.instHt ?? '', instHt: trestleState.instHt ?? '',
stdWindSpeed: trestleState.stdWindSpeed ?? '', 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) => { setBasicSetting((prev) => {
@ -308,8 +308,7 @@ export function useRoofAllocationSetting(id) {
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected) const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true) setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true)
drawDirectionArrow(currentObject) drawDirectionArrow(currentObject)
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList }) modifyModuleSelectionData()
// modifyModuleSelectionData()
closeAll() closeAll()
basicSettingSave() basicSettingSave()
} }
@ -550,9 +549,9 @@ export function useRoofAllocationSetting(id) {
* 모듈 선택에서 선택한 데이터 초기화 * 모듈 선택에서 선택한 데이터 초기화
*/ */
const modifyModuleSelectionData = () => { const modifyModuleSelectionData = () => {
if (moduleSelectionData.roofConstructions.length > 0) { if (moduleSelectionData.roofConstructions?.length > 0) {
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: [] }) setModuleSelectionData({ ...moduleSelectionData, roofConstructions: [] })
moduleSelectedDataTrigger({ roofConstructions: [] }) moduleSelectedDataTrigger({ ...moduleSelectionData, roofConstructions: [] })
} }
} }