모듈 공법 선택 유지 작업중
This commit is contained in:
parent
2aa39acca5
commit
3b431f593b
@ -227,6 +227,7 @@ export default function Module({}) {
|
||||
index={index}
|
||||
addRoof={roof}
|
||||
roofTab={roofTab}
|
||||
moduleSelectionData={moduleSelectionData}
|
||||
setModuleSelectionData={setModuleSelectionData}
|
||||
tempModuleSelectionData={tempModuleSelectionData}
|
||||
setTempModuleSelectionData={setTempModuleSelectionData}
|
||||
|
||||
@ -8,7 +8,14 @@ import { moduleSelectionInitParamsState, selectedModuleState } from '@/store/sel
|
||||
import { isNotEmptyArray, isObjectNotEmpty } from '@/util/common-utils'
|
||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||
|
||||
export default function ModuleTabContents({ addRoof, roofTab, setModuleSelectionData, tempModuleSelectionData, setTempModuleSelectionData }) {
|
||||
export default function ModuleTabContents({
|
||||
addRoof,
|
||||
roofTab,
|
||||
moduleSelectionData,
|
||||
setModuleSelectionData,
|
||||
tempModuleSelectionData,
|
||||
setTempModuleSelectionData,
|
||||
}) {
|
||||
const { getMessage } = useMessage()
|
||||
const canvasSetting = useRecoilValue(canvasSettingState) //캔버스 기본 셋팅
|
||||
const [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재
|
||||
@ -33,7 +40,6 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
const [trestleParams, setTrestleParams] = useState({}) //서까래, 가대메이커,공법,지붕밑바탕 관련 api호출 파라메터
|
||||
|
||||
const moduleSelectionInitParams = useRecoilValue(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등
|
||||
const selectedModules = useRecoilValue(selectedModuleState) //선택된 모듈
|
||||
|
||||
const { getTrestleList, getConstructionList } = useMasterController()
|
||||
|
||||
@ -48,12 +54,22 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
const handleChangeRaftBase = (option) => {
|
||||
setSelectedRaftBase(option)
|
||||
setTrestleParams({ ...trestleParams, raftBaseCd: option.clCode })
|
||||
|
||||
setTrestleList([]) //가대메이커
|
||||
setConstMthdList([]) //공법 초기화
|
||||
setRoofBaseList([]) //지붕밑바탕 초기화
|
||||
}
|
||||
|
||||
//가대메이커 변경
|
||||
const handleChangeTrestle = (option) => {
|
||||
setSelectedTrestle(option) //선택값 저장
|
||||
setTrestleParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '' })
|
||||
if (option) {
|
||||
setSelectedTrestle(option) //선택값 저장
|
||||
setTrestleParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' })
|
||||
} else {
|
||||
const existTrestle = moduleSelectionData.roofConstructions[roofTab].trestle
|
||||
setSelectedTrestle(existTrestle)
|
||||
setTrestleParams({ ...existTrestle, constMthdCd: '', roofBaseCd: '' })
|
||||
}
|
||||
|
||||
setConstMthdList([]) //공법 초기화
|
||||
setRoofBaseList([]) //지붕밑바탕 초기화
|
||||
@ -61,20 +77,34 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
|
||||
//공법 변경
|
||||
const handleChangeConstMthd = (option) => {
|
||||
setSelectedConstMthd(option) //선택된값 저장
|
||||
setTrestleParams({ ...trestleParams, constMthdCd: option.constMthdCd, roofBaseCd: '' })
|
||||
if (option) {
|
||||
setSelectedConstMthd(option) //선택된값 저장
|
||||
setTrestleParams({ ...trestleParams, constMthdCd: option.constMthdCd, roofBaseCd: '' })
|
||||
} else {
|
||||
const existTrestle = moduleSelectionData.roofConstructions[roofTab].trestle
|
||||
setSelectedConstMthd(existTrestle)
|
||||
setTrestleParams({ ...existTrestle, constMthdCd: '', roofBaseCd: '' })
|
||||
}
|
||||
|
||||
setRoofBaseList([])
|
||||
}
|
||||
|
||||
//지붕밑바탕변경
|
||||
const handleChangeRoofBase = (option) => {
|
||||
setConstructionListParams({
|
||||
...moduleSelectionInitParams,
|
||||
...trestleParams,
|
||||
roofBaseCd: option.roofBaseCd,
|
||||
})
|
||||
|
||||
setSelectedRoofBase(option)
|
||||
if (option) {
|
||||
setConstructionListParams({
|
||||
...moduleSelectionInitParams,
|
||||
...trestleParams,
|
||||
roofBaseCd: option.roofBaseCd,
|
||||
})
|
||||
setSelectedRoofBase(option)
|
||||
} else {
|
||||
const existTrestle = moduleSelectionData.roofConstructions[roofTab].trestle
|
||||
setConstructionListParams({
|
||||
...existTrestle,
|
||||
})
|
||||
setSelectedRoofBase(existTrestle)
|
||||
}
|
||||
}
|
||||
|
||||
const getModuleOptionsListData = async (params) => {
|
||||
@ -165,10 +195,6 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
useEffect(() => {
|
||||
// 202600 경사도
|
||||
const raftCodeList = findCommonCode('203800')
|
||||
|
||||
console.log('addRoof', addRoof)
|
||||
console.log('raftCodeList', raftCodeList)
|
||||
|
||||
//서까래 코드
|
||||
raftCodeList.forEach((obj) => {
|
||||
obj.name = obj.clCodeNm
|
||||
@ -208,15 +234,16 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
}, [constructionListParams])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ useEffect ~ tempModuleSelectionData:', tempModuleSelectionData)
|
||||
|
||||
if (isObjectNotEmpty(tempModuleSelectionData)) {
|
||||
setModuleSelectionData(tempModuleSelectionData)
|
||||
}
|
||||
}, [tempModuleSelectionData])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('addRoof', addRoof)
|
||||
if (isObjectNotEmpty(moduleSelectionData.roofConstructions[roofTab])) {
|
||||
handleChangeTrestle()
|
||||
handleChangeConstMthd()
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
@ -300,7 +327,7 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
<QSelectBox
|
||||
title={getMessage('selectbox.title')}
|
||||
options={trestleList}
|
||||
// value={roofTabParams[roofTab]}
|
||||
value={selectedTrestle}
|
||||
sourceKey={'trestleMkrCd'}
|
||||
targetKey={'trestleMkrCd'}
|
||||
showKey={'trestleMkrCdNm'}
|
||||
@ -318,7 +345,7 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
<QSelectBox
|
||||
title={getMessage('selectbox.title')}
|
||||
options={constMthdList}
|
||||
// value={roofTabParams[roofTab]}
|
||||
value={selectedConstMthd}
|
||||
sourceKey={'constMthdCd'}
|
||||
targetKey={'constMthdCd'}
|
||||
showKey={'constMthdCdNm'}
|
||||
@ -336,7 +363,7 @@ export default function ModuleTabContents({ addRoof, roofTab, setModuleSelection
|
||||
<QSelectBox
|
||||
title={getMessage('selectbox.title')}
|
||||
options={roofBaseList}
|
||||
// value={roofTabParams[roofTab]}
|
||||
value={selectedRoofBase}
|
||||
sourceKey={'roofBaseCd'}
|
||||
targetKey={'roofBaseCd'}
|
||||
showKey={'roofBaseCdNm'}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user