Merge pull request '[1351]경사도 기본 수치 추가 inclBase' (#471) from dev_ysCha into dev

Reviewed-on: #471
This commit is contained in:
ysCha 2025-12-15 16:44:05 +09:00
commit 9a37959b60
3 changed files with 67 additions and 52 deletions

View File

@ -170,8 +170,8 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
setCurrentRoof({
...selectedRoofMaterial,
pitch: currentRoof?.pitch,
angle: currentRoof?.angle,
// pitch: currentRoof?.pitch,
// angle: currentRoof?.angle,
index: 0,
planNo: currentRoof.planNo,
roofSizeSet: String(currentRoof.roofSizeSet),
@ -353,19 +353,21 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
value={index === 0 ? currentRoof?.pitch || '0' : currentRoof?.angle || '0'}
onChange={(value) => {
if (index === 0) {
const num = value === '' ? '' : Number(value)
const pitch = value === '' ? '' : Number(value);
const angle = pitch === '' ? '' : getDegreeByChon(pitch);
setCurrentRoof(prev => ({
...prev,
pitch: num === '' ? '' : num,
angle: num === '' ? '' : getDegreeByChon(num),
}))
pitch,
angle
}));
} else {
const num = value === '' ? '' : Number(value)
const angle = value === '' ? '' : Number(value);
const pitch = angle === '' ? '' : getChonByDegree(angle);
setCurrentRoof(prev => ({
...prev,
pitch: num === '' ? '' : getChonByDegree(num),
angle: num === '' ? '' : num,
}))
pitch,
angle
}));
}
}}
options={{
@ -514,13 +516,17 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
{/*/>*/}
<CalculatorInput
id=""
name={'hajebichi'}
name="hajebichi"
label=""
className="input-origin block"
ref={roofRef.hajebichi}
value={currentRoof?.hajebichi||0}
value={currentRoof?.hajebichi || '0'}
onChange={(value) => {
setCurrentRoof({ ...currentRoof, value })
const hajebichi = value === '' ? '' : Number(value);
setCurrentRoof(prev => ({
...prev,
hajebichi
}));
}}
readOnly={currentRoof?.roofPchAuth === 'R'}
disabled={currentRoof?.roofSizeSet === '3'}

View File

@ -42,6 +42,7 @@ import { useEvent } from '@/hooks/useEvent'
import { logger } from '@/util/logger'
import { useText } from '@/hooks/useText'
import { usePolygon } from '@/hooks/usePolygon'
import { getDegreeByChon } from '@/util/canvas-util'
const defaultDotLineGridSetting = {
INTERVAL: {
@ -177,8 +178,8 @@ export function useCanvasSetting(executeEffect = true) {
raft: item.raftBase && parseInt(item.raftBase),
layout: ['ROOF_ID_SLATE', 'ROOF_ID_SINGLE'].includes(item.roofMatlCd) ? ROOF_MATERIAL_LAYOUT.STAIRS : ROOF_MATERIAL_LAYOUT.PARALLEL,
hajebichi: item.roofPchBase && parseInt(item.roofPchBase),
pitch: item.pitch ? parseInt(item.pitch) : 4,
angle: item.angle ? parseInt(item.angle) : 21.8,
pitch: item.inclBase ? parseInt(item.inclBase) : 4,
angle: getDegreeByChon(item.inclBase ? parseInt(item.inclBase): 4) //item.angle ? parseInt(item.angle) : 21.8,
}))
setRoofMaterials(roofLists)
return roofLists

View File

@ -114,15 +114,16 @@ export function useRoofAllocationSetting(id) {
*/
const fetchBasicSettings = async (planNo) => {
try {
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}/${planNo}` }).then((res) => {
let roofsArray = {}
const response = await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}/${planNo}` });
if (res.length > 0) {
roofsArray = res.map((item) => {
return {
let roofsArray = [];
// API에서 데이터를 성공적으로 가져온 경우
if (response && response.length > 0) {
roofsArray = response.map((item, index) => ({
planNo: item.planNo,
roofApply: item.roofApply,
roofSeq: item.roofSeq,
roofSeq: item.roofSeq || index,
roofMatlCd: item.roofMatlCd,
roofWidth: item.roofWidth,
roofHeight: item.roofHeight,
@ -131,12 +132,19 @@ export function useRoofAllocationSetting(id) {
roofLayout: item.roofLayout,
roofPitch: item.roofPitch,
roofAngle: item.roofAngle,
selected: index === 0, // 첫 번째 항목을 기본 선택으로 설정
index: index
}));
}
})
} else {
if (roofList.length > 0) {
roofsArray = roofList
} else {
// API에서 데이터가 없고 기존 roofList가 있는 경우
else if (roofList && roofList.length > 0) {
roofsArray = roofList.map((roof, index) => ({
...roof,
selected: index === 0 // 첫 번째 항목을 기본 선택으로 설정
}));
}
// 둘 다 없는 경우 기본값 설정
else {
roofsArray = [
{
planNo: planNo,
@ -153,7 +161,7 @@ export function useRoofAllocationSetting(id) {
},
]
}
}
/**
* 데이터 설정
@ -205,7 +213,7 @@ export function useRoofAllocationSetting(id) {
angle: roof.angle ?? '',
}))
setCurrentRoofList(normalizedRoofs)
})
} catch (error) {
console.error('Data fetching error:', error)
}