fix
parent
9ba2ae51fc
commit
a7fe1e31e4
|
|
@ -3,7 +3,6 @@ import { Button, Image, Input, Modal, Select, Table, Tabs, Tag } from "antd";
|
|||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
|
||||
import StaffViewModal from "~/components/StaffViewModal";
|
||||
import FilePreviewModal from "~/components/FilePreviewModal";
|
||||
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
|
||||
import { QUALIFICATION_INDUSTRY_OPTIONS, QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
|
||||
import { CAPABILITY_MAP } from "~/enumerate/constant";
|
||||
|
|
@ -128,7 +127,7 @@ const FilingTabs = ({
|
|||
}) => {
|
||||
const [viewId, setViewId] = useState("");
|
||||
const [equipRecord, setEquipRecord] = useState(null);
|
||||
const [previewFile, setPreviewFile] = useState(null);
|
||||
const [previewImage, setPreviewImage] = useState("");
|
||||
|
||||
const personnelRows = useMemo(
|
||||
() =>
|
||||
|
|
@ -174,7 +173,15 @@ const FilingTabs = ({
|
|||
}));
|
||||
}, [detail.businessScope]);
|
||||
|
||||
const openPreview = (file) => setPreviewFile(file || null);
|
||||
const openPreview = (file) => {
|
||||
const url = file?.url;
|
||||
if (!url) return;
|
||||
if (/\.(jpe?g|png|gif|webp|bmp)(\?|#|$)/i.test(`${file.name || ""} ${url}`.toLowerCase())) {
|
||||
setPreviewImage(url);
|
||||
} else {
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
/** 人员表格列(管理/评价师共用基础) */
|
||||
const basePersonCols = (withScope) => [
|
||||
|
|
@ -526,12 +533,13 @@ const FilingTabs = ({
|
|||
|
||||
<EquipViewModal record={equipRecord} onCancel={() => setEquipRecord(null)} />
|
||||
|
||||
<FilePreviewModal
|
||||
open={!!previewFile}
|
||||
title="文件预览"
|
||||
fileName={previewFile?.name}
|
||||
url={previewFile?.url}
|
||||
onCancel={() => setPreviewFile(null)}
|
||||
<Image
|
||||
src={previewImage}
|
||||
preview={{
|
||||
visible: !!previewImage,
|
||||
onVisibleChange: (v) => !v && setPreviewImage(""),
|
||||
}}
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
Button,
|
||||
Image,
|
||||
Input,
|
||||
Spin,
|
||||
Table,
|
||||
|
|
@ -15,7 +16,6 @@ import {
|
|||
fetchRegisteredOrgQualificationGroups,
|
||||
} from "~/utils/regulatorOrgInfo";
|
||||
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
|
||||
import FilePreviewModal from "~/components/FilePreviewModal";
|
||||
import StaffViewModal from "~/components/StaffViewModal";
|
||||
|
||||
const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list";
|
||||
|
|
@ -129,10 +129,20 @@ function RegisteredOrgDetailPage(props) {
|
|||
const [info, setInfo] = useState({});
|
||||
const [personnel, setPersonnel] = useState([]);
|
||||
const [materials, setMaterials] = useState([]);
|
||||
const [previewFile, setPreviewFile] = useState(null);
|
||||
const [previewImage, setPreviewImage] = useState("");
|
||||
const [viewPersonnelId, setViewPersonnelId] = useState("");
|
||||
const mockEnabled = getOrgMockEnabled();
|
||||
|
||||
const openPreview = (file) => {
|
||||
const url = file?.url;
|
||||
if (!url) return;
|
||||
if (/\.(jpe?g|png|gif|webp|bmp)(\?|#|$)/i.test(`${file.name || ""} ${url}`.toLowerCase())) {
|
||||
setPreviewImage(url);
|
||||
} else {
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) {
|
||||
setOrgLoading(false);
|
||||
|
|
@ -320,7 +330,7 @@ function RegisteredOrgDetailPage(props) {
|
|||
size="small"
|
||||
onClick={() => {
|
||||
const first = (info.attachmentUrl || [])[0];
|
||||
setPreviewFile({
|
||||
openPreview({
|
||||
name: first.name || "营业执照",
|
||||
url: first.url || (typeof first === "string" ? first : ""),
|
||||
});
|
||||
|
|
@ -456,7 +466,7 @@ function RegisteredOrgDetailPage(props) {
|
|||
title: "操作",
|
||||
width: 80,
|
||||
render: (_, record) => (
|
||||
<Button type="link" size="small" onClick={() => setPreviewFile(record)}>
|
||||
<Button type="link" size="small" onClick={() => openPreview(record)}>
|
||||
预览
|
||||
</Button>
|
||||
),
|
||||
|
|
@ -520,7 +530,7 @@ function RegisteredOrgDetailPage(props) {
|
|||
<label style={labelStyle}>签字文件</label>
|
||||
<div>
|
||||
{commitment.legalRepSignatureUrl ? (
|
||||
<Button size="small" onClick={() => setPreviewFile({ name: "机构负责人签字件", url: commitment.legalRepSignatureUrl })}>
|
||||
<Button size="small" onClick={() => openPreview({ name: "机构负责人签字件", url: commitment.legalRepSignatureUrl })}>
|
||||
查看签字件
|
||||
</Button>
|
||||
) : (
|
||||
|
|
@ -557,7 +567,7 @@ function RegisteredOrgDetailPage(props) {
|
|||
title: "操作",
|
||||
width: 110,
|
||||
render: (_, record) => (
|
||||
<Button type="link" size="small" onClick={() => setPreviewFile({ name: "提交件", url: record.url })}>
|
||||
<Button type="link" size="small" onClick={() => openPreview({ name: "提交件", url: record.url })}>
|
||||
查看提交件
|
||||
</Button>
|
||||
),
|
||||
|
|
@ -591,12 +601,13 @@ function RegisteredOrgDetailPage(props) {
|
|||
/>
|
||||
)}
|
||||
|
||||
<FilePreviewModal
|
||||
open={!!previewFile}
|
||||
title="文件预览"
|
||||
fileName={previewFile?.name}
|
||||
url={previewFile?.url}
|
||||
onCancel={() => setPreviewFile(null)}
|
||||
<Image
|
||||
src={previewImage}
|
||||
preview={{
|
||||
visible: !!previewImage,
|
||||
onVisibleChange: (v) => !v && setPreviewImage(""),
|
||||
}}
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
</PageLayout>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue