배치면초기설정 수정
This commit is contained in:
parent
e885e7b939
commit
55cb5bb6e2
@ -41,15 +41,30 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
||||
hajebichi: useRef(null),
|
||||
}
|
||||
|
||||
//치수 입력방법(복시도입력/실측값입력/육지붕)
|
||||
const roofSizeSetArray = [
|
||||
{ id: 'ra01', name: 'roofSizeSet', value: '1', checked: 'ture', message: 'modal.placement.initial.setting.size.roof' },
|
||||
{ id: 'ra02', name: 'roofSizeSet', value: '2', checked: 'false', message: 'modal.placement.initial.setting.size.actual' },
|
||||
{ id: 'ra03', name: 'roofSizeSet', value: '3', checked: 'false', message: 'modal.placement.initial.setting.size.none.pitch' },
|
||||
]
|
||||
|
||||
//지붕각도 설정(경사/각도)
|
||||
const roofAngleSetArray = [
|
||||
{ id: 'ra04', name: 'roofAngleSet', value: 'slope', checked: 'true', message: 'modal.placement.initial.setting.roof.pitch'},
|
||||
{ id: 'ra05', name: 'roofAngleSet', value: 'flat', checked: 'false', message: 'modal.placement.initial.setting.roof.angle' },
|
||||
]
|
||||
|
||||
// 데이터를 최초 한 번만 조회
|
||||
useEffect(() => {
|
||||
if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return
|
||||
const raftCodeList = findCommonCode('203800')
|
||||
setRaftCodes(raftCodeList)
|
||||
setCurrentRoof({ ...currentRoof, roofSizeSet: basicSetting.roofMaterials.roofSizeSet, roofAngleSet: basicSetting.roofMaterials.roofAngleSet })
|
||||
setCurrentRoof({ ...currentRoof, roofSizeSet: basicSetting.roofSizeSet, roofAngleSet: basicSetting.roofAngleSet })
|
||||
console.log('🚀 ~ fetchBasicSettings ~ currentRoof 11:', currentRoof)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ fetchBasicSettings ~ currentRoof 22:', currentRoof)
|
||||
setBasicSettings({
|
||||
...basicSetting,
|
||||
roofSizeSet: String(currentRoof.roofSizeSet),
|
||||
@ -110,10 +125,8 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
||||
}
|
||||
|
||||
const newAddedRoofs = [...addedRoofs]
|
||||
if (addedRoofs.length === 1) {
|
||||
newAddedRoofs[0] = { ...roofInfo }
|
||||
setAddedRoofs(newAddedRoofs)
|
||||
}
|
||||
|
||||
console.log('save Info', {
|
||||
...basicSetting,
|
||||
@ -179,42 +192,22 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
||||
</th>
|
||||
<td>
|
||||
<div className="pop-form-radio">
|
||||
{currentRoof &&
|
||||
roofSizeSetArray.map((item) => (
|
||||
<div className="d-check-radio pop">
|
||||
<input
|
||||
type="radio"
|
||||
name="roofSizeSet"
|
||||
id="ra01"
|
||||
value="1" // roofSizeSet 값이 '1'인 경우
|
||||
checked={currentRoof?.roofSizeSet === '1'} // 선택 여부 확인
|
||||
//onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // 상태 업데이트
|
||||
onClick={() => handleRoofSizeSetChange('1')}
|
||||
<input type="radio"
|
||||
key={item.id}
|
||||
id={item.id}
|
||||
name={item.name}
|
||||
value={item.value}
|
||||
checked={currentRoof?.roofSizeSet === item.value}
|
||||
defaultChecked={'1'}
|
||||
onChange={(e) => setCurrentRoof({ ...currentRoof, roofSizeSet: e.target.value })}
|
||||
/>
|
||||
<label htmlFor="ra01">{getMessage('modal.placement.initial.setting.size.roof')}</label>
|
||||
</div>
|
||||
<div className="d-check-radio pop">
|
||||
<input
|
||||
type="radio"
|
||||
name="roofSizeSet"
|
||||
id="ra02"
|
||||
value="2" // roofSizeSet 값이 '2'인 경우
|
||||
checked={currentRoof?.roofSizeSet === '2'} // 선택 여부 확인
|
||||
//onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // 상태 업데이트
|
||||
onClick={() => handleRoofSizeSetChange('2')}
|
||||
/>
|
||||
<label htmlFor="ra02">{getMessage('modal.placement.initial.setting.size.actual')}</label>
|
||||
</div>
|
||||
<div className="d-check-radio pop">
|
||||
<input
|
||||
type="radio"
|
||||
name="roofSizeSet"
|
||||
id="ra03"
|
||||
value="3" // roofSizeSet 값이 '3'인 경우
|
||||
checked={currentRoof?.roofSizeSet === '3'} // 선택 여부 확인
|
||||
//onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // 상태 업데이트
|
||||
onClick={() => handleRoofSizeSetChange('3')}
|
||||
/>
|
||||
<label htmlFor="ra03">{getMessage('modal.placement.initial.setting.size.none.pitch')}</label>
|
||||
<label htmlFor={item.id}>{getMessage(item.message)}</label>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -222,30 +215,22 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
||||
<th>{getMessage('modal.placement.initial.setting.roof.angle.setting')}</th>
|
||||
<td>
|
||||
<div className="pop-form-radio">
|
||||
{currentRoof &&
|
||||
roofAngleSetArray.map((item) => (
|
||||
<div className="d-check-radio pop">
|
||||
<input
|
||||
type="radio"
|
||||
name="roofAngleSet"
|
||||
id="ra04"
|
||||
value="slope" // 첫 번째 라디오 버튼의 값
|
||||
checked={currentRoof?.roofAngleSet === 'slope'} // 현재 선택된 값인지 확인
|
||||
//onChange={(e) => setBasicSettings({ ...basicSetting, roofAngleSet: e.target.value })} // 상태 업데이트
|
||||
onClick={() => handleRoofAngleSetChange('slope')}
|
||||
<input type="radio"
|
||||
key={item.id}
|
||||
id={item.id}
|
||||
name={item.name}
|
||||
value={item.value}
|
||||
checked={currentRoof?.roofAngleSet === item.value}
|
||||
defaultChecked={'slope'}
|
||||
onChange={(e) => setCurrentRoof({ ...currentRoof, roofAngleSet: e.target.value })}
|
||||
/>
|
||||
<label htmlFor="ra04">{getMessage('modal.placement.initial.setting.roof.pitch')}</label>
|
||||
</div>
|
||||
<div className="d-check-radio pop">
|
||||
<input
|
||||
type="radio"
|
||||
name="roofAngleSet"
|
||||
id="ra05"
|
||||
value="flat" // 두 번째 라디오 버튼의 값
|
||||
checked={currentRoof?.roofAngleSet === 'flat'} // 현재 선택된 값인지 확인
|
||||
//onChange={(e) => setBasicSettings({ ...basicSetting, roofAngleSet: e.target.value })} // 상태 업데이트
|
||||
onClick={() => handleRoofAngleSetChange('flat')}
|
||||
/>
|
||||
<label htmlFor="ra05">{getMessage('modal.placement.initial.setting.roof.angle')}</label>
|
||||
<label htmlFor={item.id}>{getMessage(item.message)}</label>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -264,7 +249,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
||||
currentRoof?.roofSizeSet === '3' ? getMessage('modal.placement.initial.setting.size.none.pitch') : currentRoof?.roofMatlNm
|
||||
}
|
||||
ref={roofRef.roofCd}
|
||||
options={roofMaterials.map((roof, index) => {
|
||||
options={roofMaterials.map((roof) => {
|
||||
return { ...roof, name: globalLocale === 'ko' ? roof.roofMatlNm : roof.roofMatlNmJp }
|
||||
})}
|
||||
value={currentRoof?.roofSizeSet === '3' ? null : currentRoof?.roofMatlCd}
|
||||
|
||||
@ -328,23 +328,27 @@ export function useCanvasSetting() {
|
||||
|
||||
// 데이터 설정
|
||||
const addRoofs = []
|
||||
for (let i = 0; i < roofsArray.length; i++) {
|
||||
roofMaterials?.map((material) => {
|
||||
if (material.roofMatlCd === roofsArray[0].roofMatlCd) {
|
||||
if (material.roofMatlCd === roofsArray[i].roofMatlCd) {
|
||||
addRoofs.push({
|
||||
...material,
|
||||
selected: true,
|
||||
index: 0,
|
||||
width: roofsArray[0].roofWidth,
|
||||
length: roofsArray[0].roofHeight,
|
||||
hajebichi: roofsArray[0].roofHajebichi,
|
||||
raft: roofsArray[0].roofGap,
|
||||
layout: roofsArray[0].roofLayout,
|
||||
roofSizeSet: roofsRow[0].roofSizeSet,
|
||||
roofAngleSet: roofsRow[0].roofAngleSet,
|
||||
pitch: roofsArray[0].roofPitch,
|
||||
angle: roofsArray[0].roofAngle,
|
||||
selected: roofsArray[i].roofApply,
|
||||
index: i,
|
||||
width: roofsArray[i].roofWidth,
|
||||
length: roofsArray[i].roofHeight,
|
||||
hajebichi: roofsArray[i].roofHajebichi,
|
||||
raft: roofsArray[i].roofGap,
|
||||
layout: roofsArray[i].roofLayout,
|
||||
roofSizeSet: roofsRow[i].roofSizeSet,
|
||||
roofAngleSet: roofsRow[i].roofAngleSet,
|
||||
pitch: roofsArray[i].roofPitch,
|
||||
angle: roofsArray[i].roofAngle,
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log('🚀 ~ fetchBasicSettings ~ addRoofs:', addRoofs)
|
||||
setAddedRoofs(addRoofs)
|
||||
setBasicSettings({
|
||||
...basicSetting,
|
||||
@ -354,8 +358,6 @@ export function useCanvasSetting() {
|
||||
roofsData: roofsArray,
|
||||
selectedRoofMaterial: addRoofs[0],
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Data fetching error:', error)
|
||||
|
||||
@ -151,10 +151,11 @@ export function useRoofAllocationSetting(id) {
|
||||
pitch: roofsArray[i].roofPitch,
|
||||
angle: roofsArray[i].roofAngle,
|
||||
})
|
||||
setCurrentRoofList(selectRoofs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setCurrentRoofList(selectRoofs)
|
||||
setBasicSetting({ ...basicSetting, roofsData: roofsArray })
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user