import { Button, Image, Space, Table, Tag, Upload } from "antd"; import { useState } from "react"; export default function MaterialStep({ materials = [], disabled, onUpload, loading, }) { const [previewImage, setPreviewImage] = useState(""); const isImage = (url) => /\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(url || ""); return ( <> (val ? {val} : "-"), }, { title: "状态", dataIndex: "uploadStatusName", width: 90, render: (val, record) => ( {val || "待上传"} ), }, { title: "操作", width: 120, render: (_, record) => ( {record.attachmentUrl ? ( ) : ( !disabled && ( { if (info.file.status === "done") { const url = info.file.response?.data?.url; if (url) { onUpload?.(record, url); } } }} > ) )} ), }, { title: "注释", dataIndex: "materialRemark", ellipsis: true }, ]} /> { if (!visible) setPreviewImage(""); }, }} /> ); }