fix
parent
273cb8d6ec
commit
26090399d3
|
|
@ -358,7 +358,7 @@ export const evalProjectArchivePage = declareRequest(
|
|||
"Get > /safetyEval/institution/eval-project/archive-supervision-page",
|
||||
);
|
||||
|
||||
/** 项目档案文件列表(监管端,分页参数为 pageIndex/pageSize,总数 totalCount) */
|
||||
/** 项目档案文件列表-监管端 */
|
||||
export const evalProjectArchiveFilePage = declareRequest(
|
||||
"evalProjectArchiveFileLoading",
|
||||
"Get > /safetyEval/eval-project-archive-file/monitor/page",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
|||
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
|
||||
import { tools } from "@cqsjjb/jjb-common-lib";
|
||||
import { useDebounce } from "~/utils";
|
||||
import LayoutFooterPortal from "~/components/LayoutFooterPortal";
|
||||
import PreviewUrlButton from "~/components/PreviewUrlButton";
|
||||
import ArchiveSupplementModal from "./ArchiveSupplementModal";
|
||||
|
|
@ -77,9 +78,10 @@ const ArchiveContent = ({ readOnly, ...props }) => {
|
|||
fetchArchiveFiles();
|
||||
}, [projectId]);
|
||||
|
||||
/** 本地筛选:来源 + 文件名称/档案类型关键字 */
|
||||
/** 本地筛选:来源 + 文件名称/档案类型关键字(防抖 400ms) */
|
||||
const debouncedKeyword = useDebounce(keyword, 400);
|
||||
const filteredArchiveFiles = useMemo(() => {
|
||||
const kw = keyword.trim().toLowerCase();
|
||||
const kw = debouncedKeyword.trim().toLowerCase();
|
||||
return archiveFiles.filter((item) => {
|
||||
const matchSource = !sourceFilter || item.recordSource === sourceFilter;
|
||||
const matchKeyword =
|
||||
|
|
@ -90,7 +92,7 @@ const ArchiveContent = ({ readOnly, ...props }) => {
|
|||
(item.archiveType || "").toLowerCase().includes(kw);
|
||||
return matchSource && matchKeyword;
|
||||
});
|
||||
}, [archiveFiles, sourceFilter, keyword]);
|
||||
}, [archiveFiles, sourceFilter, debouncedKeyword]);
|
||||
|
||||
const isSignatureCompleted =
|
||||
processControl?.reviewerSignatureTaskStatus === "completed";
|
||||
|
|
|
|||
|
|
@ -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 TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||
import PreviewUrlButton from "~/components/PreviewUrlButton";
|
||||
import { useDebounce } from "~/utils";
|
||||
import {
|
||||
NODE_LABELS,
|
||||
ARCHIVE_TYPE_MAP,
|
||||
|
|
@ -17,22 +18,30 @@ const resolveFileUrl = (raw) => {
|
|||
|
||||
/** 项目档案查看弹窗(原型 modal-reg-project-archive) */
|
||||
function ArchiveModal({ record, loading, fetchFiles, onClose }) {
|
||||
const [query, setQuery] = useState({ pageIndex: 1, pageSize: 10, fileName: "" });
|
||||
const [list, setList] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [keyword, setKeyword] = useState("");
|
||||
const [viewRecord, setViewRecord] = useState(null);
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!record?.id) return;
|
||||
fetchFiles({ projectId: record.id, ...query }).then((res) => {
|
||||
fetchFiles({ projectId: record.id, pageSize: 500 }).then((res) => {
|
||||
if (res?.success !== false) {
|
||||
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 后再触发下载 */
|
||||
const downloadArchiveFile = async (f) => {
|
||||
|
|
@ -66,8 +75,7 @@ function ArchiveModal({ record, loading, fetchFiles, onClose }) {
|
|||
{
|
||||
title: "序号",
|
||||
width: 60,
|
||||
render: (_, __, index) =>
|
||||
(query.pageIndex - 1) * query.pageSize + index + 1,
|
||||
render: (_, __, index) => index + 1,
|
||||
},
|
||||
{
|
||||
title: "文件名称",
|
||||
|
|
@ -179,9 +187,10 @@ function ArchiveModal({ record, loading, fetchFiles, onClose }) {
|
|||
</div>
|
||||
|
||||
<Input.Search
|
||||
placeholder="输入文件名称"
|
||||
placeholder="搜索文件名称或档案类型"
|
||||
allowClear
|
||||
onSearch={(v) => setQuery((q) => ({ ...q, fileName: v, pageIndex: 1 }))}
|
||||
onChange={(e) => setKeyword(e.target.value)}
|
||||
onSearch={setKeyword}
|
||||
className="epd-archive__search"
|
||||
/>
|
||||
|
||||
|
|
@ -189,19 +198,10 @@ function ArchiveModal({ record, loading, fetchFiles, onClose }) {
|
|||
rowKey="id"
|
||||
size="small"
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
dataSource={filteredList}
|
||||
loading={loading}
|
||||
scroll={{ x: 800, y: 400 }}
|
||||
pagination={{
|
||||
total,
|
||||
current: query.pageIndex,
|
||||
pageSize: query.pageSize,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (t) => `共 ${t} 条`,
|
||||
onChange: (page, pageSize) =>
|
||||
setQuery((q) => ({ ...q, pageIndex: page, pageSize })),
|
||||
}}
|
||||
pagination={false}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
|
|
|
|||
Loading…
Reference in New Issue