From 604bb40fe2c6e2d311bacfe612900f90adcad541 Mon Sep 17 00:00:00 2001 From: awenes <1121353141@qq.com> Date: Mon, 25 Sep 2023 21:15:13 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E9=97=A8=E6=88=B7=E7=AB=AF=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=88=86=E7=BB=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/Application/Application.tsx | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/eiam-portal/src/main/portal-fe/src/pages/Application/Application.tsx b/eiam-portal/src/main/portal-fe/src/pages/Application/Application.tsx index 892bd3c4..387ea83b 100644 --- a/eiam-portal/src/main/portal-fe/src/pages/Application/Application.tsx +++ b/eiam-portal/src/main/portal-fe/src/pages/Application/Application.tsx @@ -58,7 +58,17 @@ const CardList = () => { const actionRef = useRef(); const [searchParams, setSearchParams] = useState>(); const [loading, setLoading] = useState(false); - const [items, setItems] = useState<{ key: string; label: React.JSX.Element }[]>([]); + const [items, setItems] = useState<{ key: string; label: React.JSX.Element }[]>([ + { + key: 'all', + label: ( + + {intl.formatMessage({ id: 'pages.application.group_all' })} + {renderBadge(0, currentGroup === 'all')} + + ), + }, + ]); const initSso = (idpInitUrl: string) => { const div = window.document.createElement('div'); @@ -92,16 +102,11 @@ const CardList = () => { ), }); }); - setItems(data); - // 如果有分组,取第一个分组 - if (data.length > 0) { - setSearchParams({ groupId: data[0].key }); - actionRef.current?.reload(); - } + setItems((values) => { + return values.concat(data); + }); // 手动请求 - else { - actionRef.current?.reload(); - } + actionRef.current?.reload(); } }, []); @@ -135,9 +140,15 @@ const CardList = () => { onChange(key) { if (key) { setCurrentGroup(key); - setSearchParams((values) => { - return { ...values, groupId: key }; - }); + if (key === 'all') { + setSearchParams((values) => { + return { ...values }; + }); + } else { + setSearchParams((values) => { + return { ...values, groupId: key }; + }); + } actionRef.current?.reload(); } },