From cd8feef37714080ce2b53a1986629f9a542fb83b Mon Sep 17 00:00:00 2001 From: kangwenjing <1138819403@qq.com> Date: Thu, 2 Jul 2026 09:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend1/dist/index.html | 2 +- .../pages/system/user-data-scope/index.less | 22 ++++++ .../pages/system/user-data-scope/index.tsx | 77 +++++++++++-------- 3 files changed, 70 insertions(+), 31 deletions(-) diff --git a/frontend1/dist/index.html b/frontend1/dist/index.html index d21f14fd..d27c23a3 100644 --- a/frontend1/dist/index.html +++ b/frontend1/dist/index.html @@ -5,7 +5,7 @@ UnisBase - 智能会议系统 - + diff --git a/frontend1/src/pages/system/user-data-scope/index.less b/frontend1/src/pages/system/user-data-scope/index.less index 4322bedf..828345bd 100644 --- a/frontend1/src/pages/system/user-data-scope/index.less +++ b/frontend1/src/pages/system/user-data-scope/index.less @@ -38,17 +38,33 @@ } .user-data-scope-table-card { + flex: 1; + display: flex; + flex-direction: column; min-height: 0; overflow: hidden; .ant-card-body { + flex: 1; min-height: 0; } } .user-data-scope-table { + height: 100%; + .ant-spin-nested-loading, .ant-spin-container { + height: 100%; + min-height: 0; + } + + .ant-spin-container { + display: flex; + flex-direction: column; + } + + .ant-table { min-height: 0; } @@ -56,6 +72,12 @@ overflow-y: auto !important; } + .ant-table-tbody::after { + content: ""; + display: table-row; + height: 8px; + } + .ant-table-pagination { background: #fff; margin: 12px 16px !important; diff --git a/frontend1/src/pages/system/user-data-scope/index.tsx b/frontend1/src/pages/system/user-data-scope/index.tsx index a91b6535..502151ed 100644 --- a/frontend1/src/pages/system/user-data-scope/index.tsx +++ b/frontend1/src/pages/system/user-data-scope/index.tsx @@ -205,30 +205,6 @@ export default function UserDataScopePage() { loadPageData(); }, [loadPageData]); - useEffect(() => { - const updateTableScrollY = () => { - const tableCard = tableCardRef.current; - if (!tableCard) { - return; - } - const rect = tableCard.getBoundingClientRect(); - const footerReserve = 112; - const nextScrollY = Math.max(260, Math.floor(window.innerHeight - rect.top - footerReserve)); - setTableScrollY(nextScrollY); - }; - - updateTableScrollY(); - window.addEventListener("resize", updateTableScrollY); - const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(updateTableScrollY); - if (observer && tableCardRef.current) { - observer.observe(tableCardRef.current); - } - return () => { - window.removeEventListener("resize", updateTableScrollY); - observer?.disconnect(); - }; - }, [filteredGrantGroups.length, query.pageSize]); - const userOptions = useMemo(() => users.map((user) => ({ label: ( @@ -265,16 +241,57 @@ export default function UserDataScopePage() { }); }, [grantGroups, query.keyword, query.resourceType, query.viewerUserId]); - const pagedGrantGroups = useMemo(() => { - const start = (query.current - 1) * query.pageSize; - return filteredGrantGroups.slice(start, start + query.pageSize); - }, [filteredGrantGroups, query.current, query.pageSize]); - const activeGrantCount = useMemo( () => grantGroups.filter((group) => group.enabled && !isGroupExpired(group)).length, [grantGroups] ); + useEffect(() => { + const maxPage = Math.max(1, Math.ceil(filteredGrantGroups.length / query.pageSize)); + if (query.current > maxPage) { + setQuery((prev) => ({ ...prev, current: maxPage })); + } + }, [filteredGrantGroups.length, query.current, query.pageSize]); + + useEffect(() => { + const updateTableScrollY = () => { + const tableCard = tableCardRef.current; + if (!tableCard) { + return; + } + const rect = tableCard.getBoundingClientRect(); + const tableBody = tableCard.querySelector(".ant-table-body"); + const pagination = tableCard.querySelector(".ant-table-pagination"); + const bodyTop = tableBody?.getBoundingClientRect().top ?? rect.top + 56; + const paginationStyle = pagination ? window.getComputedStyle(pagination) : null; + const paginationReserve = pagination + ? pagination.getBoundingClientRect().height + + Number.parseFloat(paginationStyle?.marginTop || "0") + + Number.parseFloat(paginationStyle?.marginBottom || "0") + : 56; + const nextScrollY = Math.max(180, Math.floor(rect.bottom - bodyTop - paginationReserve - 12)); + setTableScrollY(nextScrollY); + }; + + let frameId = 0; + const scheduleUpdate = () => { + cancelAnimationFrame(frameId); + frameId = requestAnimationFrame(updateTableScrollY); + }; + + scheduleUpdate(); + window.addEventListener("resize", scheduleUpdate); + const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(scheduleUpdate); + if (observer && tableCardRef.current) { + observer.observe(tableCardRef.current); + } + return () => { + cancelAnimationFrame(frameId); + window.removeEventListener("resize", scheduleUpdate); + observer?.disconnect(); + }; + }, [filteredGrantGroups.length, query.current, query.pageSize]); + const selectedDrawerViewerId = Form.useWatch("viewerUserId", form); const ownerOptions = useMemo( () => userOptions.filter((option) => option.value !== selectedDrawerViewerId), @@ -548,7 +565,7 @@ export default function UserDataScopePage() { rowKey="id" loading={loading} columns={columns} - dataSource={pagedGrantGroups} + dataSource={filteredGrantGroups} size="middle" scroll={{ y: tableScrollY, x: 980 }} pagination={getStandardPagination(