import { useNavigate } from "react-router"; import { Button } from "~/components/ui/button"; import type { OperationsWorkbenchItem, OperationsWorkbenchKpi } from "~/services/operationsApi"; import { useOperationsData } from "./OperationsDataContext"; const FALLBACK_KPIS: OperationsWorkbenchKpi[] = [ { key: "models", label: "在管模型", value: 0, detail: "0 家银行 · 0 个大类", target: "/operations/models", tone: "normal" }, { key: "grades", label: "B / C 等级", value: 0, detail: "C 0 · B 0", target: "/operations/monitoring?grade=B,C", tone: "normal" }, { key: "pending_reviews", label: "待处理结果", value: 0, detail: "到期未处理即默认暂不处理", target: "/operations/monitoring", tone: "normal" }, { key: "intervention", label: "需主动干预", value: 0, detail: "KS < 30% 或 PSI > 50%", target: "/operations/monitoring", tone: "normal" }, { key: "model_reports", label: "待我阅读报告", value: 0, detail: "超过 5 个工作日进入催办", target: "/operations/reports", tone: "normal" }, { key: "stalled_workflows", label: "流程停滞", value: 0, detail: "超过节点期限未更新", target: "/operations/workflows", tone: "normal" }, ]; const kpiToneClasses = { normal: "border-border bg-card", primary: "border-primary/25 bg-card", warning: "border-warning/35 bg-[#fffaf5]", danger: "border-danger/35 bg-[#fff7f6]", } as const; const itemToneClasses = { normal: "bg-border", primary: "bg-primary", warning: "bg-warning", danger: "bg-danger", } as const; function WorkbenchItem({ item, onNavigate }: { item: OperationsWorkbenchItem; onNavigate: (target: string) => void }) { return (
{item.title}
{item.detail}
); } function EmptyList({ text }: { text: string }) { return
{text}
; } export default function OperationsWorkbenchPage() { const navigate = useNavigate(); const { workbench } = useOperationsData(); const kpis = workbench.kpis.length === 6 ? workbench.kpis : FALLBACK_KPIS; const todos = workbench.todos; const watches = workbench.watches; const activities = workbench.activities; const serviceOnline = workbench.kpis.length === 6; return (
MODEL OPERATIONS PLATFORM

运维工作台

一屏内可见 KPI、我的待办、我的关注与最近动态

{serviceOnline ? "服务已连接" : "服务连接中"}
{workbench.alerts.length > 0 && (
{workbench.alerts.join(" ")}
)}
{kpis.map((kpi) => ( ))}

我的待办

按催办状态 / 截止日期 / 监控结果等级排序 共 {todos.length} 项
{todos.length ? todos.map((item) => ) : }

我的关注

只收纳“查看进度”类事项,不计入待办 共 {watches.length} 项
{watches.length ? watches.map((item) => ) : }

最近动态

{activities.length ? (
    {activities.map((item, index) => (
  • {item.actor} {item.text}
  • ))}
) : }
); }