dev-tmp1
tangjie 2026-08-26 14:07:27 +08:00
parent 273cb8d6ec
commit 26090399d3
3 changed files with 29 additions and 27 deletions

View File

@ -358,7 +358,7 @@ export const evalProjectArchivePage = declareRequest(
"Get > /safetyEval/institution/eval-project/archive-supervision-page", "Get > /safetyEval/institution/eval-project/archive-supervision-page",
); );
/** 项目档案文件列表(监管端,分页参数为 pageIndex/pageSize总数 totalCount */ /** 项目档案文件列表-监管端 */
export const evalProjectArchiveFilePage = declareRequest( export const evalProjectArchiveFilePage = declareRequest(
"evalProjectArchiveFileLoading", "evalProjectArchiveFileLoading",
"Get > /safetyEval/eval-project-archive-file/monitor/page", "Get > /safetyEval/eval-project-archive-file/monitor/page",

View File

@ -17,6 +17,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction"; import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
import { tools } from "@cqsjjb/jjb-common-lib"; import { tools } from "@cqsjjb/jjb-common-lib";
import { useDebounce } from "~/utils";
import LayoutFooterPortal from "~/components/LayoutFooterPortal"; import LayoutFooterPortal from "~/components/LayoutFooterPortal";
import PreviewUrlButton from "~/components/PreviewUrlButton"; import PreviewUrlButton from "~/components/PreviewUrlButton";
import ArchiveSupplementModal from "./ArchiveSupplementModal"; import ArchiveSupplementModal from "./ArchiveSupplementModal";
@ -77,9 +78,10 @@ const ArchiveContent = ({ readOnly, ...props }) => {
fetchArchiveFiles(); fetchArchiveFiles();
}, [projectId]); }, [projectId]);
/** 本地筛选:来源 + 文件名称/档案类型关键字 */ /** 本地筛选:来源 + 文件名称/档案类型关键字(防抖 400ms */
const debouncedKeyword = useDebounce(keyword, 400);
const filteredArchiveFiles = useMemo(() => { const filteredArchiveFiles = useMemo(() => {
const kw = keyword.trim().toLowerCase(); const kw = debouncedKeyword.trim().toLowerCase();
return archiveFiles.filter((item) => { return archiveFiles.filter((item) => {
const matchSource = !sourceFilter || item.recordSource === sourceFilter; const matchSource = !sourceFilter || item.recordSource === sourceFilter;
const matchKeyword = const matchKeyword =
@ -90,7 +92,7 @@ const ArchiveContent = ({ readOnly, ...props }) => {
(item.archiveType || "").toLowerCase().includes(kw); (item.archiveType || "").toLowerCase().includes(kw);
return matchSource && matchKeyword; return matchSource && matchKeyword;
}); });
}, [archiveFiles, sourceFilter, keyword]); }, [archiveFiles, sourceFilter, debouncedKeyword]);
const isSignatureCompleted = const isSignatureCompleted =
processControl?.reviewerSignatureTaskStatus === "completed"; processControl?.reviewerSignatureTaskStatus === "completed";

View File

@ -1,7 +1,8 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useMemo, useState } from "react";
import { Button, Flex, Input, Modal, Table, Tag, message } from "antd"; import { Button, Flex, Input, Modal, Table, Tag, message } from "antd";
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction"; import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
import PreviewUrlButton from "~/components/PreviewUrlButton"; import PreviewUrlButton from "~/components/PreviewUrlButton";
import { useDebounce } from "~/utils";
import { import {
NODE_LABELS, NODE_LABELS,
ARCHIVE_TYPE_MAP, ARCHIVE_TYPE_MAP,
@ -17,22 +18,30 @@ const resolveFileUrl = (raw) => {
/** 项目档案查看弹窗(原型 modal-reg-project-archive */ /** 项目档案查看弹窗(原型 modal-reg-project-archive */
function ArchiveModal({ record, loading, fetchFiles, onClose }) { function ArchiveModal({ record, loading, fetchFiles, onClose }) {
const [query, setQuery] = useState({ pageIndex: 1, pageSize: 10, fileName: "" });
const [list, setList] = useState([]); const [list, setList] = useState([]);
const [total, setTotal] = useState(0); const [keyword, setKeyword] = useState("");
const [viewRecord, setViewRecord] = useState(null); const [viewRecord, setViewRecord] = useState(null);
useEffect(() => { useEffect(() => {
if (!record?.id) return; if (!record?.id) return;
fetchFiles({ projectId: record.id, ...query }).then((res) => { fetchFiles({ projectId: record.id, pageSize: 500 }).then((res) => {
if (res?.success !== false) { if (res?.success !== false) {
setList(res?.data || []); setList(res?.data || []);
setTotal(res?.totalCount || 0);
} }
}); });
}, [record?.id, query]); }, [record?.id]);
const debouncedKeyword = useDebounce(keyword, 400);
const filteredList = useMemo(() => {
const kw = debouncedKeyword.trim().toLowerCase();
if (!kw) return list;
return list.filter(
(item) =>
(item.files || []).some((f) =>
(f.name || "").toLowerCase().includes(kw),
) || (item.archiveType || "").toLowerCase().includes(kw),
);
}, [list, debouncedKeyword]);
/** 单文件下载:跨域地址下 a.download 无效fetch 转 blob 后再触发下载 */ /** 单文件下载:跨域地址下 a.download 无效fetch 转 blob 后再触发下载 */
const downloadArchiveFile = async (f) => { const downloadArchiveFile = async (f) => {
@ -66,8 +75,7 @@ function ArchiveModal({ record, loading, fetchFiles, onClose }) {
{ {
title: "序号", title: "序号",
width: 60, width: 60,
render: (_, __, index) => render: (_, __, index) => index + 1,
(query.pageIndex - 1) * query.pageSize + index + 1,
}, },
{ {
title: "文件名称", title: "文件名称",
@ -179,9 +187,10 @@ function ArchiveModal({ record, loading, fetchFiles, onClose }) {
</div> </div>
<Input.Search <Input.Search
placeholder="输入文件名称" placeholder="搜索文件名称或档案类型"
allowClear allowClear
onSearch={(v) => setQuery((q) => ({ ...q, fileName: v, pageIndex: 1 }))} onChange={(e) => setKeyword(e.target.value)}
onSearch={setKeyword}
className="epd-archive__search" className="epd-archive__search"
/> />
@ -189,19 +198,10 @@ function ArchiveModal({ record, loading, fetchFiles, onClose }) {
rowKey="id" rowKey="id"
size="small" size="small"
columns={columns} columns={columns}
dataSource={list} dataSource={filteredList}
loading={loading} loading={loading}
scroll={{ x: 800, y: 400 }} scroll={{ x: 800, y: 400 }}
pagination={{ pagination={false}
total,
current: query.pageIndex,
pageSize: query.pageSize,
showSizeChanger: true,
showQuickJumper: true,
showTotal: (t) => `${t}`,
onChange: (page, pageSize) =>
setQuery((q) => ({ ...q, pageIndex: page, pageSize })),
}}
/> />
<Modal <Modal