Compare commits

..

No commits in common. "9976ff59d6d6f2beffb5a7f47e8cb5b79363fe33" and "d6d626f2d7251461568265a8e30f76b497eab5d4" have entirely different histories.

5 changed files with 180 additions and 221 deletions

View File

@ -84,8 +84,13 @@ 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 {
@ -99,10 +104,15 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
...moduleSelectionData, ...moduleSelectionData,
roofConstructions: roofsStore.map((roof) => { roofConstructions: roofsStore.map((roof) => {
return { return {
roofIndex: roof.index, addRoof: {
addRoof: roof.addRoof, ...roof.addRoof,
construction: roof.construction, },
trestle: roof.trestle, construction: {
...roof.construction,
},
trestle: {
...roof.trestle,
},
} }
}), }),
}) })
@ -138,9 +148,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') {
@ -159,17 +169,14 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
// }) // })
// return // return
// } // }
trestleRef.current.isComplete().then((res) => {
if (!res) { if (!trestleRef.current.isComplete()) {
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)) {
@ -179,10 +186,10 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
}) })
return return
} }
setTabNum(tabNum + 1)
} }
} }
setTabNum(tabNum + 1)
} }
const placementFlatRef = { const placementFlatRef = {
@ -255,7 +262,6 @@ 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 [roofsStore, setRoofsStore] = useRecoilState(roofsState) const setRoofsStore = useSetRecoilState(roofsState)
const [roofTab, setRoofTab] = useState(0) // const [roofTab, setRoofTab] = useState(0) //
const { const {
roofs, roofs,
@ -67,6 +67,7 @@ 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])
@ -77,6 +78,7 @@ 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))
@ -85,11 +87,10 @@ export const Orientation = forwardRef((props, ref) => {
}, [managementState]) }, [managementState])
useEffect(() => { useEffect(() => {
if (addedRoofs) { if (moduleSelectionData) {
setRoofs(addedRoofs) console.log('moduleSelectionData', moduleSelectionData)
// setAddedRoofs(roofsStore)
} }
}, [addedRoofs]) }, [moduleSelectionData])
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
handleNextStep, handleNextStep,
@ -126,7 +127,6 @@ export const Orientation = forwardRef((props, ref) => {
module: { module: {
...selectedModules, ...selectedModules,
}, },
common,
}) })
orientationTrigger({ orientationTrigger({
compasDeg: inputCompasDeg, compasDeg: inputCompasDeg,
@ -166,7 +166,6 @@ 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
@ -212,28 +211,19 @@ 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,
roofPchBase: null, kerabaMargin: null,
}, eavesMargin: null,
addRoof: { roofPchBase: null,
...roof.addRoof, cvrYn: 'N',
lengthBase: null, snowGdPossYn: 'N',
eavesMargin: null, cvrChecked: false,
kerabaMargin: null, snowGdChecked: false,
ridgeMargin: null,
},
construction: {
constTp: null,
cvrYn: 'N',
snowGdPossYn: 'N',
cvrChecked: 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, useRef, useState } from 'react' import { forwardRef, useContext, useEffect, useImperativeHandle, useState } from 'react'
import { useRecoilState, useRecoilValue } from 'recoil' import { useRecoilState, useRecoilValue } from 'recoil'
const Trestle = forwardRef((props, ref) => { const Trestle = forwardRef((props, ref) => {
const { tabNum, setTabNum, trestleTrigger, roofs, setRoofs, moduleSelectionData, setModuleSelectionData } = props const { 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(null) const [selectedRoof, setSelectedRoof] = useState()
const { const {
trestleState, trestleState,
trestleDetail, trestleDetail,
@ -54,8 +54,6 @@ 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) {
@ -66,23 +64,9 @@ 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) {
setHajebichi(selectedRoof.hajebichi) dispatch({ type: 'SET_INITIALIZE', roof: { ...selectedRoof, moduleTpCd: selectedModules.itemTp } })
setEavesMargin(selectedRoof?.eavesMargin ?? 0)
setRidgeMargin(selectedRoof?.ridgeMargin ?? 0)
setKerabaMargin(selectedRoof?.kerabaMargin ?? 0)
dispatch({ type: 'SET_INITIALIZE', roof: { ...selectedRoof, ...moduleSelectionData } })
} }
}, [selectedRoof]) }, [selectedRoof])
@ -104,7 +88,7 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (constructionList.length > 0) { if (constructionList.length > 0) {
setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null) setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.constTp) ?? null)
} }
}, [constructionList]) }, [constructionList])
@ -140,7 +124,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,
}, },
}) })
@ -153,7 +137,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,
}, },
@ -167,7 +151,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,
@ -185,24 +169,17 @@ const Trestle = forwardRef((props, ref) => {
if (i === selectedRoof.index) { if (i === selectedRoof.index) {
return { return {
...selectedRoof, ...selectedRoof,
...trestleState,
eavesMargin, eavesMargin,
ridgeMargin, ridgeMargin,
kerabaMargin, kerabaMargin,
roofIndex: roof.index, cvrYn,
trestle: { snowGdPossYn,
lengthBase: lengthBase, cvrChecked,
...selectedRaftBase, snowGdChecked,
...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])
@ -215,7 +192,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,
@ -223,7 +200,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 ?? 0, inclCd: selectedRoof?.pitch.toString() ?? 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,
@ -240,117 +217,102 @@ const Trestle = forwardRef((props, ref) => {
} }
} }
const isComplete = async () => { const isComplete = () => {
const newAddedRoofs = roofs.map((roof, i) => { const newAddedRoofs = roofs.map((roof, i) => {
if (i === selectedRoof?.roofIndex) { if (i === selectedRoof?.index) {
return { return {
...selectedRoof, ...selectedRoof,
addRoof: roof,
trestle: trestleState,
eavesMargin, eavesMargin,
ridgeMargin, ridgeMargin,
kerabaMargin, kerabaMargin,
roofIndex: roof.index, cvrYn,
trestle: { snowGdPossYn,
lengthBase: lengthBase, cvrChecked,
...selectedRaftBase, snowGdChecked,
...selectedTrestle, trestleDetail,
...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) result = false if (roof.eavesMargin && roof.ridgeMargin && roof.kerabaMargin) {
if (!roof.trestle?.trestleMkrCd) result = false return true
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 (['C', 'R'].includes(roof.roofPchAuth)) { if (!roof.trestleMkrCd) result = false
if (!roof?.roofPchBase) 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
} }
}) })
const newRoofs = newAddedRoofs.map((roof) => { console.log('newAddedRoofs', newAddedRoofs)
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) => {
roofIndex: roof.index, return {
trestle: roof.trestle, roofIndex: roof.index,
addRoof: newRoofs[index], addRoof: {
construction: roof.construction, ...moduleSelectionData.roofConstructions[index]?.addRoof,
trestleDetail: roof.trestleDetail, ...roof.addRoof,
})), },
trestle: {
...moduleSelectionData.roofConstructions[index]?.trestle,
...roof.trestle,
},
construction: {
...roof.construction,
...moduleSelectionData.roofConstructions[index]?.construction,
},
trestleDetail: {
...roof.trestleDetail,
},
}
}),
}) })
setFlag(true) trestleTrigger({
tempModuleSelectionData.current = { roofConstruction: newAddedRoofs.map((roof) => {
...moduleSelectionData, return {
roofConstructions: newAddedRoofs.map((roof, index) => ({ roofIndex: roof.index,
roofIndex: roof.index, addRoof: {
trestle: roof.trestle, ...roof,
addRoof: newRoofs[index], },
construction: roof.construction, trestle: {
trestleDetail: roof.trestleDetail, ...selectedTrestle,
})), raftBaseCd: roof.raftBaseCd,
} },
const updatePromises = [ construction: {
// new Promise((resolve) => { ...constructionList.find((construction) => trestleState.constTp === construction.constTp),
// resolve()
// }),
new Promise((resolve) => {
setRoofs(newRoofs)
resolve()
}),
new Promise((resolve) => {
trestleTrigger({
roofConstruction: newAddedRoofs.map((roof, index) => ({
roofIndex: roof.index, roofIndex: roof.index,
addRoof: newRoofs[index], setupCover: roof.cvrYn === 'Y',
trestle: { setupSnowCover: roof.snowGdYn === 'Y',
...selectedTrestle, selectedIndex: roof.index,
raftBaseCd: roof.raftBaseCd, },
}, }
construction: {
...constructionList.find((construction) => trestleState.constTp === construction.constTp),
roofIndex: roof.index,
setupCover: roof.cvrYn === 'Y',
setupSnowCover: roof.snowGdYn === 'Y',
selectedIndex: roof.index,
},
})),
})
resolve()
}), }),
] })
await Promise.all(updatePromises)
return true
} }
return false return result
} }
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.module?.itemTp ?? '', moduleTpCd: action.roof.moduleTpCd ?? '',
roofMatlCd: action.roof?.roofMatlCd ?? '', roofMatlCd: action.roof.roofMatlCd ?? '',
raftBaseCd: action.roof?.raftBaseCd ?? null, raftBaseCd: action.roof.raftBaseCd ?? null,
trestleMkrCd: action.roof.roofConstructions[action.roof.index].trestle?.trestleMkrCd ?? null, trestleMkrCd: action.roof.trestleMkrCd ?? null,
constMthdCd: action.roof.roofConstructions[action.roof.index].trestle?.constMthdCd ?? null, constMthdCd: action.roof.constMthdCd ?? null,
constTp: action.roof.roofConstructions[action.roof.index].construction?.constTp ?? null, constTp: action.roof.constTp ?? null,
roofBaseCd: action.roof.roofConstructions[action.roof.index].trestle?.roofBaseCd ?? null, roofBaseCd: action.roof.roofBaseCd ?? null,
workingWidth: action.roof.workingWidth ?? 0, workingWidth: action.roof.workingWidth ?? 0,
lengthBase: action.roof.roofConstructions[action.roof.index].addRoof?.length ?? 0, lengthBase: action.roof.length ?? 0,
illuminationTp: action.roof.common.illuminationTp ?? null, illuminationTp: action.roof.illuminationTp ?? null,
instHt: action.roof.common.instHt ?? null, instHt: action.roof.instHt ?? null,
stdWindSpeed: action.roof.common.stdWindSpeed ?? null, stdWindSpeed: action.roof.stdWindSpeed ?? null,
stdSnowLd: action.roof.common.stdSnowLd ?? null, stdSnowLd: action.roof.stdSnowLd ?? null,
inclCd: action.roof.roofConstructions[action.roof.index].addRoof?.pitch ?? null, inclCd: action.roof.inclCd ?? null,
roofPitch: action.roof.roofConstructions[action.roof.index].addRoof?.roofPchBase ?? 0, roofPitch: action.roof.roofPchBase ?? 0,
eavesMargin: action.roof.roofConstructions[action.roof.index].addRoof?.eavesMargin ?? null, eavesMargin: action.roof.eavesMargin ?? null,
ridgeMargin: action.roof.roofConstructions[action.roof.index].addRoof?.ridgeMargin ?? null, ridgeMargin: action.roof.ridgeMargin ?? null,
kerabaMargin: action.roof.roofConstructions[action.roof.index].addRoof?.kerabaMargin ?? null, kerabaMargin: action.roof.kerabaMargin ?? null,
} }
default: default:
return state return state
@ -71,19 +71,19 @@ export function useModuleTrestle(props) {
setConstMthdList([]) setConstMthdList([])
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
// setEavesMargin(selectedRoof?.addRoof?.eavesMargin ?? 0) setEavesMargin(selectedRoof?.eavesMargin ?? 0)
// setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0) setRidgeMargin(selectedRoof?.ridgeMargin ?? 0)
// setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0) setKerabaMargin(selectedRoof?.kerabaMargin ?? 0)
setCvrYn(selectedRoof?.construction?.cvrYn ?? 'N') setCvrYn(selectedRoof?.cvrYn ?? 'N')
setCvrChecked(selectedRoof?.construction?.cvrChecked ?? false) setCvrChecked(selectedRoof?.cvrChecked ?? false)
setSnowGdPossYn(selectedRoof?.construction?.snowGdPossYn ?? 'N') setSnowGdPossYn(selectedRoof?.snowGdPossYn ?? 'N')
setSnowGdChecked(selectedRoof?.construction?.snowGdChecked ?? false) setSnowGdChecked(selectedRoof?.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 } return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd, raftBaseCd: roof.raft ? roof.raft : roof.raftBaseCd }
}) })
setBasicSetting((prev) => { setBasicSetting((prev) => {
@ -308,7 +308,8 @@ 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)
modifyModuleSelectionData() setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
// modifyModuleSelectionData()
closeAll() closeAll()
basicSettingSave() basicSettingSave()
} }
@ -549,9 +550,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({ ...moduleSelectionData, roofConstructions: [] }) moduleSelectedDataTrigger({ roofConstructions: [] })
} }
} }