PayrollManagementSystem/frontend/src/api/dashboard.ts
liuwenxin 294d99a0d3 feat(dashboard): 工作台前端四区块与 ECharts 图表
- /dashboard 由 Bento 占位升级:KPI 四卡(本月绩效/应付/核算人数/团队数+月结状态)、近 6 个月绩效折线与回款柱状、待办/预警列表与跳转、最近动态时间线(按模块筛选)、常用操作
- ECharts 5.6 按需引入(core + Bar/Line/Grid/Tooltip + SVGRenderer);textStyle.fontFamily 显式设为思源黑体栈(Windows 默认雅黑,字体商用合规红线)
- 路由 allowedRoles admin/finance/leader,与后端 require_roles 双层
- 新增依赖 echarts@5.6.0

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-19 18:45:17 +08:00

97 lines
2.0 KiB
TypeScript

import { request } from './request'
/** 近 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[]
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
activities: ActivityItem[]
}
export function getDashboard(params: { month?: string }): Promise<DashboardData> {
return request({ url: '/v1/dashboard', method: 'get', params })
}