모듈 관련 데이터 수정시 roofs 데이터 초기화 버그 수정
This commit is contained in:
parent
f32e772141
commit
d524b33f56
@ -91,14 +91,14 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||
useEffect(() => {
|
||||
if (roofsStore && addedRoofs) {
|
||||
console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs)
|
||||
setRoofs(
|
||||
addedRoofs.map((roof, index) => {
|
||||
return {
|
||||
...roof,
|
||||
...roofsStore[index]?.addRoof,
|
||||
}
|
||||
}),
|
||||
)
|
||||
// setRoofs(
|
||||
// addedRoofs.map((roof, index) => {
|
||||
// return {
|
||||
// ...roof,
|
||||
// ...roofsStore[index]?.addRoof,
|
||||
// }
|
||||
// }),
|
||||
// )
|
||||
|
||||
setModuleSelectionData({
|
||||
...moduleSelectionData,
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
|
||||
import { useModuleTrestle } from '@/hooks/module/useModuleTrestle'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom'
|
||||
@ -46,22 +45,18 @@ const Trestle = forwardRef((props, ref) => {
|
||||
const selectedModules = useRecoilValue(selectedModuleState) //선택된 모듈
|
||||
// const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
||||
const [lengthBase, setLengthBase] = useState(0)
|
||||
const [hajebichi, setHajebichi] = useState(0)
|
||||
const [hajebichi, setHajebichi] = useState(trestleState?.roofPitch ?? 0)
|
||||
const [selectedRaftBase, setSelectedRaftBase] = useState(null)
|
||||
const [selectedTrestle, setSelectedTrestle] = useState(null)
|
||||
const [selectedConstMthd, setSelectedConstMthd] = useState(null)
|
||||
const [selectedConstruction, setSelectedConstruction] = useState(null)
|
||||
const [selectedRoofBase, setSelectedRoofBase] = useState(null)
|
||||
const { managementState } = useContext(GlobalDataContext)
|
||||
const { restoreModuleInstArea } = useModuleBasicSetting()
|
||||
|
||||
useEffect(() => {
|
||||
if (roofs && !selectedRoof) {
|
||||
setSelectedRoof(roofs[0])
|
||||
}
|
||||
|
||||
//모듈 설치 영역 복구
|
||||
restoreModuleInstArea()
|
||||
}, [roofs])
|
||||
|
||||
useEffect(() => {
|
||||
@ -201,10 +196,12 @@ const Trestle = forwardRef((props, ref) => {
|
||||
stdWindSpeed: managementState?.standardWindSpeedId ?? '',
|
||||
stdSnowLd: +managementState?.verticalSnowCover ?? '',
|
||||
inclCd: selectedRoof?.pitch.toString() ?? 0,
|
||||
roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
|
||||
// roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
|
||||
roofPitch: hajebichi ?? 0,
|
||||
constTp: constructionList[index].constTp,
|
||||
mixMatlNo: selectedModules.mixMatlNo,
|
||||
workingWidth: selectedRoof?.length.toString() ?? '',
|
||||
// workingWidth: selectedRoof?.length.toString() ?? '',
|
||||
workingWidth: lengthBase ?? '',
|
||||
// snowGdPossYn: constructionList[index].snowGdPossYn,
|
||||
// cvrYn: constructionList[index].cvrYn,
|
||||
},
|
||||
@ -259,14 +256,13 @@ const Trestle = forwardRef((props, ref) => {
|
||||
}
|
||||
})
|
||||
|
||||
console.log('newAddedRoofs', newAddedRoofs)
|
||||
|
||||
if (result) {
|
||||
setRoofs(newAddedRoofs)
|
||||
setModuleSelectionData({
|
||||
...moduleSelectionData,
|
||||
roofConstructions: newAddedRoofs.map((roof, index) => {
|
||||
return {
|
||||
roofIndex: index,
|
||||
addRoof: {
|
||||
...moduleSelectionData.roofConstructions[index]?.addRoof,
|
||||
...roof.addRoof,
|
||||
@ -276,8 +272,8 @@ const Trestle = forwardRef((props, ref) => {
|
||||
...moduleSelectionData.roofConstructions[index]?.trestle,
|
||||
},
|
||||
construction: {
|
||||
...roof.construction,
|
||||
...moduleSelectionData.roofConstructions[index]?.construction,
|
||||
...roof.construction,
|
||||
},
|
||||
trestleDetail: {
|
||||
...roof.trestleDetail,
|
||||
@ -343,7 +339,7 @@ const Trestle = forwardRef((props, ref) => {
|
||||
<input
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
value={trestleState?.lengthBase}
|
||||
value={lengthBase}
|
||||
onChange={(e) => setLengthBase(e.target.value)}
|
||||
disabled={selectedRoof.lenAuth === 'R'}
|
||||
/>
|
||||
@ -384,7 +380,7 @@ const Trestle = forwardRef((props, ref) => {
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
disabled={selectedRoof.roofPchAuth === 'R'}
|
||||
onChange={(e) => handleHajebichiAndLength(e, 'hajebichi')}
|
||||
onChange={(e) => setHajebichi(e.target.value)}
|
||||
value={hajebichi}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -8,8 +8,6 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
const RAFT_BASE_CODE = '203800'
|
||||
|
||||
const trestleReducer = (state, action) => {
|
||||
console.log('🚀 ~ trestleReducer ~ state:', state)
|
||||
console.log('🚀 ~ trestleReducer ~ action:', action)
|
||||
switch (action.type) {
|
||||
case 'SET_RAFT_BASE':
|
||||
case 'SET_TRESTLE_MAKER':
|
||||
@ -21,7 +19,6 @@ const trestleReducer = (state, action) => {
|
||||
...action.roof,
|
||||
}
|
||||
case 'SET_INITIALIZE':
|
||||
console.log('SET_INITIALIZE')
|
||||
return {
|
||||
moduleTpCd: action.roof.moduleTpCd ?? '',
|
||||
roofMatlCd: action.roof.roofMatlCd ?? '',
|
||||
@ -85,7 +82,6 @@ export function useModuleTrestle(props) {
|
||||
|
||||
useEffect(() => {
|
||||
if (trestleState) {
|
||||
console.log('🚀 ~ useEffect ~ trestleState:', trestleState)
|
||||
handleSetTrestleList()
|
||||
if (!trestleState.trestleMkrCd) {
|
||||
setConstMthdList([])
|
||||
@ -168,7 +164,7 @@ export function useModuleTrestle(props) {
|
||||
stdSnowLd: trestleState.stdSnowLd ?? '',
|
||||
inclCd: trestleState.inclCd ?? '',
|
||||
raftBaseCd: trestleState.raftBaseCd ?? '',
|
||||
roofPitch: trestleState.roofPitch ?? '',
|
||||
roofPitch: Math.round(trestleState.roofPitch) ?? '',
|
||||
}).then((res) => {
|
||||
if (res?.data) setConstructionList(res.data)
|
||||
})
|
||||
|
||||
@ -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) => {
|
||||
@ -308,7 +308,8 @@ export function useRoofAllocationSetting(id) {
|
||||
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
|
||||
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true)
|
||||
drawDirectionArrow(currentObject)
|
||||
modifyModuleSelectionData()
|
||||
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
|
||||
// modifyModuleSelectionData()
|
||||
closeAll()
|
||||
basicSettingSave()
|
||||
}
|
||||
@ -430,7 +431,8 @@ export function useRoofAllocationSetting(id) {
|
||||
setSelectedMenu('surface')
|
||||
|
||||
/** 모듈 선택 데이터 초기화 */
|
||||
modifyModuleSelectionData()
|
||||
// modifyModuleSelectionData()
|
||||
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user