feat platform dashboard and organization management

This commit is contained in:
david
2026-07-29 14:51:13 +08:00
parent 35a52c4b06
commit 5c5bc49e86
13 changed files with 466 additions and 94 deletions

View File

@@ -2,11 +2,36 @@ import { request } from './http';
import { resourceApi } from './resource';
/** 平台角色、菜单、账号和工作台接口。 */
export interface DashboardMetric {
name: string;
value: number;
}
export interface DashboardDailyMetric {
date: string;
order_count: number;
order_amount: number;
}
export interface DashboardOverview {
gas_basic_count: number;
delivery_basic_count: number;
staff_count: number;
user_count: number;
product_count: number;
active_contract_count: number;
today_order_count: number;
today_order_amount: number;
pending_ticket_count: number;
paid_amount: number;
order_statuses: DashboardMetric[];
product_statuses: DashboardMetric[];
payment_channels: DashboardMetric[];
recent_orders: DashboardDailyMetric[];
}
export type PlatformRole = { identity: string; role_code: string; name: string; location_scope: string; is_system: boolean; status: number };
export type PlatformMenu = { identity: string; parent_identity?: string; group_code: string; name: string; icon: string; path: string; sort_no: number };
export const platformApi = {
overview: () => request<Record<string, number>>('/dashboard/overview'),
overview: () => request<DashboardOverview>('/dashboard/overview'),
listAccount: () => request<{ total: number; list: Record<string, unknown>[] }>('/platform_account'),
listRole: () => resourceApi.list<PlatformRole>('/platform_role'),
createRole: (data: Record<string, unknown>) => resourceApi.create<PlatformRole>('/platform_role', data),