fix
parent
164622b05b
commit
5e55b0b63a
|
|
@ -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 (
|
||||
<Modal
|
||||
title={`查看安全评价报告 - ${detailData.reportNo || ""}`}
|
||||
|
|
@ -134,21 +123,11 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
|||
headers={["文件名称", "文件类型", "版本"]}
|
||||
rows={[
|
||||
[
|
||||
<span
|
||||
style={{ color: "#1677ff", cursor: "pointer" }}
|
||||
onClick={() =>
|
||||
handleFileDownload(
|
||||
detailData.fileUrl,
|
||||
detailData.fileName ||
|
||||
detailData.reportName ||
|
||||
"正式安全评价报告.pdf",
|
||||
)
|
||||
}
|
||||
>
|
||||
<PreviewUrlButton url={detailData.fileUrl}>
|
||||
{detailData.fileName ||
|
||||
detailData.reportName ||
|
||||
"正式安全评价报告.pdf"}
|
||||
</span>,
|
||||
</PreviewUrlButton>,
|
||||
getFileExtLabel(detailData.fileName),
|
||||
"V1.0",
|
||||
],
|
||||
|
|
@ -159,15 +138,9 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
|||
<ProtoTable
|
||||
headers={["文件名称", "文件类型"]}
|
||||
rows={parseFileList(detailData.contractFileUrls).map((f) => [
|
||||
<span
|
||||
key={f.url}
|
||||
style={{ color: "#1677ff", cursor: "pointer" }}
|
||||
onClick={() =>
|
||||
handleFileDownload(f.url, f.name || "未命名文件")
|
||||
}
|
||||
>
|
||||
<PreviewUrlButton key={f.url} url={f.url}>
|
||||
{f.name || "未命名文件"}
|
||||
</span>,
|
||||
</PreviewUrlButton>,
|
||||
getFileExtLabel(f.name || f.url),
|
||||
])}
|
||||
/>
|
||||
|
|
@ -176,15 +149,9 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
|||
<ProtoTable
|
||||
headers={["文件名称", "文件类型"]}
|
||||
rows={parseFileList(detailData.processDocUrls).map((f) => [
|
||||
<span
|
||||
key={f.url}
|
||||
style={{ color: "#1677ff", cursor: "pointer" }}
|
||||
onClick={() =>
|
||||
handleFileDownload(f.url, f.name || "未命名文件")
|
||||
}
|
||||
>
|
||||
<PreviewUrlButton key={f.url} url={f.url}>
|
||||
{f.name || "未命名文件"}
|
||||
</span>,
|
||||
</PreviewUrlButton>,
|
||||
getFileExtLabel(f.name || f.url),
|
||||
])}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue