[1027] : [【HANASYS DESIGN】横葺に使用する金具の離隔について]

[작업내용] : length 변경시 하위 필드 초기화
This commit is contained in:
김민식 2025-05-08 13:21:54 +09:00
parent cbdbade89f
commit c0c3295b04
2 changed files with 33 additions and 5 deletions

View File

@ -124,7 +124,6 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (constructionList.length > 0) { if (constructionList.length > 0) {
console.log(constructionList)
setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null) setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null)
} else { } else {
setSelectedConstruction(null) setSelectedConstruction(null)
@ -144,6 +143,19 @@ const Trestle = forwardRef((props, ref) => {
return 'no-click' return 'no-click'
} }
const onChangeLength = (e) => {
setLengthBase(e)
dispatch({
type: 'SET_LENGTH',
roof: {
length: e,
moduleTpCd: selectedModules.itemTp ?? '',
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
raftBaseCd: selectedRaftBase?.clCode,
},
})
}
const onChangeRaftBase = (e) => { const onChangeRaftBase = (e) => {
setSelectedRaftBase(e) setSelectedRaftBase(e)
dispatch({ dispatch({
@ -225,7 +237,8 @@ const Trestle = forwardRef((props, ref) => {
snowGdPossYn: constructionList[index].snowGdPossYn, snowGdPossYn: constructionList[index].snowGdPossYn,
cvrYn: constructionList[index].cvrYn, cvrYn: constructionList[index].cvrYn,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
workingWidth: selectedRoof?.length?.toString() ?? '', // workingWidth: selectedRoof?.length?.toString() ?? '',
workingWidth: lengthBase,
}, },
}) })
@ -242,7 +255,7 @@ const Trestle = forwardRef((props, ref) => {
return { return {
...selectedRoof, ...selectedRoof,
hajebichi, hajebichi,
lenBase: lengthBase, length: lengthBase,
eavesMargin, eavesMargin,
ridgeMargin, ridgeMargin,
kerabaMargin, kerabaMargin,
@ -518,7 +531,7 @@ const Trestle = forwardRef((props, ref) => {
type="text" type="text"
className="input-origin block" className="input-origin block"
value={lengthBase} value={lengthBase}
onChange={(e) => setLengthBase(e.target.value)} onChange={(e) => onChangeLength(e.target.value)}
disabled={selectedRoof.lenAuth === 'R'} disabled={selectedRoof.lenAuth === 'R'}
/> />
</div> </div>

View File

@ -10,6 +10,7 @@ const RAFT_BASE_CODE = '203800'
const trestleReducer = (state, action) => { const trestleReducer = (state, action) => {
switch (action.type) { switch (action.type) {
case 'SET_LENGTH':
case 'SET_RAFT_BASE': case 'SET_RAFT_BASE':
case 'SET_TRESTLE_MAKER': case 'SET_TRESTLE_MAKER':
case 'SET_CONST_MTHD': case 'SET_CONST_MTHD':
@ -96,11 +97,15 @@ export function useModuleTrestle(props) {
useEffect(() => { useEffect(() => {
if (trestleState) { if (trestleState) {
handleSetTrestleList() handleSetTrestleList()
if (!trestleState?.trestleMkrCd) { if (!trestleState?.trestleMkrCd) {
setConstMthdList([]) setConstMthdList([])
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
@ -109,6 +114,9 @@ export function useModuleTrestle(props) {
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
@ -116,12 +124,18 @@ export function useModuleTrestle(props) {
if (!trestleState?.roofBaseCd) { if (!trestleState?.roofBaseCd) {
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
handleSetConstructionList() handleSetConstructionList()
if (!trestleState?.constTp) { if (!trestleState?.constTp) {
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
@ -224,7 +238,8 @@ export function useModuleTrestle(props) {
constTp: trestleState.constTp ?? '', constTp: trestleState.constTp ?? '',
mixMatlNo: trestleState.mixMatlNo ?? '', mixMatlNo: trestleState.mixMatlNo ?? '',
roofPitch: trestleState.roofPitch ?? '', roofPitch: trestleState.roofPitch ?? '',
workingWidth: trestleState.workingWidth ?? '', // workingWidth: trestleState.length ?? '',
workingWidth: lengthBase ?? '',
}, },
]) ])
.then((res) => { .then((res) => {