diff --git a/src/pages/Container/Supervision/EvalReportDatabase/components/SpotCheckDetailModal.jsx b/src/pages/Container/Supervision/EvalReportDatabase/components/SpotCheckDetailModal.jsx index 9cfd412..9b1fdbb 100644 --- a/src/pages/Container/Supervision/EvalReportDatabase/components/SpotCheckDetailModal.jsx +++ b/src/pages/Container/Supervision/EvalReportDatabase/components/SpotCheckDetailModal.jsx @@ -1,5 +1,6 @@ -import { Button, Modal, Space, message } from "antd"; +import { Button, Modal, Space } from "antd"; import dayjs from "dayjs"; +import PreviewUrlButton from "~/components/PreviewUrlButton"; /** 原型 .reg-modal-section */ const ModalSection = ({ title, desc, children }) => ( @@ -74,18 +75,6 @@ const downloadFileByUrl = async (fileUrl, fileName) => { const SpotCheckDetailModal = ({ open, record, onCancel }) => { const detailData = record || {}; - const handleFileDownload = (fileUrl, fileName) => { - if (!fileUrl) { - message.warning("文件地址不存在"); - return; - } - const hide = message.loading("正在下载...", 0); - downloadFileByUrl(fileUrl, fileName) - .then(() => message.success("下载已开始")) - .catch(() => message.error("下载失败,请稍后重试")) - .finally(() => hide()); - }; - return ( { headers={["文件名称", "文件类型", "版本"]} rows={[ [ - - handleFileDownload( - detailData.fileUrl, - detailData.fileName || - detailData.reportName || - "正式安全评价报告.pdf", - ) - } - > + {detailData.fileName || detailData.reportName || "正式安全评价报告.pdf"} - , + , getFileExtLabel(detailData.fileName), "V1.0", ], @@ -159,15 +138,9 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => { [ - - handleFileDownload(f.url, f.name || "未命名文件") - } - > + {f.name || "未命名文件"} - , + , getFileExtLabel(f.name || f.url), ])} /> @@ -176,15 +149,9 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => { [ - - handleFileDownload(f.url, f.name || "未命名文件") - } - > + {f.name || "未命名文件"} - , + , getFileExtLabel(f.name || f.url), ])} />