import type { LucideIcon } from "lucide-react"; import { ArrowRight, BarChart3, CheckCircle2, Flag } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { CmsModuleClient, type CmsRecord, type CmsRecordTone } from "@/modules/shared/components/CmsModuleClient"; type ModuleMetric = { label: string; value: string; detail: string; }; type ModulePageProps = { title: string; eyebrow: string; description: string; icon: LucideIcon; phase: "一期" | "二期预留" | "三期预留"; metrics: ModuleMetric[]; workflows: string[]; }; const STATUS_OPTIONS: Array<{ status: string; tone: CmsRecordTone }> = [ { status: "进行中", tone: "warning" }, { status: "已归档", tone: "success" }, { status: "需复核", tone: "danger" }, { status: "待处理", tone: "secondary" }, ]; const PRIORITY_OPTIONS: CmsRecord["priority"][] = ["高", "中", "低"]; function pickStatus(index: number): { status: string; tone: CmsRecordTone } { return STATUS_OPTIONS[index % STATUS_OPTIONS.length] ?? { status: "待处理", tone: "secondary" }; } function pickPriority(index: number): CmsRecord["priority"] { return PRIORITY_OPTIONS[index % PRIORITY_OPTIONS.length] ?? "低"; } function buildCmsRecords(title: string, metrics: ModuleMetric[], workflows: string[]): CmsRecord[] { const workflowRecords = workflows.map((workflow, index) => { const status = pickStatus(index); return { id: `workflow-${index + 1}`, title: workflow, owner: index % 2 === 0 ? "运营主管" : "护理组长", status: status.status, statusTone: status.tone, category: title, updatedAt: `今日 ${9 + index}:30`, priority: pickPriority(index), summary: `${title}流程节点:${workflow},支持按状态筛选、搜索和详情查看。`, }; }); const metricRecords = metrics.map((metric, index) => { const status = pickStatus(index + workflows.length); return { id: `metric-${index + 1}`, title: `${metric.label}数据巡检`, owner: "数据管理员", status: status.status, statusTone: status.tone, category: "指标分析", updatedAt: `昨日 ${14 + index}:00`, priority: metric.value.includes("%") ? "中" : pickPriority(index + 1), summary: `${metric.label}当前值 ${metric.value},${metric.detail}。`, }; }); return [ ...workflowRecords, ...metricRecords, { id: "system-red-flag", title: `${title}红色标记复核`, owner: "值班主管", status: "需复核", statusTone: "danger", category: "风险标记", updatedAt: "今日 08:45", priority: "高", summary: "内置样例风险标记,用于演示红色、黄色、绿色状态分层和待办优先级。", }, ]; } export function ModulePage({ title, eyebrow, description, icon: Icon, phase, metrics, workflows, }: ModulePageProps): React.ReactElement { const records = buildCmsRecords(title, metrics, workflows); const highPriorityCount = records.filter((record) => record.priority === "高").length; return (
{phase}

{eyebrow}

{title}

{description}

{metrics.map((metric) => ( {metric.label} {metric.value}

{metric.detail}

))}

分析摘要

内置样例数据用于看板和列表联动。

列表记录 {records.length}
{highPriorityCount}
    {workflows.slice(0, 3).map((workflow) => (
  1. ))}
); }