门户端应用分组优化

pull/57/MERGE
awenes 2023-09-25 22:08:51 +08:00
parent 604bb40fe2
commit 212416f266
1 changed files with 6 additions and 4 deletions

View File

@ -27,14 +27,15 @@ import { App, Avatar, Badge, Card, Typography } from 'antd';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { AppList, InitLoginType } from './data.d'; import { AppList, InitLoginType } from './data.d';
import { getAppGroupList, queryAppList } from './service'; import { getAppGroupList, queryAppList } from './service';
import { useIntl } from '@@/exports';
import useStyle from './style'; import useStyle from './style';
import classnames from 'classnames'; import classnames from 'classnames';
import { useAsyncEffect } from 'ahooks'; import { useAsyncEffect } from 'ahooks';
import { SpinProps } from 'antd/es/spin'; import { SpinProps } from 'antd/es/spin';
import { useIntl } from '@umijs/max';
const { Paragraph } = Typography; const { Paragraph } = Typography;
const prefixCls = 'topiam-app-list'; const prefixCls = 'topiam-app-list';
const all = 'all';
const renderBadge = (count: number, active = false) => { const renderBadge = (count: number, active = false) => {
return ( return (
<Badge <Badge
@ -60,7 +61,7 @@ const CardList = () => {
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', key: all,
label: ( label: (
<span> <span>
{intl.formatMessage({ id: 'pages.application.group_all' })} {intl.formatMessage({ id: 'pages.application.group_all' })}
@ -130,6 +131,7 @@ const CardList = () => {
}} }}
manualRequest manualRequest
request={queryAppList} request={queryAppList}
pagination={{}}
toolbar={ toolbar={
items.length > 0 items.length > 0
? { ? {
@ -140,9 +142,9 @@ const CardList = () => {
onChange(key) { onChange(key) {
if (key) { if (key) {
setCurrentGroup(key); setCurrentGroup(key);
if (key === 'all') { if (key === all) {
setSearchParams((values) => { setSearchParams((values) => {
return { ...values }; return { ...values, groupId: undefined };
}); });
} else { } else {
setSearchParams((values) => { setSearchParams((values) => {