diff --git a/src/components/ViewProjectReviewDetailsModal/index.js b/src/components/ViewProjectReviewDetailsModal/index.js new file mode 100644 index 0000000..d63fcaf --- /dev/null +++ b/src/components/ViewProjectReviewDetailsModal/index.js @@ -0,0 +1,80 @@ +import { Button, Descriptions, Modal } from "antd"; +import { useEffect } from "react"; +import PreviewImg from "zy-react-library/components/PreviewImg"; +import PreviewPdf from "zy-react-library/components/PreviewPdf"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import { getFileSuffix } from "zy-react-library/utils"; + +const ViewProjectReviewDetailsModal = (props) => { + const { getFile } = useGetFile(); + const getData = async () => { + const file = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["151"], + eqForeignKey: props.data.projectFileId, + }); + props.data.files = file; + }; + const previewFile = () => { + const imgFiles = []; + const pdfFiles = []; + const files = props.data?.files || []; + for (let i = 0; i < files.length; i++) { + if (getFileSuffix(files[i].name) === "pdf") { + pdfFiles.push(files[i]); + } + else { + imgFiles.push(files[i]); + } + } + if (imgFiles.length > 0 && pdfFiles.length > 0) { + return ( + <> +
+
+ + ); + } + if (imgFiles.length > 0) { + return ; + } + if (pdfFiles.length > 0) { + return ; + } + }; + useEffect(() => { + getData(); + }, []); + return ( + 取消, + ]} + > + { + const start = props.data?.startValidityPeriod; + const end = props.data?.endValidityPeriod; + return start && end ? `${start}至${end}` : "-"; + })(), + }, + { label: "资质", children: previewFile() }, + ]} + /> + + ); +}; + +export default ViewProjectReviewDetailsModal;