dev-tmp1
tangjie 2026-08-10 14:34:25 +08:00
parent 9ba2ae51fc
commit a7fe1e31e4
2 changed files with 40 additions and 21 deletions

View File

@ -3,7 +3,6 @@ import { Button, Image, Input, Modal, Select, Table, Tabs, Tag } from "antd";
import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace"; import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import StaffViewModal from "~/components/StaffViewModal"; import StaffViewModal from "~/components/StaffViewModal";
import FilePreviewModal from "~/components/FilePreviewModal";
import PreviewUrlButton from "~/components/PreviewUrlButton/index"; import PreviewUrlButton from "~/components/PreviewUrlButton/index";
import { QUALIFICATION_INDUSTRY_OPTIONS, QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions"; import { QUALIFICATION_INDUSTRY_OPTIONS, QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
import { CAPABILITY_MAP } from "~/enumerate/constant"; import { CAPABILITY_MAP } from "~/enumerate/constant";
@ -128,7 +127,7 @@ const FilingTabs = ({
}) => { }) => {
const [viewId, setViewId] = useState(""); const [viewId, setViewId] = useState("");
const [equipRecord, setEquipRecord] = useState(null); const [equipRecord, setEquipRecord] = useState(null);
const [previewFile, setPreviewFile] = useState(null); const [previewImage, setPreviewImage] = useState("");
const personnelRows = useMemo( const personnelRows = useMemo(
() => () =>
@ -174,7 +173,15 @@ const FilingTabs = ({
})); }));
}, [detail.businessScope]); }, [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) => [ const basePersonCols = (withScope) => [
@ -526,12 +533,13 @@ const FilingTabs = ({
<EquipViewModal record={equipRecord} onCancel={() => setEquipRecord(null)} /> <EquipViewModal record={equipRecord} onCancel={() => setEquipRecord(null)} />
<FilePreviewModal <Image
open={!!previewFile} src={previewImage}
title="文件预览" preview={{
fileName={previewFile?.name} visible: !!previewImage,
url={previewFile?.url} onVisibleChange: (v) => !v && setPreviewImage(""),
onCancel={() => setPreviewFile(null)} }}
style={{ display: "none" }}
/> />
</> </>
); );

View File

@ -1,5 +1,6 @@
import { import {
Button, Button,
Image,
Input, Input,
Spin, Spin,
Table, Table,
@ -15,7 +16,6 @@ import {
fetchRegisteredOrgQualificationGroups, fetchRegisteredOrgQualificationGroups,
} from "~/utils/regulatorOrgInfo"; } from "~/utils/regulatorOrgInfo";
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions"; import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
import FilePreviewModal from "~/components/FilePreviewModal";
import StaffViewModal from "~/components/StaffViewModal"; import StaffViewModal from "~/components/StaffViewModal";
const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list"; const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list";
@ -129,10 +129,20 @@ function RegisteredOrgDetailPage(props) {
const [info, setInfo] = useState({}); const [info, setInfo] = useState({});
const [personnel, setPersonnel] = useState([]); const [personnel, setPersonnel] = useState([]);
const [materials, setMaterials] = useState([]); const [materials, setMaterials] = useState([]);
const [previewFile, setPreviewFile] = useState(null); const [previewImage, setPreviewImage] = useState("");
const [viewPersonnelId, setViewPersonnelId] = useState(""); const [viewPersonnelId, setViewPersonnelId] = useState("");
const mockEnabled = getOrgMockEnabled(); 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(() => { useEffect(() => {
if (!id) { if (!id) {
setOrgLoading(false); setOrgLoading(false);
@ -320,7 +330,7 @@ function RegisteredOrgDetailPage(props) {
size="small" size="small"
onClick={() => { onClick={() => {
const first = (info.attachmentUrl || [])[0]; const first = (info.attachmentUrl || [])[0];
setPreviewFile({ openPreview({
name: first.name || "营业执照", name: first.name || "营业执照",
url: first.url || (typeof first === "string" ? first : ""), url: first.url || (typeof first === "string" ? first : ""),
}); });
@ -456,7 +466,7 @@ function RegisteredOrgDetailPage(props) {
title: "操作", title: "操作",
width: 80, width: 80,
render: (_, record) => ( render: (_, record) => (
<Button type="link" size="small" onClick={() => setPreviewFile(record)}> <Button type="link" size="small" onClick={() => openPreview(record)}>
预览 预览
</Button> </Button>
), ),
@ -520,7 +530,7 @@ function RegisteredOrgDetailPage(props) {
<label style={labelStyle}>签字文件</label> <label style={labelStyle}>签字文件</label>
<div> <div>
{commitment.legalRepSignatureUrl ? ( {commitment.legalRepSignatureUrl ? (
<Button size="small" onClick={() => setPreviewFile({ name: "机构负责人签字件", url: commitment.legalRepSignatureUrl })}> <Button size="small" onClick={() => openPreview({ name: "机构负责人签字件", url: commitment.legalRepSignatureUrl })}>
查看签字件 查看签字件
</Button> </Button>
) : ( ) : (
@ -557,7 +567,7 @@ function RegisteredOrgDetailPage(props) {
title: "操作", title: "操作",
width: 110, width: 110,
render: (_, record) => ( 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> </Button>
), ),
@ -591,12 +601,13 @@ function RegisteredOrgDetailPage(props) {
/> />
)} )}
<FilePreviewModal <Image
open={!!previewFile} src={previewImage}
title="文件预览" preview={{
fileName={previewFile?.name} visible: !!previewImage,
url={previewFile?.url} onVisibleChange: (v) => !v && setPreviewImage(""),
onCancel={() => setPreviewFile(null)} }}
style={{ display: "none" }}
/> />
</PageLayout> </PageLayout>
); );