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 dayjs from "dayjs";
|
||||||
|
import PreviewUrlButton from "~/components/PreviewUrlButton";
|
||||||
|
|
||||||
/** 原型 .reg-modal-section */
|
/** 原型 .reg-modal-section */
|
||||||
const ModalSection = ({ title, desc, children }) => (
|
const ModalSection = ({ title, desc, children }) => (
|
||||||
|
|
@ -74,18 +75,6 @@ const downloadFileByUrl = async (fileUrl, fileName) => {
|
||||||
const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
||||||
const detailData = record || {};
|
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 (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={`查看安全评价报告 - ${detailData.reportNo || ""}`}
|
title={`查看安全评价报告 - ${detailData.reportNo || ""}`}
|
||||||
|
|
@ -134,21 +123,11 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
||||||
headers={["文件名称", "文件类型", "版本"]}
|
headers={["文件名称", "文件类型", "版本"]}
|
||||||
rows={[
|
rows={[
|
||||||
[
|
[
|
||||||
<span
|
<PreviewUrlButton url={detailData.fileUrl}>
|
||||||
style={{ color: "#1677ff", cursor: "pointer" }}
|
|
||||||
onClick={() =>
|
|
||||||
handleFileDownload(
|
|
||||||
detailData.fileUrl,
|
|
||||||
detailData.fileName ||
|
|
||||||
detailData.reportName ||
|
|
||||||
"正式安全评价报告.pdf",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{detailData.fileName ||
|
{detailData.fileName ||
|
||||||
detailData.reportName ||
|
detailData.reportName ||
|
||||||
"正式安全评价报告.pdf"}
|
"正式安全评价报告.pdf"}
|
||||||
</span>,
|
</PreviewUrlButton>,
|
||||||
getFileExtLabel(detailData.fileName),
|
getFileExtLabel(detailData.fileName),
|
||||||
"V1.0",
|
"V1.0",
|
||||||
],
|
],
|
||||||
|
|
@ -159,15 +138,9 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
||||||
<ProtoTable
|
<ProtoTable
|
||||||
headers={["文件名称", "文件类型"]}
|
headers={["文件名称", "文件类型"]}
|
||||||
rows={parseFileList(detailData.contractFileUrls).map((f) => [
|
rows={parseFileList(detailData.contractFileUrls).map((f) => [
|
||||||
<span
|
<PreviewUrlButton key={f.url} url={f.url}>
|
||||||
key={f.url}
|
|
||||||
style={{ color: "#1677ff", cursor: "pointer" }}
|
|
||||||
onClick={() =>
|
|
||||||
handleFileDownload(f.url, f.name || "未命名文件")
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{f.name || "未命名文件"}
|
{f.name || "未命名文件"}
|
||||||
</span>,
|
</PreviewUrlButton>,
|
||||||
getFileExtLabel(f.name || f.url),
|
getFileExtLabel(f.name || f.url),
|
||||||
])}
|
])}
|
||||||
/>
|
/>
|
||||||
|
|
@ -176,15 +149,9 @@ const SpotCheckDetailModal = ({ open, record, onCancel }) => {
|
||||||
<ProtoTable
|
<ProtoTable
|
||||||
headers={["文件名称", "文件类型"]}
|
headers={["文件名称", "文件类型"]}
|
||||||
rows={parseFileList(detailData.processDocUrls).map((f) => [
|
rows={parseFileList(detailData.processDocUrls).map((f) => [
|
||||||
<span
|
<PreviewUrlButton key={f.url} url={f.url}>
|
||||||
key={f.url}
|
|
||||||
style={{ color: "#1677ff", cursor: "pointer" }}
|
|
||||||
onClick={() =>
|
|
||||||
handleFileDownload(f.url, f.name || "未命名文件")
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{f.name || "未命名文件"}
|
{f.name || "未命名文件"}
|
||||||
</span>,
|
</PreviewUrlButton>,
|
||||||
getFileExtLabel(f.name || f.url),
|
getFileExtLabel(f.name || f.url),
|
||||||
])}
|
])}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue