diff options
Diffstat (limited to 'lib/rfq-last/vendor-response/editor/attachments-upload.tsx')
| -rw-r--r-- | lib/rfq-last/vendor-response/editor/attachments-upload.tsx | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/lib/rfq-last/vendor-response/editor/attachments-upload.tsx b/lib/rfq-last/vendor-response/editor/attachments-upload.tsx index ea7bb9c9..b85407ff 100644 --- a/lib/rfq-last/vendor-response/editor/attachments-upload.tsx +++ b/lib/rfq-last/vendor-response/editor/attachments-upload.tsx @@ -97,10 +97,10 @@ export default function AttachmentsUpload({ // 파일 추가 const handleFileAdd = (files: FileList | null, type: "구매" | "설계") => { if (!files) return - + const newFiles: FileWithType[] = [] const errors: string[] = [] - + Array.from(files).forEach(file => { const error = validateFile(file) if (error) { @@ -110,17 +110,31 @@ export default function AttachmentsUpload({ attachmentType: type, description: "" }) + // 디버그 로그 추가 + console.log(`파일 추가됨: ${file.name}, 타입: ${type}`) newFiles.push(fileWithType) } }) - + if (errors.length > 0) { setUploadErrors(errors) setTimeout(() => setUploadErrors([]), 5000) } - + if (newFiles.length > 0) { - onAttachmentsChange([...attachments, ...newFiles]) + const updatedFiles = [...attachments, ...newFiles] + onAttachmentsChange(updatedFiles) + + // 추가된 파일들의 타입 확인 로그 + console.log('업데이트된 파일 목록:', updatedFiles.map(f => ({ + name: f.name, + attachmentType: f.attachmentType + }))) + + // 각 파일의 타입이 제대로 설정되었는지 검증 + newFiles.forEach(file => { + console.log(`새 파일 타입 검증: ${file.name} = ${file.attachmentType}`) + }) } } @@ -175,7 +189,15 @@ export default function AttachmentsUpload({ // 파일 타입 변경 const handleTypeChange = (index: number, newType: "구매" | "설계") => { const newFiles = [...attachments] + const oldType = newFiles[index].attachmentType newFiles[index].attachmentType = newType + + console.log(`파일 타입 변경: ${newFiles[index].name} (${oldType} -> ${newType})`) + console.log('변경 후 파일 목록:', newFiles.map(f => ({ + name: f.name, + attachmentType: f.attachmentType + }))) + onAttachmentsChange(newFiles) } |
