모듈 설치면 초기화 기능
This commit is contained in:
parent
02a0e4a67f
commit
e872df680d
@ -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>
|
||||||
|
|||||||
@ -94,17 +94,9 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const listParams = roofConstructions.map((item) => {
|
const listParams = roofConstructions.map((item) => {
|
||||||
return {
|
return {
|
||||||
...common,
|
...common,
|
||||||
roofMatlCd: item.addRoof.roofMatlCd,
|
...item.addRoof,
|
||||||
trestleMkrCd: item.addRoof.trestleMkrCd,
|
|
||||||
constMthdCd: item.addRoof.constMthdCd,
|
|
||||||
roofBaseCd: item.addRoof.roofBaseCd,
|
|
||||||
constTp: item.addRoof.constTp,
|
|
||||||
mixMatlNo: selectedModules.mixMatlNo,
|
|
||||||
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
||||||
inclCd: String(item.addRoof.pitch),
|
inclCd: String(item.addRoof.pitch),
|
||||||
roofIndex: item.addRoof.index,
|
|
||||||
workingWidth: item.addRoof.lenBase,
|
|
||||||
raftBaseCd: item.trestle.raftBaseCd,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setTrestleDetailParams(listParams)
|
setTrestleDetailParams(listParams)
|
||||||
@ -177,9 +169,11 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
trestleDetailList.forEach((detail) => {
|
trestleDetailList.forEach((detail) => {
|
||||||
const moduleRowArray = []
|
const moduleRowArray = []
|
||||||
detail.data.module.forEach((module) => {
|
if (detail.data !== null && detail.data.module.length > 0) {
|
||||||
moduleRowArray.push({ moduleMaxRows: module.moduleMaxRows, mixModuleMaxRows: module.mixModuleMaxRows })
|
detail.data.module.forEach((module) => {
|
||||||
})
|
moduleRowArray.push({ moduleMaxRows: module.moduleMaxRows, mixModuleMaxRows: module.mixModuleMaxRows })
|
||||||
|
})
|
||||||
|
}
|
||||||
rowColArray.push(moduleRowArray)
|
rowColArray.push(moduleRowArray)
|
||||||
})
|
})
|
||||||
setModuleRowColArray(rowColArray)
|
setModuleRowColArray(rowColArray)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user