import { request } from './request' import type { PageData } from './types' /** 近 6 个月趋势点(绩效按台账归属月,回款按到账月) */ export interface TrendPoint { month: string performance_total: string | null receipt_total: string | null } export interface SettlementBrief { exists: boolean status: number | null total_performance: string | null total_payable: string | null locked_at: string | null } export interface OverviewBlock { month: string performance_total: string | null payable_total: string | null person_count: number team_count: number settlement: SettlementBrief trend: TrendPoint[] note: string } export interface ApprovalTodoItem { order_id: number order_no: string order_type: number submitter_name: string | null create_time: string } export interface ReceiptTodoItem { receipt_id: number receipt_batch_no: string business_id: number business_no: string | null amount: string receipt_date: string } export interface TodoBlock { pending_approval_total: number pending_approvals: ApprovalTodoItem[] unassigned_receipt_total: number unassigned_receipts: ReceiptTodoItem[] sync_available: boolean sync_failure_total: number } export interface WarningItem { code: string level: 'warning' | 'danger' object_type: string object_id: number title: string detail: string suggest: string link: string | null } export interface WarningBlock { enabled: boolean receipt_overdue_days: number approval_timeout_days: number /** 当前返回的条目(受展示上限约束) */ items: WarningItem[] /** 全部规则命中总数;徽标计数用它,不能用 items.length */ total: number receipt_overdue_total: number approval_timeout_total: number sync_available: boolean } export interface ActivityItem { id: number module: string action: string summary: string username: string | null success: number create_time: string } export interface DashboardData { month: string overview: OverviewBlock todos: TodoBlock warnings: WarningBlock } /** * 最近动态分页结果:分页字段与全站规范同形(list/total/pageNum/pageSize), * 额外带 `modules` —— 全量模块名(不随当前页变化),供模块下拉使用。 */ export interface ActivityPage extends PageData { modules: string[] } export function getDashboard(params: { month?: string }): Promise { return request({ url: '/v1/dashboard', method: 'get', params }) } /** * 分页查询最近动态(工作台动态列表)。 * * 独立于聚合接口:翻页只重取这张列表,不必重算总览/待办/预警。 */ export function listDashboardActivities(params: { pageNum?: number pageSize?: number module?: string }): Promise { return request({ url: '/v1/dashboard/activities', method: 'get', params }) }