Compare commits

..

No commits in common. "6471753cd6a70b8c97431957c1a30b14365b61d2" and "11dacdde04cc720fac547e67141b5407db3d43ad" have entirely different histories.

3 changed files with 15 additions and 24 deletions

View File

@ -86,7 +86,7 @@ export default function ContextRoofAllocationSetting(props) {
return ( return (
<div className="grid-option-box" key={index}> <div className="grid-option-box" key={index}>
<div className="d-check-radio pop no-text"> <div className="d-check-radio pop no-text">
<input type="radio" name="radio01" checked={!!roof.selected} readOnly={true} /> <input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} />
<label <label
htmlFor="ra01" htmlFor="ra01"
onClick={(e) => { onClick={(e) => {
@ -189,7 +189,7 @@ export default function ContextRoofAllocationSetting(props) {
<input <input
type="text" type="text"
className="input-origin block" className="input-origin block"
value={roof.hajebichi ?? ''} value={roof.hajebichi === '' ? '0' : roof.hajebichi}
readOnly={roof.roofPchAuth === 'R'} readOnly={roof.roofPchAuth === 'R'}
onChange={(e) => { onChange={(e) => {
e.target.value = normalizeDigits(e.target.value) e.target.value = normalizeDigits(e.target.value)
@ -211,7 +211,8 @@ export default function ContextRoofAllocationSetting(props) {
e.target.value = normalizeDecimalLimit(e.target.value, 2) e.target.value = normalizeDecimalLimit(e.target.value, 2)
handleChangePitch(e, index) handleChangePitch(e, index)
}} }}
value={currentAngleType === 'slope' ? (roof.pitch ?? '') : (roof.angle ?? '')} value={currentAngleType === 'slope' ? (roof.pitch || '0') : (roof.angle || '0')}
defaultValue={currentAngleType === 'slope' ? (roof.pitch || '0') : (roof.angle || '0')}
/> />
</div> </div>
<span className="absol">{pitchText}</span> <span className="absol">{pitchText}</span>

View File

@ -86,7 +86,7 @@ export default function RoofAllocationSetting(props) {
return ( return (
<div className="grid-option-box" key={index}> <div className="grid-option-box" key={index}>
<div className="d-check-radio pop no-text"> <div className="d-check-radio pop no-text">
<input type="radio" name="radio01" checked={!!roof.selected} readOnly /> <input type="radio" name="radio01" checked={roof.selected} readOnly />
<label <label
htmlFor="ra01" htmlFor="ra01"
onClick={(e) => { onClick={(e) => {
@ -194,7 +194,7 @@ export default function RoofAllocationSetting(props) {
e.target.value = normalizeDigits(e.target.value) e.target.value = normalizeDigits(e.target.value)
handleChangeInput(e, 'hajebichi', index) handleChangeInput(e, 'hajebichi', index)
}} }}
value={roof.hajebichi ?? ''} value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'} readOnly={roof.roofPchAuth === 'R'}
/> />
</div> </div>
@ -212,7 +212,7 @@ export default function RoofAllocationSetting(props) {
e.target.value = normalizeDecimalLimit(e.target.value, 2) e.target.value = normalizeDecimalLimit(e.target.value, 2)
handleChangePitch(e, index) handleChangePitch(e, index)
}} }}
value={currentAngleType === 'slope' ? (roof.pitch ?? '') : (roof.angle ?? '')} value={currentAngleType === 'slope' ? roof.pitch : roof.angle}
/> />
</div> </div>
<span className="absol">{pitchText}</span> <span className="absol">{pitchText}</span>

View File

@ -174,32 +174,22 @@ export function useRoofAllocationSetting(id) {
}) })
} }
const firstRes = Array.isArray(res) && res.length > 0 ? res[0] : null
setBasicSetting({ setBasicSetting({
...basicSetting, ...basicSetting,
planNo: firstRes?.planNo ?? planNo, planNo: res[0].planNo,
roofSizeSet: firstRes?.roofSizeSet ?? 0, roofSizeSet: res[0].roofSizeSet,
roofAngleSet: firstRes?.roofAngleSet ?? 0, roofAngleSet: res[0].roofAngleSet,
roofsData: roofsArray, roofsData: roofsArray,
selectedRoofMaterial: selectRoofs.find((roof) => roof.selected), selectedRoofMaterial: selectRoofs.find((roof) => roof.selected),
}) })
setBasicInfo({ setBasicInfo({
planNo: '' + (firstRes?.planNo ?? planNo), planNo: '' + res[0].planNo,
roofSizeSet: '' + (firstRes?.roofSizeSet ?? 0), roofSizeSet: '' + res[0].roofSizeSet,
roofAngleSet: '' + (firstRes?.roofAngleSet ?? 0), roofAngleSet: '' + res[0].roofAngleSet,
}) })
// 데이터 동기화: 렌더링용 필드 기본값 보정 //데이터 동기화
const normalizedRoofs = selectRoofs.map((roof) => ({ setCurrentRoofList(selectRoofs)
...roof,
width: roof.width ?? '',
length: roof.length ?? '',
hajebichi: roof.hajebichi ?? '',
pitch: roof.pitch ?? '',
angle: roof.angle ?? '',
}))
setCurrentRoofList(normalizedRoofs)
}) })
} catch (error) { } catch (error) {
console.error('Data fetching error:', error) console.error('Data fetching error:', error)