Compare commits

..

No commits in common. "02a0e4a67f18b20d066964a3bcf104b2900e9dac" and "e7b50ca642f98a3bf68da86cb98fd2252c4690fc" have entirely different histories.

4 changed files with 29 additions and 23 deletions

View File

@ -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,

View File

@ -1,5 +1,6 @@
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'
@ -45,18 +46,22 @@ const Trestle = forwardRef((props, ref) => {
const selectedModules = useRecoilValue(selectedModuleState) //
// const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
const [lengthBase, setLengthBase] = useState(0)
const [hajebichi, setHajebichi] = useState(trestleState?.roofPitch ?? 0)
const [hajebichi, setHajebichi] = useState(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(() => {
@ -196,12 +201,10 @@ const Trestle = forwardRef((props, ref) => {
stdWindSpeed: managementState?.standardWindSpeedId ?? '',
stdSnowLd: +managementState?.verticalSnowCover ?? '',
inclCd: selectedRoof?.pitch.toString() ?? 0,
// roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
roofPitch: hajebichi ?? 0,
roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
constTp: constructionList[index].constTp,
mixMatlNo: selectedModules.mixMatlNo,
// workingWidth: selectedRoof?.length.toString() ?? '',
workingWidth: lengthBase ?? '',
workingWidth: selectedRoof?.length.toString() ?? '',
// snowGdPossYn: constructionList[index].snowGdPossYn,
// cvrYn: constructionList[index].cvrYn,
},
@ -256,13 +259,14 @@ 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,
@ -272,8 +276,8 @@ const Trestle = forwardRef((props, ref) => {
...moduleSelectionData.roofConstructions[index]?.trestle,
},
construction: {
...moduleSelectionData.roofConstructions[index]?.construction,
...roof.construction,
...moduleSelectionData.roofConstructions[index]?.construction,
},
trestleDetail: {
...roof.trestleDetail,
@ -339,7 +343,7 @@ const Trestle = forwardRef((props, ref) => {
<input
type="text"
className="input-origin block"
value={lengthBase}
value={trestleState?.lengthBase}
onChange={(e) => setLengthBase(e.target.value)}
disabled={selectedRoof.lenAuth === 'R'}
/>
@ -380,7 +384,7 @@ const Trestle = forwardRef((props, ref) => {
type="text"
className="input-origin block"
disabled={selectedRoof.roofPchAuth === 'R'}
onChange={(e) => setHajebichi(e.target.value)}
onChange={(e) => handleHajebichiAndLength(e, 'hajebichi')}
value={hajebichi}
/>
</div>

View File

@ -8,6 +8,8 @@ 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':
@ -19,6 +21,7 @@ const trestleReducer = (state, action) => {
...action.roof,
}
case 'SET_INITIALIZE':
console.log('SET_INITIALIZE')
return {
moduleTpCd: action.roof.moduleTpCd ?? '',
roofMatlCd: action.roof.roofMatlCd ?? '',
@ -82,6 +85,7 @@ export function useModuleTrestle(props) {
useEffect(() => {
if (trestleState) {
console.log('🚀 ~ useEffect ~ trestleState:', trestleState)
handleSetTrestleList()
if (!trestleState.trestleMkrCd) {
setConstMthdList([])
@ -164,7 +168,7 @@ export function useModuleTrestle(props) {
stdSnowLd: trestleState.stdSnowLd ?? '',
inclCd: trestleState.inclCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '',
roofPitch: Math.round(trestleState.roofPitch) ?? '',
roofPitch: trestleState.roofPitch ?? '',
}).then((res) => {
if (res?.data) setConstructionList(res.data)
})

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()
}
@ -431,8 +430,7 @@ export function useRoofAllocationSetting(id) {
setSelectedMenu('surface')
/** 모듈 선택 데이터 초기화 */
// modifyModuleSelectionData()
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
modifyModuleSelectionData()
}
/**