처마력 커버 설치여부 , 적설방지금구설치 여부 값 추가

This commit is contained in:
김민식 2025-04-10 10:46:01 +09:00
parent 76693640cf
commit 74b3c6dac7
2 changed files with 37 additions and 13 deletions

View File

@ -31,6 +31,10 @@ const Trestle = forwardRef((props, ref) => {
setEavesMargin, setEavesMargin,
setRidgeMargin, setRidgeMargin,
setKerabaMargin, setKerabaMargin,
lengthBase,
setLengthBase,
hajebichi,
setHajebichi,
cvrYn, cvrYn,
cvrChecked, cvrChecked,
snowGdPossYn, snowGdPossYn,
@ -44,8 +48,6 @@ 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 [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)
@ -75,11 +77,6 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (selectedRoof) { if (selectedRoof) {
setHajebichi(selectedRoof.hajebichi)
setEavesMargin(selectedRoof?.eavesMargin ?? 0)
setRidgeMargin(selectedRoof?.ridgeMargin ?? 0)
setKerabaMargin(selectedRoof?.kerabaMargin ?? 0)
setLengthBase(Math.round(selectedRoof?.lenBase ?? 0))
if (moduleSelectionData?.roofConstructions?.length >= selectedRoof.index + 1) { if (moduleSelectionData?.roofConstructions?.length >= selectedRoof.index + 1) {
const { construction, trestle, trestleDetail } = moduleSelectionData?.roofConstructions[selectedRoof.index] const { construction, trestle, trestleDetail } = moduleSelectionData?.roofConstructions[selectedRoof.index]
dispatch({ dispatch({
@ -223,10 +220,10 @@ const Trestle = forwardRef((props, ref) => {
inclCd: selectedRoof?.pitch ?? 0, inclCd: selectedRoof?.pitch ?? 0,
roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0), roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
constTp: constructionList[index].constTp, constTp: constructionList[index].constTp,
snowGdPossYn: constructionList[index].snowGdPossYn,
cvrYn: constructionList[index].cvrYn,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
workingWidth: selectedRoof?.length?.toString() ?? '', workingWidth: selectedRoof?.length?.toString() ?? '',
// snowGdPossYn: constructionList[index].snowGdPossYn,
// cvrYn: constructionList[index].cvrYn,
}, },
}) })
@ -247,6 +244,7 @@ const Trestle = forwardRef((props, ref) => {
kerabaMargin, kerabaMargin,
roofIndex: selectedRoof.index, roofIndex: selectedRoof.index,
trestle: { trestle: {
hajebichi: hajebichi,
lengthBase: lengthBase, lengthBase: lengthBase,
...selectedRaftBase, ...selectedRaftBase,
...selectedTrestle, ...selectedTrestle,
@ -255,6 +253,10 @@ const Trestle = forwardRef((props, ref) => {
}, },
construction: { construction: {
...constructionList.find((data) => data.constTp === trestleState.constTp), ...constructionList.find((data) => data.constTp === trestleState.constTp),
cvrYn: cvrYn,
snowGdPossYn: snowGdPossYn,
cvrChecked: cvrChecked,
snowGdChecked: snowGdChecked,
}, },
trestleDetail: trestleDetail, trestleDetail: trestleDetail,
} }
@ -278,6 +280,7 @@ const Trestle = forwardRef((props, ref) => {
roofIndex: roof.index, roofIndex: roof.index,
trestle: { trestle: {
lengthBase: lengthBase, lengthBase: lengthBase,
hajebichi: hajebichi,
...selectedRaftBase, ...selectedRaftBase,
...selectedTrestle, ...selectedTrestle,
...selectedConstMthd, ...selectedConstMthd,
@ -285,6 +288,10 @@ const Trestle = forwardRef((props, ref) => {
}, },
construction: { construction: {
...constructionList.find((data) => data.constTp === trestleState.constTp), ...constructionList.find((data) => data.constTp === trestleState.constTp),
cvrYn,
snowGdPossYn,
cvrChecked,
snowGdChecked,
}, },
trestleDetail: trestleDetail, trestleDetail: trestleDetail,
} }
@ -357,7 +364,8 @@ const Trestle = forwardRef((props, ref) => {
raftBaseCd: roof.raftBaseCd, raftBaseCd: roof.raftBaseCd,
}, },
construction: { construction: {
...constructionList.find((construction) => newAddedRoofs[index].construction.constTp === construction.constTp), // ...constructionList.find((construction) => newAddedRoofs[index].construction.constTp === construction.constTp),
...roof.construction,
roofIndex: roof.index, roofIndex: roof.index,
setupCover: roof.cvrYn === 'Y', setupCover: roof.cvrYn === 'Y',
setupSnowCover: roof.snowGdYn === 'Y', setupSnowCover: roof.snowGdYn === 'Y',
@ -380,8 +388,6 @@ const Trestle = forwardRef((props, ref) => {
return false return false
} }
const getFlag = () => {}
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
isComplete, isComplete,
})) }))
@ -553,7 +559,7 @@ const Trestle = forwardRef((props, ref) => {
<input <input
type="checkbox" type="checkbox"
id={`ch02`} id={`ch02`}
disabled={!trestleState?.snowGdPossYn || trestleState?.snowGdPossYn === 'N'} disabled={!snowGdPossYn || snowGdPossYn === 'N'}
checked={snowGdChecked || false} checked={snowGdChecked || false}
// onChange={() => dispatch({ type: 'SET_TRESTLE_DETAIL', roof: { ...trestleState, snowGdChecked: !trestleState.snowGdChecked } })} // onChange={() => dispatch({ type: 'SET_TRESTLE_DETAIL', roof: { ...trestleState, snowGdChecked: !trestleState.snowGdChecked } })}
onChange={() => setSnowGdChecked(!snowGdChecked)} onChange={() => setSnowGdChecked(!snowGdChecked)}

View File

@ -54,6 +54,9 @@ export function useModuleTrestle(props) {
const [roofBaseList, setRoofBaseList] = useState([]) const [roofBaseList, setRoofBaseList] = useState([])
const [constructionList, setConstructionList] = useState([]) const [constructionList, setConstructionList] = useState([])
const { getTrestleList, getConstructionList, getTrestleDetailList } = useMasterController() const { getTrestleList, getConstructionList, getTrestleDetailList } = useMasterController()
const [lengthBase, setLengthBase] = useState(0)
const [hajebichi, setHajebichi] = useState(0)
const [cvrYn, setCvrYn] = useState('N') const [cvrYn, setCvrYn] = useState('N')
const [cvrChecked, setCvrChecked] = useState(false) const [cvrChecked, setCvrChecked] = useState(false)
const [snowGdPossYn, setSnowGdPossYn] = useState('N') const [snowGdPossYn, setSnowGdPossYn] = useState('N')
@ -76,6 +79,12 @@ export function useModuleTrestle(props) {
// setEavesMargin(selectedRoof?.addRoof?.eavesMargin ?? 0) // setEavesMargin(selectedRoof?.addRoof?.eavesMargin ?? 0)
// setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0) // setRidgeMargin(selectedRoof?.addRoof?.ridgeMargin ?? 0)
// setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0) // setKerabaMargin(selectedRoof?.addRoof?.kerabaMargin ?? 0)
setHajebichi(selectedRoof?.trestle?.hajebichi ?? 0)
setEavesMargin(selectedRoof?.eavesMargin ?? 0)
setRidgeMargin(selectedRoof?.ridgeMargin ?? 0)
setKerabaMargin(selectedRoof?.kerabaMargin ?? 0)
setLengthBase(Math.round(selectedRoof?.trestle?.lengthBase ?? 0))
setCvrYn(selectedRoof?.construction?.cvrYn ?? 'N') setCvrYn(selectedRoof?.construction?.cvrYn ?? 'N')
setCvrChecked(selectedRoof?.construction?.cvrChecked ?? false) setCvrChecked(selectedRoof?.construction?.cvrChecked ?? false)
setSnowGdPossYn(selectedRoof?.construction?.snowGdPossYn ?? 'N') setSnowGdPossYn(selectedRoof?.construction?.snowGdPossYn ?? 'N')
@ -224,6 +233,7 @@ export function useModuleTrestle(props) {
setRidgeMargin(res[0].data.ridgeIntvl) setRidgeMargin(res[0].data.ridgeIntvl)
setKerabaMargin(res[0].data.kerabaIntvl) setKerabaMargin(res[0].data.kerabaIntvl)
setTrestleDetail(res[0].data) setTrestleDetail(res[0].data)
// dispatch({ // dispatch({
// type: 'SET_TRESTLE_DETAIL', // type: 'SET_TRESTLE_DETAIL',
// roof: { // roof: {
@ -255,6 +265,14 @@ export function useModuleTrestle(props) {
handleSetRoofBaseList, handleSetRoofBaseList,
handleSetConstructionList, handleSetConstructionList,
handleSetTrestleDetailData, handleSetTrestleDetailData,
lengthBase,
setLengthBase,
hajebichi,
setHajebichi,
cvrYn,
cvrChecked,
snowGdPossYn,
snowGdChecked,
eavesMargin, eavesMargin,
ridgeMargin, ridgeMargin,
kerabaMargin, kerabaMargin,