diff options
| author | joonhoekim <26rote@gmail.com> | 2025-10-20 11:21:10 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-10-20 11:21:10 +0900 |
| commit | b68d81f5a87e3278a02b915c2fc6ce0e62144865 (patch) | |
| tree | deb1a2ce6e804e4c452965adf184fe6f10a765ae /lib/rfq-last | |
| parent | 89fa000062650474915d5156fd21c6a85a06608b (diff) | |
(김준회) pos 파일 다운로드 경로문제 해결
Diffstat (limited to 'lib/rfq-last')
| -rw-r--r-- | lib/rfq-last/table/rfq-attachments-dialog.tsx | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/lib/rfq-last/table/rfq-attachments-dialog.tsx b/lib/rfq-last/table/rfq-attachments-dialog.tsx index 161e446a..103617b3 100644 --- a/lib/rfq-last/table/rfq-attachments-dialog.tsx +++ b/lib/rfq-last/table/rfq-attachments-dialog.tsx @@ -94,24 +94,38 @@ export function RfqAttachmentsDialog({ isOpen, onClose, rfqData }: RfqAttachment setDownloadingFiles(prev => new Set([...prev, attachmentId])) try { - const result = await downloadFile( - attachment.filePath, - attachment.originalFileName, - { - action: 'download', - showToast: true, - showSuccessToast: true, - onSuccess: (fileName, fileSize) => { - console.log(`다운로드 완료: ${fileName} (${formatFileSize(fileSize || 0)})`) - }, - onError: (error) => { - console.error(`다운로드 실패: ${error}`) + // POS 파일(설계 문서)은 별도 API 사용 + if (attachment.attachmentType === '설계') { + const downloadUrl = `/api/pos/download?revisionId=${attachment.attachmentId}` + const link = document.createElement('a') + link.href = downloadUrl + link.download = attachment.originalFileName + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + + toast.success(`${attachment.originalFileName} 다운로드가 시작되었습니다.`) + } else { + // 일반 파일은 기존 downloadFile 함수 사용 + const result = await downloadFile( + attachment.filePath, + attachment.originalFileName, + { + action: 'download', + showToast: true, + showSuccessToast: true, + onSuccess: (fileName, fileSize) => { + console.log(`다운로드 완료: ${fileName} (${formatFileSize(fileSize || 0)})`) + }, + onError: (error) => { + console.error(`다운로드 실패: ${error}`) + } } - } - ) + ) - if (!result.success) { - console.error("다운로드 결과:", result) + if (!result.success) { + console.error("다운로드 결과:", result) + } } } catch (error) { console.error("파일 다운로드 오류:", error) @@ -128,15 +142,19 @@ export function RfqAttachmentsDialog({ isOpen, onClose, rfqData }: RfqAttachment // 파일 미리보기 핸들러 const handlePreview = async (attachment: RfqAttachment) => { const fileInfo = getFileInfo(attachment.originalFileName) - - if (!fileInfo.canPreview) { - toast.info("이 파일 형식은 미리보기를 지원하지 않습니다. 다운로드를 진행합니다.") + + // POS 파일(설계 문서)은 미리보기를 지원하지 않음 + if (attachment.attachmentType === '설계' || !fileInfo.canPreview) { + const message = attachment.attachmentType === '설계' + ? "POS 파일은 미리보기를 지원하지 않습니다. 다운로드를 진행합니다." + : "이 파일 형식은 미리보기를 지원하지 않습니다. 다운로드를 진행합니다." + toast.info(message) return handleDownload(attachment) } try { const result = await quickPreview(attachment.filePath, attachment.originalFileName) - + if (!result.success) { console.error("미리보기 결과:", result) } @@ -150,7 +168,12 @@ export function RfqAttachmentsDialog({ isOpen, onClose, rfqData }: RfqAttachment const handleSmartAction = async (attachment: RfqAttachment) => { const attachmentId = attachment.attachmentId const fileInfo = getFileInfo(attachment.originalFileName) - + + // POS 파일(설계 문서)은 미리보기를 지원하지 않으므로 바로 다운로드 + if (attachment.attachmentType === '설계') { + return handleDownload(attachment) + } + if (fileInfo.canPreview) { return handlePreview(attachment) } else { |
