docs(uiux): UIUX 设计方案大改 + 5 份作业指导书对齐 + 开发任务文档
- UIUX 文档:填充 19 个缺口(多主体画像/健康度/AI+看板/增长域/洞察域/创始人端/OODA/助推/商密) - UIUX 文档:插入 6 个新章节(十四~十九),旧章节重编号为二十~三十一,更新目录和交叉引用 - 作业指导书 x5:导航改为 6 域分组,新增 Context Bar/工作模式/Insight Rail/决策线程/多工作区等 UI 概念 - 新建 docs/2-task-uiux.md:50 个代码落地开发任务,按 P0-P6 分优先级 + 8 Sprint 规划 - 后端/前端:大量新增模型、路由、组件(来自之前 Phase 开发)
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { BarChart3, Plus } from "lucide-react";
|
||||
import { listTasks, updateTask } from "@/lib/api-v2";
|
||||
import { PageContainer, Badge } from "@/components/shared/PageContainer";
|
||||
import { LoadingSpinner } from "@/components/shared/LoadingSpinner";
|
||||
import { EmptyState } from "@/components/shared/EmptyState";
|
||||
import { toast } from "sonner";
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
todo: "待办",
|
||||
in_progress: "进行中",
|
||||
done: "已完成",
|
||||
cancelled: "已取消",
|
||||
};
|
||||
|
||||
const PRIORITY_COLORS: Record<string, "red" | "amber" | "gray" | "blue"> = {
|
||||
urgent: "red",
|
||||
high: "amber",
|
||||
medium: "gray",
|
||||
low: "blue",
|
||||
};
|
||||
|
||||
export default function TasksPage() {
|
||||
const [items, setItems] = useState<Record<string, any>[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
const load = () => {
|
||||
listTasks()
|
||||
.then((resp) => setItems((resp.data as Record<string, any>[]) ?? []))
|
||||
.catch(() => setItems([]))
|
||||
.finally(() => setIsLoading(false));
|
||||
};
|
||||
|
||||
useEffect(() => { load(); }, []);
|
||||
|
||||
const handleStatusChange = async (id: string, status: string) => {
|
||||
try {
|
||||
await updateTask(id, { status });
|
||||
toast.success("状态已更新");
|
||||
load();
|
||||
} catch {
|
||||
toast.error("更新失败");
|
||||
}
|
||||
};
|
||||
|
||||
const columns = ["todo", "in_progress", "done"];
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
title="任务看板"
|
||||
description="投后任务管理 — 来源:风险/月报/协同/手动"
|
||||
actions={
|
||||
<button className="flex items-center gap-1 rounded-md bg-gray-900 px-3 py-1.5 text-sm text-white hover:bg-gray-700">
|
||||
<Plus size={16} /> 新建任务
|
||||
</button>
|
||||
}
|
||||
>
|
||||
{isLoading ? (
|
||||
<LoadingSpinner />
|
||||
) : items.length === 0 ? (
|
||||
<EmptyState description="暂无任务" />
|
||||
) : (
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
{columns.map((col) => (
|
||||
<div key={col} className="rounded-lg border border-gray-200 bg-gray-50 p-3">
|
||||
<h3 className="mb-2 text-sm font-medium text-gray-700">{STATUS_LABELS[col]}</h3>
|
||||
<div className="space-y-2">
|
||||
{items.filter((i) => i.status === col).map((item, i) => (
|
||||
<div key={i} className="rounded-md border border-gray-200 bg-white p-3">
|
||||
<div className="flex items-start justify-between">
|
||||
<span className="text-sm font-medium text-gray-900">{item.title as string}</span>
|
||||
<Badge color={PRIORITY_COLORS[item.priority as string] ?? "gray"}>
|
||||
{item.priority as string}
|
||||
</Badge>
|
||||
</div>
|
||||
{item.description && <p className="mt-1 text-xs text-gray-500">{item.description as string}</p>}
|
||||
<select
|
||||
value={item.status as string}
|
||||
onChange={(e) => handleStatusChange(item.id as string, e.target.value)}
|
||||
className="mt-2 w-full rounded border border-gray-200 px-2 py-1 text-xs"
|
||||
>
|
||||
{Object.entries(STATUS_LABELS).map(([k, v]) => (
|
||||
<option key={k} value={k}>{v}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user