From 9167ea7dca015c7ff1f35fa7eb63161fe10eac7b Mon Sep 17 00:00:00 2001
From: tony.cheng <chengmingwei_1984122@126.com>
Date: Wed, 04 Mar 2026 12:09:24 +0800
Subject: [PATCH] fix: 修正下载协议功能,正确处理PDF文件流

---
 web-app/src/components/dashboard/TabContainer.jsx |   48 +++++++++++++++++++++---------------------------
 1 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/web-app/src/components/dashboard/TabContainer.jsx b/web-app/src/components/dashboard/TabContainer.jsx
index eab6b9b..ed02399 100644
--- a/web-app/src/components/dashboard/TabContainer.jsx
+++ b/web-app/src/components/dashboard/TabContainer.jsx
@@ -1394,35 +1394,29 @@
     if (!caseId) return;
     setActionLoading(prev => ({ ...prev, download: true }));
     try {
-      // 调用API获取协议内容
+      // 调用API获取PDF文件流
       const response = await MediationAgreementAPIService.downloadAgreement(caseId);
       
-      if (response?.data?.agreeContent) {
-        const agreementContent = response.data.agreeContent;
-        
-        // 创建Blob对象
-        const blob = new Blob([agreementContent], { 
-          type: 'application/pdf' 
-        });
-        
-        // 创建下载链接
-        const url = window.URL.createObjectURL(blob);
-        const link = document.createElement('a');
-        link.href = url;
-        link.download = `调解协议_${caseId}.pdf`;
-        
-        // 触发下载
-        document.body.appendChild(link);
-        link.click();
-        document.body.removeChild(link);
-        
-        // 清理URL对象
-        window.URL.revokeObjectURL(url);
-        
-        message.success('协议下载成功!');
-      } else {
-        message.error('未获取到协议内容');
-      }
+      // 创建Blob对象(PDF格式)
+      const blob = new Blob([response.data], { 
+        type: 'application/pdf' 
+      });
+      
+      // 创建下载链接
+      const url = window.URL.createObjectURL(blob);
+      const link = document.createElement('a');
+      link.href = url;
+      link.download = `调解协议_${caseId}.pdf`;
+      
+      // 触发下载
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+      
+      // 清理URL对象
+      window.URL.revokeObjectURL(url);
+      
+      message.success('协议下载成功!');
     } catch (err) {
       console.error('下载协议失败:', err);
       message.error('下载协议失败,请稍后重试');

--
Gitblit v1.8.0