This commit is contained in:
dengqichen 2025-12-29 11:06:52 +08:00
parent 3667ab1a97
commit 98f020df0a
2 changed files with 16 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import {
PythonOutlined,
} from '@ant-design/icons';
import { getApplicationPage } from './service';
import type { Application, ApplicationQuery } from './types';
import type { Application, ApplicationQuery, ApplicationPage } from './types';
import { DevelopmentLanguageTypeEnum } from './types';
import { getEnabledCategories } from '../Category/service';
import type { ApplicationCategoryResponse } from '../Category/types';
@ -61,15 +61,16 @@ const ApplicationList: React.FC = () => {
}, []);
// 包装 fetchFn同时更新统计数据
const fetchData = async (query: ApplicationQuery) => {
const result = await getApplicationPage(query);
// 更新统计
const all = result.content || [];
const fetchData = async (query: ApplicationQuery): Promise<ApplicationPage> => {
const result = await getApplicationPage(query) as ApplicationPage;
// 使用后端返回的统计数据
setStats({
total: all.length,
enabled: all.filter((item) => item.enabled).length,
disabled: all.filter((item) => !item.enabled).length,
total: result.totalElements || 0,
enabled: result.enabledCount || 0,
disabled: result.disabledCount || 0,
});
return result;
};

View File

@ -1,4 +1,5 @@
import type {BaseQuery} from '@/types/base';
import type {Page} from '@/types/base';
import {ExternalSystemResponse} from "@/pages/Resource/External/List/types";
import {BaseResponse} from "@/types/base";
import type {ApplicationCategoryResponse} from "../Category/types";
@ -75,3 +76,9 @@ export interface DevelopmentLanguageType {
code: string;
name: string;
}
// 应用分页响应(包含统计信息)
export interface ApplicationPage extends Page<Application> {
enabledCount: number; // 已启用应用总数
disabledCount: number; // 已禁用应用总数
}