/** * 星环OPC中心 — Dashboard 监控中心 UI * * 生成 Dashboard 页面的 HTML/CSS,包含: * - 4个关键指标卡片(本月收入、本月利润、现金余额、应收账款) * - 风险预警列表 * - 今日待办列表 * - AI 建议区域 */ export interface DashboardMetrics { monthlyIncome: number; monthlyIncomeChange: number; // 同比变化百分比 monthlyProfit: number; monthlyProfitChange: number; cashBalance: number; monthsOfRunway: number; // 可撑月数 receivables: number; overdueReceivables: number; } export interface DashboardAlert { id: string; title: string; severity: 'critical' | 'warning' | 'info'; category: string; message: string; created_at: string; } export interface DashboardTodo { id: string; title: string; priority: 'urgent' | 'high' | 'normal'; category: string; due_date?: string; description?: string; } export interface DashboardSuggestion { id: string; title: string; description: string; action?: { label: string; url?: string; onclick?: string; }; } export interface DashboardData { metrics: DashboardMetrics; alerts: DashboardAlert[]; todos: DashboardTodo[]; suggestions: DashboardSuggestion[]; } /** * 生成 Dashboard HTML */ export function generateDashboardHtml(data: DashboardData): string { return `
暂无风险预警
太棒了!今天没有待办事项
暂无建议
加载失败: ' + err.message + '