mirror of https://gitee.com/topiam/eiam
⚡ 门户端应用分组优化
parent
5f281fa9a4
commit
604bb40fe2
|
@ -58,7 +58,17 @@ const CardList = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [searchParams, setSearchParams] = useState<Record<string, any>>();
|
const [searchParams, setSearchParams] = useState<Record<string, any>>();
|
||||||
const [loading, setLoading] = useState<boolean | SpinProps | undefined>(false);
|
const [loading, setLoading] = useState<boolean | SpinProps | undefined>(false);
|
||||||
const [items, setItems] = useState<{ key: string; label: React.JSX.Element }[]>([]);
|
const [items, setItems] = useState<{ key: string; label: React.JSX.Element }[]>([
|
||||||
|
{
|
||||||
|
key: 'all',
|
||||||
|
label: (
|
||||||
|
<span>
|
||||||
|
{intl.formatMessage({ id: 'pages.application.group_all' })}
|
||||||
|
{renderBadge(0, currentGroup === 'all')}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
const initSso = (idpInitUrl: string) => {
|
const initSso = (idpInitUrl: string) => {
|
||||||
const div = window.document.createElement('div');
|
const div = window.document.createElement('div');
|
||||||
|
@ -92,16 +102,11 @@ const CardList = () => {
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setItems(data);
|
setItems((values) => {
|
||||||
// 如果有分组,取第一个分组
|
return values.concat(data);
|
||||||
if (data.length > 0) {
|
});
|
||||||
setSearchParams({ groupId: data[0].key });
|
|
||||||
actionRef.current?.reload();
|
|
||||||
}
|
|
||||||
// 手动请求
|
// 手动请求
|
||||||
else {
|
actionRef.current?.reload();
|
||||||
actionRef.current?.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -135,9 +140,15 @@ const CardList = () => {
|
||||||
onChange(key) {
|
onChange(key) {
|
||||||
if (key) {
|
if (key) {
|
||||||
setCurrentGroup(key);
|
setCurrentGroup(key);
|
||||||
setSearchParams((values) => {
|
if (key === 'all') {
|
||||||
return { ...values, groupId: key };
|
setSearchParams((values) => {
|
||||||
});
|
return { ...values };
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setSearchParams((values) => {
|
||||||
|
return { ...values, groupId: key };
|
||||||
|
});
|
||||||
|
}
|
||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue