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