fix(admin): 优化管理控制台报表显示
This commit is contained in:
1 parent
1ee4c69dee
commit
b2fa2688a3
16 files changed
+1326
-157
No files matched your search
@@ -7,7 +7,14 @@ import { requestJson } from '@/shared/api/client';
|
||||
import type { AdminUserRow } from '../types/admin.types';
|
||||
import type { AdminDashboardBadges, AdminDashboardSummary } from '../types/dashboard.types';
|
||||
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
||||
import type { UsageReport, UsageRangeKey } from '../types/report.types';
|
||||
import type {
|
||||
ApplicationReport,
|
||||
ApplicationSortKey,
|
||||
ApplicationStatusFilter,
|
||||
ApplicationUsageFilter,
|
||||
UsageReport,
|
||||
UsageRangeKey,
|
||||
} from '../types/report.types';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
@@ -275,6 +282,39 @@ export const getAdminUsageReport = (params: AdminUsageReportParams = {}) => {
|
||||
auth(),
|
||||
);
|
||||
};
|
||||
|
||||
export interface AdminApplicationReportParams {
|
||||
range?: UsageRangeKey;
|
||||
status?: ApplicationStatusFilter;
|
||||
usage?: ApplicationUsageFilter;
|
||||
q?: string;
|
||||
sort?: ApplicationSortKey;
|
||||
order?: 'asc' | 'desc';
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取应用运营报表(按应用聚合使用 / 权限 / 评分)。
|
||||
* @param params - 时间范围、状态、使用筛选、搜索与排序分页
|
||||
*/
|
||||
export const getAdminApplicationReport = (params: AdminApplicationReportParams = {}) => {
|
||||
const qs = new URLSearchParams();
|
||||
if (params.range) qs.set('range', params.range);
|
||||
if (params.status && params.status !== 'all') qs.set('status', params.status);
|
||||
if (params.usage && params.usage !== 'all') qs.set('usage', params.usage);
|
||||
if (params.q?.trim()) qs.set('q', params.q.trim());
|
||||
if (params.sort) qs.set('sort', params.sort);
|
||||
if (params.order) qs.set('order', params.order);
|
||||
if (params.page != null) qs.set('page', String(params.page));
|
||||
if (params.page_size != null) qs.set('page_size', String(params.page_size));
|
||||
const query = qs.toString();
|
||||
return requestJson<ApplicationReport>(
|
||||
`/api/admin/reports/applications${query ? `?${query}` : ''}`,
|
||||
auth(),
|
||||
);
|
||||
};
|
||||
|
||||
export const getAdminFeedbackReport = () => requestJson<any>('/api/admin/reports/feedback', auth());
|
||||
export const getAdminReportTable = (url: string) => requestJson<any[]>(url, auth());
|
||||
export const getAdminReportTableCount = (url: string) => requestJson<{ total: number }>(url, auth());
|
||||
|
||||
Reference in new issue
Block a user