currentRoofList 오류 수정

This commit is contained in:
hyojun.choi 2025-01-17 11:11:47 +09:00
parent e01b6d90cb
commit 558594e450
2 changed files with 117 additions and 116 deletions

View File

@ -79,133 +79,134 @@ export default function ContextRoofAllocationSetting(props) {
</button> </button>
</div> </div>
<div className="grid-option-wrap"> <div className="grid-option-wrap">
{currentRoofList.map((roof, index) => { {currentRoofList.length > 0 &&
return ( currentRoofList.map((roof, index) => {
<div className="grid-option-box" key={index}> return (
<div className="d-check-radio pop no-text"> <div className="grid-option-box" key={index}>
<input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} /> <div className="d-check-radio pop no-text">
<label <input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} />
htmlFor="ra01" <label
onClick={(e) => { htmlFor="ra01"
handleDefaultRoofMaterial(index) onClick={(e) => {
}} handleDefaultRoofMaterial(index)
></label> }}
</div> ></label>
<div className="grid-option-block-form">
<div className="block-box">
<div className="flex-ment">
<div className="grid-select" style={{ width: '248px' }}>
<QSelectBox
options={roofMaterials}
value={roof}
showKey={'roofMatlNm'}
sourceKey={'roofMatlCd'}
targetKey={'roofMatlCd'}
onChange={(e) => handleChangeRoofMaterial(e, index)}
/>
</div>
{index === 0 && <span className="dec">{getMessage('modal.roof.alloc.default.roof.material')}</span>}
{index !== 0 && <button className="delete" onClick={() => onDeleteRoofMaterial(index)}></button>}
</div>
</div> </div>
<div className="block-box"> <div className="grid-option-block-form">
<div className="flex-ment"> <div className="block-box">
<span>{getMessage('slope')}</span> <div className="flex-ment">
<div className="input-grid" style={{ width: '214px' }}> <div className="grid-select" style={{ width: '248px' }}>
<input <QSelectBox
type="text" options={roofMaterials}
className="input-origin block" value={roof}
onChange={(e) => { showKey={'roofMatlNm'}
handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index) sourceKey={'roofMatlCd'}
}} targetKey={'roofMatlCd'}
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle} onChange={(e) => handleChangeRoofMaterial(e, index)}
/> />
</div>
{index === 0 && <span className="dec">{getMessage('modal.roof.alloc.default.roof.material')}</span>}
{index !== 0 && <button className="delete" onClick={() => onDeleteRoofMaterial(index)}></button>}
</div> </div>
<span>{pitchText}</span>
</div> </div>
</div>
{(roof.widAuth || roof.lenAuth) && (
<div className="block-box"> <div className="block-box">
{roof.widAuth && ( <div className="flex-ment">
<div className="flex-ment"> <span>{getMessage('slope')}</span>
<span>W</span> <div className="input-grid" style={{ width: '214px' }}>
<div className="input-grid" style={{ width: '100px' }}> <input
<input type="text" className="input-origin block" defaultValue={roof.width} readOnly={roof.widAuth === 'R'} /> type="text"
</div> className="input-origin block"
onChange={(e) => {
handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index)
}}
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
/>
</div> </div>
)} <span>{pitchText}</span>
{roof.lenAuth && ( </div>
<div className="flex-ment">
<span>L</span>
<div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={roof.length} readOnly={roof.lenAuth === 'R'} />
</div>
</div>
)}
</div> </div>
)} {(roof.widAuth || roof.lenAuth) && (
{(roof.raftAuth || roof.roofPchAuth) && ( <div className="block-box">
<div className="block-box"> {roof.widAuth && (
{roof.raftAuth && (
<div className="block-box">
<div className="flex-ment"> <div className="flex-ment">
<span>{getMessage('modal.placement.initial.setting.rafter')}</span> <span>W</span>
{raftCodes.length > 0 && ( <div className="input-grid" style={{ width: '100px' }}>
<div className="grid-select" style={{ width: '160px' }}> <input type="text" className="input-origin block" defaultValue={roof.width} readOnly={roof.widAuth === 'R'} />
<QSelectBox
options={raftCodes}
value={roof}
showKey={'clCodeNm'}
sourceKey={'clCode'}
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
/>
</div>
)}
</div>
</div>
)}
{roof.roofPchAuth && (
<div className="block-box">
<div className="flex-ment">
<span>{getMessage('hajebichi')}</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'}
/>
</div> </div>
</div> </div>
</div> )}
)} {roof.lenAuth && (
</div> <div className="flex-ment">
)} <span>L</span>
<div className="block-box"> <div className="input-grid" style={{ width: '100px' }}>
<div className="icon-btn-wrap"> <input type="text" className="input-origin block" defaultValue={roof.length} readOnly={roof.lenAuth === 'R'} />
<button </div>
className={roof.layout === ROOF_MATERIAL_LAYOUT.PARALLEL ? 'act' : ''} </div>
onClick={() => { )}
handleChangeLayout(ROOF_MATERIAL_LAYOUT.PARALLEL, index) </div>
}} )}
> {(roof.raftAuth || roof.roofPchAuth) && (
{getMessage('modal.roof.alloc.select.parallel')} <div className="block-box">
<i className="allocation01"></i> {roof.raftAuth && (
</button> <div className="block-box">
<button <div className="flex-ment">
className={roof.layout === ROOF_MATERIAL_LAYOUT.STAIRS ? 'act' : ''} <span>{getMessage('modal.placement.initial.setting.rafter')}</span>
onClick={() => { {raftCodes.length > 0 && (
handleChangeLayout(ROOF_MATERIAL_LAYOUT.STAIRS, index) <div className="grid-select" style={{ width: '160px' }}>
}} <QSelectBox
> options={raftCodes}
{getMessage('modal.roof.alloc.select.stairs')} <i className="allocation02"></i> value={roof}
</button> showKey={'clCodeNm'}
sourceKey={'clCode'}
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
/>
</div>
)}
</div>
</div>
)}
{roof.roofPchAuth && (
<div className="block-box">
<div className="flex-ment">
<span>{getMessage('hajebichi')}</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'}
/>
</div>
</div>
</div>
)}
</div>
)}
<div className="block-box">
<div className="icon-btn-wrap">
<button
className={roof.layout === ROOF_MATERIAL_LAYOUT.PARALLEL ? 'act' : ''}
onClick={() => {
handleChangeLayout(ROOF_MATERIAL_LAYOUT.PARALLEL, index)
}}
>
{getMessage('modal.roof.alloc.select.parallel')}
<i className="allocation01"></i>
</button>
<button
className={roof.layout === ROOF_MATERIAL_LAYOUT.STAIRS ? 'act' : ''}
onClick={() => {
handleChangeLayout(ROOF_MATERIAL_LAYOUT.STAIRS, index)
}}
>
{getMessage('modal.roof.alloc.select.stairs')} <i className="allocation02"></i>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> )
) })}
})}
</div> </div>
<div className="grid-btn-wrap"> <div className="grid-btn-wrap">
<button className="btn-frame modal act" onClick={handleSaveContext}> <button className="btn-frame modal act" onClick={handleSaveContext}>

View File

@ -42,7 +42,7 @@ export function useRoofAllocationSetting(id) {
const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // 팝업 내 기준 지붕재 const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // 팝업 내 기준 지붕재
const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열 const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열
const [editingLines, setEditingLines] = useState([]) const [editingLines, setEditingLines] = useState([])
const [currentRoofList, setCurrentRoofList] = useState(null) const [currentRoofList, setCurrentRoofList] = useState([])
const currentAngleType = useRecoilValue(currentAngleTypeSelector) const currentAngleType = useRecoilValue(currentAngleTypeSelector)
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
const [basicInfo, setBasicInfo] = useState(null) const [basicInfo, setBasicInfo] = useState(null)