From 7440c3d98094637ab3cb5842c02b97162952db12 Mon Sep 17 00:00:00 2001 From: Vectorune Date: Sun, 9 Nov 2025 16:01:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0Word=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataPrint/RecordCard/CardAction.js | 35 ++++++++++++++++++- .../DataPrint/RecordCard/PrintRecordCard.jsx | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/page/Dashboard/DataPrint/RecordCard/CardAction.js b/src/page/Dashboard/DataPrint/RecordCard/CardAction.js index 4e98c76..0edca3f 100644 --- a/src/page/Dashboard/DataPrint/RecordCard/CardAction.js +++ b/src/page/Dashboard/DataPrint/RecordCard/CardAction.js @@ -31,6 +31,29 @@ const CardAction = (record, messageApi, navigator) => { }); } + const downloadWordRecord = (recordId) => { + let baseUrl = baseWebConfig.baseUrl + commonAxios.get(`${baseUrl}/api/v1/workload/certificate/downloadWord/${recordId}`, {responseType: 'blob'}).then((response) => { + if (response.data.type === 'application/json') { + messageApi.error('证明已失效 (GENERATE_CERTIFICATE_ERROR_007)'); + setTimeout(() => { + window.location.reload(); + }, 1000); + } else { + let fileName = `certificate-${recordId}.docx`; + const blob = new Blob([response.data], {type: 'application/octet-stream'}); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = fileName; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } + + }); + } const reGenerateRecord = (record) => { if (record.status === '01' || record.status === '02') { @@ -83,7 +106,17 @@ const CardAction = (record, messageApi, navigator) => { > ] : []), - ...(record.status === '02' ? [ downloadRecord(record.id)}/>] : []), + ...(record.status === '02' ? [ + downloadRecord(record.id)} style={{ marginRight: 16, cursor: 'pointer' }}> + + 下载PDF + , + //downloadWordRecord + downloadWordRecord(record.id)} style={{ cursor: 'pointer' }}> + + 下载Word + + ] : []), ...(record.status === '03' || record.status === '04' ? [