feat: 품목관리 파일 업로드 기능 개선

- 파일 업로드 API에 field_key, file_id 파라미터 추가
- ItemMaster 타입에 files 필드 추가 (새 API 구조 지원)
- DynamicItemForm에서 files 객체 파싱 로직 추가
- 시방서/인정서 파일 UI 개선: 파일명 표시 + 다운로드/수정/삭제 버튼
- 기존 API 구조와 새 API 구조 모두 지원 (폴백 처리)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
byeongcheolryu
2025-12-12 18:35:43 +09:00
parent ded0bc2439
commit c026130a65
19 changed files with 772 additions and 331 deletions

View File

@@ -22,6 +22,8 @@ export interface BendingDiagramSectionProps {
bendingDetails: BendingDetail[];
setBendingDetails: (details: BendingDetail[]) => void;
setWidthSum: (sum: string) => void;
/** 동적 폼에서 폭 합계 필드의 키 (예: 'width_sum', 'field_123') */
widthSumFieldKey?: string;
setValue: UseFormSetValue<CreateItemFormData>;
isSubmitting: boolean;
}
@@ -37,6 +39,7 @@ export default function BendingDiagramSection({
bendingDetails,
setBendingDetails,
setWidthSum,
widthSumFieldKey,
setValue,
isSubmitting,
}: BendingDiagramSectionProps) {
@@ -46,8 +49,16 @@ export default function BendingDiagramSection({
const calc = d.input + d.elongation;
return acc + calc;
}, 0);
setWidthSum(totalSum.toString());
setValue('length', totalSum.toString());
const sumString = totalSum.toString();
setWidthSum(sumString);
// 동적 폼 필드에 값 설정 (widthSumFieldKey가 있으면 해당 키로, 없으면 'length'로 폴백)
if (widthSumFieldKey) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setValue(widthSumFieldKey as any, sumString);
} else {
setValue('length', sumString);
}
};
return (