1.45
This commit is contained in:
parent
3667ab1a97
commit
98f020df0a
@ -7,7 +7,7 @@ import {
|
|||||||
PythonOutlined,
|
PythonOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { getApplicationPage } from './service';
|
import { getApplicationPage } from './service';
|
||||||
import type { Application, ApplicationQuery } from './types';
|
import type { Application, ApplicationQuery, ApplicationPage } from './types';
|
||||||
import { DevelopmentLanguageTypeEnum } from './types';
|
import { DevelopmentLanguageTypeEnum } from './types';
|
||||||
import { getEnabledCategories } from '../Category/service';
|
import { getEnabledCategories } from '../Category/service';
|
||||||
import type { ApplicationCategoryResponse } from '../Category/types';
|
import type { ApplicationCategoryResponse } from '../Category/types';
|
||||||
@ -61,15 +61,16 @@ const ApplicationList: React.FC = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// 包装 fetchFn,同时更新统计数据
|
// 包装 fetchFn,同时更新统计数据
|
||||||
const fetchData = async (query: ApplicationQuery) => {
|
const fetchData = async (query: ApplicationQuery): Promise<ApplicationPage> => {
|
||||||
const result = await getApplicationPage(query);
|
const result = await getApplicationPage(query) as ApplicationPage;
|
||||||
// 更新统计
|
|
||||||
const all = result.content || [];
|
// 使用后端返回的统计数据
|
||||||
setStats({
|
setStats({
|
||||||
total: all.length,
|
total: result.totalElements || 0,
|
||||||
enabled: all.filter((item) => item.enabled).length,
|
enabled: result.enabledCount || 0,
|
||||||
disabled: all.filter((item) => !item.enabled).length,
|
disabled: result.disabledCount || 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import type {BaseQuery} from '@/types/base';
|
import type {BaseQuery} from '@/types/base';
|
||||||
|
import type {Page} from '@/types/base';
|
||||||
import {ExternalSystemResponse} from "@/pages/Resource/External/List/types";
|
import {ExternalSystemResponse} from "@/pages/Resource/External/List/types";
|
||||||
import {BaseResponse} from "@/types/base";
|
import {BaseResponse} from "@/types/base";
|
||||||
import type {ApplicationCategoryResponse} from "../Category/types";
|
import type {ApplicationCategoryResponse} from "../Category/types";
|
||||||
@ -75,3 +76,9 @@ export interface DevelopmentLanguageType {
|
|||||||
code: string;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 应用分页响应(包含统计信息)
|
||||||
|
export interface ApplicationPage extends Page<Application> {
|
||||||
|
enabledCount: number; // 已启用应用总数
|
||||||
|
disabledCount: number; // 已禁用应用总数
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user