| | |
| | | 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], { |
| | | // 创建Blob对象(PDF格式) |
| | | const blob = new Blob([response.data], { |
| | | type: 'application/pdf' |
| | | }); |
| | | |
| | |
| | | window.URL.revokeObjectURL(url); |
| | | |
| | | message.success('协议下载成功!'); |
| | | } else { |
| | | message.error('未获取到协议内容'); |
| | | } |
| | | } catch (err) { |
| | | console.error('下载协议失败:', err); |
| | | message.error('下载协议失败,请稍后重试'); |