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(() => { useEffect(() => {
if (roofsStore && addedRoofs) { if (roofsStore && addedRoofs) {
console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs) console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs)
// setRoofs( setRoofs(
// addedRoofs.map((roof, index) => { addedRoofs.map((roof, index) => {
// return { return {
// ...roof, ...roof,
// ...roofsStore[index]?.addRoof, ...roofsStore[index]?.addRoof,
// } }
// }), }),
// ) )
setModuleSelectionData({ setModuleSelectionData({
...moduleSelectionData, ...moduleSelectionData,

View File

@ -1,5 +1,6 @@
import { GlobalDataContext } from '@/app/GlobalDataProvider' import { GlobalDataContext } from '@/app/GlobalDataProvider'
import QSelectBox from '@/components/common/select/QSelectBox' import QSelectBox from '@/components/common/select/QSelectBox'
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
import { useModuleTrestle } from '@/hooks/module/useModuleTrestle' import { useModuleTrestle } from '@/hooks/module/useModuleTrestle'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom' import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom'
@ -45,18 +46,22 @@ const Trestle = forwardRef((props, ref) => {
const selectedModules = useRecoilValue(selectedModuleState) // const selectedModules = useRecoilValue(selectedModuleState) //
// const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) // const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
const [lengthBase, setLengthBase] = useState(0) const [lengthBase, setLengthBase] = useState(0)
const [hajebichi, setHajebichi] = useState(trestleState?.roofPitch ?? 0) const [hajebichi, setHajebichi] = useState(0)
const [selectedRaftBase, setSelectedRaftBase] = useState(null) const [selectedRaftBase, setSelectedRaftBase] = useState(null)
const [selectedTrestle, setSelectedTrestle] = useState(null) const [selectedTrestle, setSelectedTrestle] = useState(null)
const [selectedConstMthd, setSelectedConstMthd] = useState(null) const [selectedConstMthd, setSelectedConstMthd] = useState(null)
const [selectedConstruction, setSelectedConstruction] = useState(null) const [selectedConstruction, setSelectedConstruction] = useState(null)
const [selectedRoofBase, setSelectedRoofBase] = useState(null) const [selectedRoofBase, setSelectedRoofBase] = useState(null)
const { managementState } = useContext(GlobalDataContext) const { managementState } = useContext(GlobalDataContext)
const { restoreModuleInstArea } = useModuleBasicSetting()
useEffect(() => { useEffect(() => {
if (roofs && !selectedRoof) { if (roofs && !selectedRoof) {
setSelectedRoof(roofs[0]) setSelectedRoof(roofs[0])
} }
//
restoreModuleInstArea()
}, [roofs]) }, [roofs])
useEffect(() => { useEffect(() => {
@ -196,12 +201,10 @@ const Trestle = forwardRef((props, ref) => {
stdWindSpeed: managementState?.standardWindSpeedId ?? '', stdWindSpeed: managementState?.standardWindSpeedId ?? '',
stdSnowLd: +managementState?.verticalSnowCover ?? '', stdSnowLd: +managementState?.verticalSnowCover ?? '',
inclCd: selectedRoof?.pitch.toString() ?? 0, inclCd: selectedRoof?.pitch.toString() ?? 0,
// roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0), roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
roofPitch: hajebichi ?? 0,
constTp: constructionList[index].constTp, constTp: constructionList[index].constTp,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
// workingWidth: selectedRoof?.length.toString() ?? '', workingWidth: selectedRoof?.length.toString() ?? '',
workingWidth: lengthBase ?? '',
// snowGdPossYn: constructionList[index].snowGdPossYn, // snowGdPossYn: constructionList[index].snowGdPossYn,
// cvrYn: constructionList[index].cvrYn, // cvrYn: constructionList[index].cvrYn,
}, },
@ -256,13 +259,14 @@ const Trestle = forwardRef((props, ref) => {
} }
}) })
console.log('newAddedRoofs', newAddedRoofs)
if (result) { if (result) {
setRoofs(newAddedRoofs) setRoofs(newAddedRoofs)
setModuleSelectionData({ setModuleSelectionData({
...moduleSelectionData, ...moduleSelectionData,
roofConstructions: newAddedRoofs.map((roof, index) => { roofConstructions: newAddedRoofs.map((roof, index) => {
return { return {
roofIndex: index,
addRoof: { addRoof: {
...moduleSelectionData.roofConstructions[index]?.addRoof, ...moduleSelectionData.roofConstructions[index]?.addRoof,
...roof.addRoof, ...roof.addRoof,
@ -272,8 +276,8 @@ const Trestle = forwardRef((props, ref) => {
...moduleSelectionData.roofConstructions[index]?.trestle, ...moduleSelectionData.roofConstructions[index]?.trestle,
}, },
construction: { construction: {
...moduleSelectionData.roofConstructions[index]?.construction,
...roof.construction, ...roof.construction,
...moduleSelectionData.roofConstructions[index]?.construction,
}, },
trestleDetail: { trestleDetail: {
...roof.trestleDetail, ...roof.trestleDetail,
@ -339,7 +343,7 @@ const Trestle = forwardRef((props, ref) => {
<input <input
type="text" type="text"
className="input-origin block" className="input-origin block"
value={lengthBase} value={trestleState?.lengthBase}
onChange={(e) => setLengthBase(e.target.value)} onChange={(e) => setLengthBase(e.target.value)}
disabled={selectedRoof.lenAuth === 'R'} disabled={selectedRoof.lenAuth === 'R'}
/> />
@ -380,7 +384,7 @@ const Trestle = forwardRef((props, ref) => {
type="text" type="text"
className="input-origin block" className="input-origin block"
disabled={selectedRoof.roofPchAuth === 'R'} disabled={selectedRoof.roofPchAuth === 'R'}
onChange={(e) => setHajebichi(e.target.value)} onChange={(e) => handleHajebichiAndLength(e, 'hajebichi')}
value={hajebichi} value={hajebichi}
/> />
</div> </div>

View File

@ -8,6 +8,8 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
const RAFT_BASE_CODE = '203800' const RAFT_BASE_CODE = '203800'
const trestleReducer = (state, action) => { const trestleReducer = (state, action) => {
console.log('🚀 ~ trestleReducer ~ state:', state)
console.log('🚀 ~ trestleReducer ~ action:', action)
switch (action.type) { switch (action.type) {
case 'SET_RAFT_BASE': case 'SET_RAFT_BASE':
case 'SET_TRESTLE_MAKER': case 'SET_TRESTLE_MAKER':
@ -19,6 +21,7 @@ const trestleReducer = (state, action) => {
...action.roof, ...action.roof,
} }
case 'SET_INITIALIZE': case 'SET_INITIALIZE':
console.log('SET_INITIALIZE')
return { return {
moduleTpCd: action.roof.moduleTpCd ?? '', moduleTpCd: action.roof.moduleTpCd ?? '',
roofMatlCd: action.roof.roofMatlCd ?? '', roofMatlCd: action.roof.roofMatlCd ?? '',
@ -82,6 +85,7 @@ export function useModuleTrestle(props) {
useEffect(() => { useEffect(() => {
if (trestleState) { if (trestleState) {
console.log('🚀 ~ useEffect ~ trestleState:', trestleState)
handleSetTrestleList() handleSetTrestleList()
if (!trestleState.trestleMkrCd) { if (!trestleState.trestleMkrCd) {
setConstMthdList([]) setConstMthdList([])
@ -164,7 +168,7 @@ export function useModuleTrestle(props) {
stdSnowLd: trestleState.stdSnowLd ?? '', stdSnowLd: trestleState.stdSnowLd ?? '',
inclCd: trestleState.inclCd ?? '', inclCd: trestleState.inclCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '', raftBaseCd: trestleState.raftBaseCd ?? '',
roofPitch: Math.round(trestleState.roofPitch) ?? '', roofPitch: trestleState.roofPitch ?? '',
}).then((res) => { }).then((res) => {
if (res?.data) setConstructionList(res.data) 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) => { 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()
} }
@ -431,8 +430,7 @@ export function useRoofAllocationSetting(id) {
setSelectedMenu('surface') setSelectedMenu('surface')
/** 모듈 선택 데이터 초기화 */ /** 모듈 선택 데이터 초기화 */
// modifyModuleSelectionData() modifyModuleSelectionData()
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
} }
/** /**