야드 관리 수정 안되는 현상 해결

This commit is contained in:
dohyeons 2025-10-27 16:06:51 +09:00
parent d1e399b1c4
commit 640a9a741c
1 changed files with 11 additions and 1 deletions

View File

@ -65,7 +65,17 @@ export default function YardEditor({ layout, onBack }: YardEditorProps) {
setIsLoading(true); setIsLoading(true);
const response = await yardLayoutApi.getPlacementsByLayoutId(layout.id); const response = await yardLayoutApi.getPlacementsByLayoutId(layout.id);
if (response.success) { if (response.success) {
const loadedData = response.data as YardPlacement[]; const loadedData = (response.data as YardPlacement[]).map((p) => ({
...p,
// 문자열로 저장된 숫자 필드를 숫자로 변환
position_x: Number(p.position_x),
position_y: Number(p.position_y),
position_z: Number(p.position_z),
size_x: Number(p.size_x),
size_y: Number(p.size_y),
size_z: Number(p.size_z),
quantity: p.quantity !== null && p.quantity !== undefined ? Number(p.quantity) : null,
}));
setPlacements(loadedData); setPlacements(loadedData);
setOriginalPlacements(JSON.parse(JSON.stringify(loadedData))); // 깊은 복사 setOriginalPlacements(JSON.parse(JSON.stringify(loadedData))); // 깊은 복사
} }