2026-08-07 11:44:12 +08:00
|
|
|
|
/**
|
2026-08-10 13:12:23 +08:00
|
|
|
|
* 流转树双模式可视化 — 焦点模式 + 全景模式
|
2026-08-07 11:44:12 +08:00
|
|
|
|
*/
|
2026-08-10 13:12:23 +08:00
|
|
|
|
import { memo, useMemo, useState } from "react";
|
|
|
|
|
|
import { GitBranch, AlertTriangle, Clock, CheckCircle, Flag, FileText, X } from "lucide-react";
|
2026-08-09 18:16:47 +08:00
|
|
|
|
import type { TaskResponse } from "../../types/api";
|
2026-08-07 11:44:12 +08:00
|
|
|
|
import { TASK_STATUS } from "../../types/api";
|
|
|
|
|
|
import { getStatusConfig } from "../../constants/task";
|
|
|
|
|
|
import type { ModalTarget } from "./TaskTreeViewer";
|
|
|
|
|
|
|
2026-08-07 17:29:36 +08:00
|
|
|
|
// ============================================================
|
2026-08-10 13:12:23 +08:00
|
|
|
|
// 工具
|
2026-08-07 17:29:36 +08:00
|
|
|
|
// ============================================================
|
2026-08-10 13:12:23 +08:00
|
|
|
|
function fmtTime(d: string | null) { if (!d) return ""; const dt = new Date(d); const pad = (n: number) => String(n).padStart(2, "0"); return `${dt.getFullYear()}-${pad(dt.getMonth() + 1)}-${pad(dt.getDate())} ${pad(dt.getHours())}:${pad(dt.getMinutes())}`; }
|
2026-08-10 17:37:30 +08:00
|
|
|
|
function isMain(t: TaskResponse) { return !t.parent_task_id || t.task_type === "TRANSFER" || t.task_type === "RECOVERY"; }
|
2026-08-10 13:12:23 +08:00
|
|
|
|
function active(s: string) { return s === "WIP" || s === "PENDING"; }
|
2026-08-10 13:26:31 +08:00
|
|
|
|
/** 微型右箭头 SVG */
|
|
|
|
|
|
function ArrowRight({ color = "#9ca3af" }: { color?: string }) {
|
|
|
|
|
|
return <svg className="h-3 w-3 shrink-0" viewBox="0 0 8 8"><polygon points="0,0 8,4 0,8" fill={color} /></svg>;
|
|
|
|
|
|
}
|
2026-08-10 13:29:35 +08:00
|
|
|
|
/** 微型左箭头 SVG */
|
|
|
|
|
|
function ArrowLeft({ color = "#9ca3af" }: { color?: string }) {
|
|
|
|
|
|
return <svg className="h-3 w-3 shrink-0" viewBox="0 0 8 8"><polygon points="8,0 0,4 8,8" fill={color} /></svg>;
|
|
|
|
|
|
}
|
2026-08-12 16:08:37 +08:00
|
|
|
|
function parseImages(s: any): string[] {
|
|
|
|
|
|
if (!s) return [];
|
|
|
|
|
|
if (Array.isArray(s)) return s; // Pydantic 序列化后的数组
|
|
|
|
|
|
if (typeof s === "string") { try { return JSON.parse(s); } catch { return []; } }
|
|
|
|
|
|
return [];
|
|
|
|
|
|
}
|
2026-08-13 09:07:10 +08:00
|
|
|
|
function imageUrl(u: string) {
|
|
|
|
|
|
if (!u) return "";
|
2026-08-13 10:34:45 +08:00
|
|
|
|
if (u.startsWith("http")) return u; // 已是完整绝对地址(含跨域域名),直接用
|
|
|
|
|
|
const base = (import.meta.env.VITE_API_BASE_URL || "").replace(/\/+$/, ""); // 去掉末尾斜杠
|
|
|
|
|
|
const path = u.startsWith("/") ? u : "/" + u;
|
|
|
|
|
|
// 后端图片固定返回 /api/v1/upload/files/... 这类 /api/ 开头的相对路径,
|
|
|
|
|
|
// 需拼上 base 才能访问到后端;同时避免重复前缀:
|
|
|
|
|
|
// - base 为纯域名(如 https://track_back.iris-rs.cn)→ 正常 base + path
|
|
|
|
|
|
// - base 以 /api 或 /api/v1 结尾 → 先剥掉该段,否则会拼出 /api/api/ 或 /api/v1/api/v1
|
|
|
|
|
|
if (path.startsWith("/api/")) {
|
|
|
|
|
|
const origin = base.replace(/\/api(\/v\d+)?$/, "");
|
|
|
|
|
|
return origin + path;
|
|
|
|
|
|
}
|
|
|
|
|
|
return base + path;
|
2026-08-13 09:07:10 +08:00
|
|
|
|
}
|
2026-08-07 11:44:12 +08:00
|
|
|
|
|
2026-08-10 13:12:23 +08:00
|
|
|
|
const ALL_TASKS = new Set<TaskResponse>();
|
|
|
|
|
|
function collectAll(tasks: TaskResponse[]) { tasks.forEach(t => { ALL_TASKS.add(t); if (t.child_tasks) collectAll(t.child_tasks); }); }
|
|
|
|
|
|
function findParent(child: TaskResponse): TaskResponse | undefined { for (const t of ALL_TASKS) { if (t.id === child.parent_task_id) return t; } return undefined; }
|
2026-08-07 11:44:12 +08:00
|
|
|
|
|
2026-08-07 17:29:36 +08:00
|
|
|
|
// ============================================================
|
2026-08-10 13:12:23 +08:00
|
|
|
|
// 极简卡片
|
2026-08-07 17:29:36 +08:00
|
|
|
|
// ============================================================
|
2026-08-10 13:12:23 +08:00
|
|
|
|
const SlimCard = memo(function SlimCard({
|
2026-08-10 17:37:30 +08:00
|
|
|
|
task, assigneeName, active, legacy, onAction, currentUser, onViewRecords, rootMainId,
|
2026-08-07 11:44:12 +08:00
|
|
|
|
}: {
|
2026-08-10 13:12:23 +08:00
|
|
|
|
task: TaskResponse; assigneeName?: string; active: boolean; legacy?: boolean;
|
|
|
|
|
|
onAction: (t: ModalTarget) => void; currentUser?: { username?: string; role?: string } | null;
|
2026-08-09 18:16:47 +08:00
|
|
|
|
onViewRecords?: (t: TaskResponse) => void;
|
2026-08-10 17:37:30 +08:00
|
|
|
|
rootMainId?: string;
|
2026-08-07 11:44:12 +08:00
|
|
|
|
}) {
|
|
|
|
|
|
const cfg = getStatusConfig(task.status);
|
2026-08-07 17:26:14 +08:00
|
|
|
|
const isOwner = !!(currentUser?.username && task.assignee_id === currentUser.username);
|
|
|
|
|
|
const isManager = currentUser?.role === "SUPER_ADMIN" || currentUser?.role === "SUPERVISOR";
|
2026-08-10 13:12:23 +08:00
|
|
|
|
const main = isMain(task);
|
2026-08-10 17:37:30 +08:00
|
|
|
|
const isNestedSpawn = !main && rootMainId && task.parent_task_id !== rootMainId && !!task.parent_task_id;
|
2026-08-07 11:44:12 +08:00
|
|
|
|
|
|
|
|
|
|
return (
|
2026-08-10 13:12:23 +08:00
|
|
|
|
<div className={`relative w-44 shrink-0 rounded-lg border bg-white p-2.5 shadow-sm ${active ? "border-blue-400 ring-1 ring-blue-100" : "border-gray-200 opacity-75"} ${legacy ? "border-orange-300 animate-pulse" : ""} ${task.is_rework ? "border-l-red-500 border-l-2" : ""}`}>
|
|
|
|
|
|
<div className={`absolute -top-1.5 right-2 rounded px-1.5 py-px text-[8px] font-bold text-white ${main ? "bg-blue-500" : "bg-purple-500"}`}>{main ? "主线" : "分支"}</div>
|
|
|
|
|
|
<p className="mt-1 text-xs font-bold text-gray-800 truncate">{task.task_name}</p>
|
|
|
|
|
|
<div className="mt-1 flex items-center gap-1">
|
|
|
|
|
|
<span className={`rounded-full px-1.5 py-px text-[8px] font-medium ${cfg.bg} ${cfg.text}`}>{cfg.label}</span>
|
|
|
|
|
|
<span className="text-[9px] text-gray-400 truncate">{assigneeName || task.assignee_id || "—"}</span>
|
2026-08-07 11:44:12 +08:00
|
|
|
|
</div>
|
2026-08-10 13:12:23 +08:00
|
|
|
|
{/* 单行时间 */}
|
|
|
|
|
|
<p className="mt-1 text-[8px] text-gray-300">
|
|
|
|
|
|
⏰ {fmtTime(task.created_at).split(" ")[0]}
|
|
|
|
|
|
{task.completed_at ? ` → ${fmtTime(task.completed_at).split(" ")[0]}` : " → 至今"}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
{legacy && <p className="mt-1 text-[8px] text-orange-500">源自: {assigneeName || (findParent(task)?.assignee_id) || "历史任务"}</p>}
|
2026-08-10 17:37:30 +08:00
|
|
|
|
{isNestedSpawn && <p className="mt-1 text-[8px] text-purple-500">协助: {findParent(task)?.assignee_id || "—"}</p>}
|
2026-08-10 13:12:23 +08:00
|
|
|
|
{/* 操作按钮 */}
|
|
|
|
|
|
{active && isOwner && (
|
|
|
|
|
|
<div className="mt-1.5 flex gap-1 border-t border-gray-100 pt-1.5">
|
|
|
|
|
|
{task.status?.toUpperCase() === TASK_STATUS.PENDING && <button onClick={() => onAction({ task, action: "receive" })} className="flex-1 rounded border border-blue-200 bg-blue-50 py-0.5 text-[8px] text-blue-600">接收</button>}
|
|
|
|
|
|
{task.status?.toUpperCase() !== TASK_STATUS.PENDING && <button onClick={() => onAction({ task, action: "transfer" })} className="flex-1 rounded border border-green-200 bg-green-50 py-0.5 text-[8px] text-green-600">转交</button>}
|
|
|
|
|
|
<button onClick={() => onAction({ task, action: "reject" })} className="flex-1 rounded border border-red-200 bg-red-50 py-0.5 text-[8px] text-red-500">驳回</button>
|
2026-08-07 17:29:36 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-08-10 13:12:23 +08:00
|
|
|
|
{active && !isOwner && isManager && (
|
|
|
|
|
|
<div className="mt-1.5 flex gap-1 border-t border-orange-100 pt-1.5">
|
|
|
|
|
|
<button onClick={() => onAction({ task, action: "reject" })} className="flex-1 rounded border border-orange-200 bg-orange-50 py-0.5 text-[8px] text-orange-600">强制驳回</button>
|
|
|
|
|
|
<button onClick={() => onAction({ task, action: "transfer" })} className="flex-1 rounded border border-orange-200 bg-orange-50 py-0.5 text-[8px] text-orange-600">强制转交</button>
|
2026-08-07 17:29:36 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-08-10 13:12:23 +08:00
|
|
|
|
{/* 记录 */}
|
|
|
|
|
|
{task.records && task.records.length > 0 && (
|
|
|
|
|
|
<div onClick={(e) => { e.stopPropagation(); onViewRecords?.(task); }} className="mt-1 cursor-pointer rounded bg-blue-50 px-1.5 py-0.5 text-[8px] text-blue-600 hover:bg-blue-100">
|
|
|
|
|
|
<FileText className="mr-0.5 inline h-2.5 w-2.5" />{task.records.length}条
|
2026-08-07 17:26:14 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-08-07 11:44:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-08-07 17:29:36 +08:00
|
|
|
|
// ============================================================
|
2026-08-10 13:12:23 +08:00
|
|
|
|
// 主视图
|
2026-08-09 17:55:40 +08:00
|
|
|
|
// ============================================================
|
2026-08-10 13:12:23 +08:00
|
|
|
|
interface TaskFlowViewProps {
|
|
|
|
|
|
tasks: TaskResponse[]; onAction: (t: ModalTarget) => void;
|
2026-08-09 18:16:47 +08:00
|
|
|
|
currentUser?: { username?: string; role?: string } | null;
|
|
|
|
|
|
assigneeNames?: Record<string, string>;
|
2026-08-07 17:29:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-10 13:12:23 +08:00
|
|
|
|
export const TaskFlowView = memo(function TaskFlowView({ tasks, onAction, currentUser, assigneeNames }: TaskFlowViewProps) {
|
|
|
|
|
|
const [showFullMap, setShowFullMap] = useState(false);
|
|
|
|
|
|
const [recordsTask, setRecordsTask] = useState<TaskResponse | null>(null);
|
2026-08-09 18:16:47 +08:00
|
|
|
|
|
2026-08-11 15:37:04 +08:00
|
|
|
|
// 数据分类 — 🚀 仅根级主干作为垂直时间线节点,子节点通过 childMap 分支递归渲染
|
|
|
|
|
|
const { allMains, childMap } = useMemo(() => {
|
2026-08-10 13:12:23 +08:00
|
|
|
|
ALL_TASKS.clear(); if (tasks.length) collectAll(tasks);
|
|
|
|
|
|
const all = Array.from(ALL_TASKS);
|
2026-08-11 15:40:43 +08:00
|
|
|
|
// 🚀 收集所有主线任务(全部进入中央垂直主轴)
|
2026-08-11 15:37:04 +08:00
|
|
|
|
const mains: TaskResponse[] = [];
|
2026-08-10 17:37:30 +08:00
|
|
|
|
for (const t of all) {
|
2026-08-11 15:40:43 +08:00
|
|
|
|
if (isMain(t)) mains.push(t);
|
2026-08-10 17:37:30 +08:00
|
|
|
|
}
|
2026-08-11 15:37:04 +08:00
|
|
|
|
mains.sort((a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
|
2026-08-11 10:02:06 +08:00
|
|
|
|
// 🚀 构建全局 childMap(按 parent_task_id 索引直接子节点,保留真实树结构)
|
|
|
|
|
|
const childMap: Record<string, TaskResponse[]> = {};
|
|
|
|
|
|
for (const t of all) {
|
|
|
|
|
|
const pid = t.parent_task_id || '';
|
|
|
|
|
|
if (!childMap[pid]) childMap[pid] = [];
|
|
|
|
|
|
childMap[pid].push(t);
|
2026-08-10 17:37:30 +08:00
|
|
|
|
}
|
2026-08-11 10:02:06 +08:00
|
|
|
|
Object.values(childMap).forEach(arr => arr.sort((a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()));
|
2026-08-11 15:37:04 +08:00
|
|
|
|
return { allMains: mains, childMap };
|
2026-08-10 13:12:23 +08:00
|
|
|
|
}, [tasks]);
|
|
|
|
|
|
|
2026-08-11 10:02:06 +08:00
|
|
|
|
// 🚀 递归渲染分支节点 — 每个节点从自己的 childMap 获取直系子孙,保持树结构不断裂
|
|
|
|
|
|
const renderBranch = (node: TaskResponse, side: 'left' | 'right', isLegacy: boolean, rootMainId: string): JSX.Element => {
|
|
|
|
|
|
const kids = childMap[node.id] || [];
|
|
|
|
|
|
const arrow = side === 'left'
|
|
|
|
|
|
? (<div className="flex items-center"><ArrowLeft color={isLegacy ? "#fdba74" : "#9ca3af"} /><div className={`w-6 border-t-2 ${isLegacy ? "border-dashed border-orange-300" : "border-solid border-gray-400"}`} /></div>)
|
|
|
|
|
|
: (<div className="flex items-center"><div className={`w-6 border-t-2 ${isLegacy ? "border-dashed border-orange-300" : "border-solid border-gray-400"}`} /><ArrowRight color={isLegacy ? "#fdba74" : "#9ca3af"} /></div>);
|
|
|
|
|
|
const card = <SlimCard task={node} active={active(node.status)} legacy={isLegacy} assigneeName={assigneeNames?.[node.assignee_id || ""]} onAction={onAction} currentUser={currentUser} onViewRecords={setRecordsTask} rootMainId={rootMainId} />;
|
|
|
|
|
|
const kidsContainer = kids.length > 0 ? (
|
|
|
|
|
|
<div className={`flex flex-col gap-2 ${side === 'left' ? 'items-end' : 'items-start'}`}>
|
|
|
|
|
|
{kids.map(k => renderBranch(k, side, isLegacy, rootMainId))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : null;
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div key={node.id} className="flex flex-row items-center gap-1">
|
|
|
|
|
|
{side === 'left' && kidsContainer}
|
|
|
|
|
|
{side === 'left' && card}
|
|
|
|
|
|
{arrow}
|
|
|
|
|
|
{side === 'right' && card}
|
|
|
|
|
|
{side === 'right' && kidsContainer}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-08-11 15:37:04 +08:00
|
|
|
|
// 🚀 焦点模式 vs 全景模式:共用同一套垂直时间线布局,仅数据过滤不同
|
|
|
|
|
|
const visibleMains = useMemo(() => {
|
|
|
|
|
|
if (showFullMap) return allMains;
|
2026-08-13 11:17:13 +08:00
|
|
|
|
// 焦点模式:保留自身活跃的主线,或含活跃分支(后代)的主线,
|
|
|
|
|
|
// 避免「主线已完成、但并发协助分支仍在进行中」时整条分支被错误隐藏
|
|
|
|
|
|
const hasActiveDescendant = (node: TaskResponse): boolean => {
|
|
|
|
|
|
const kids = childMap[node.id] || [];
|
|
|
|
|
|
return kids.some(k => active(k.status) || hasActiveDescendant(k));
|
|
|
|
|
|
};
|
|
|
|
|
|
return allMains.filter(t => active(t.status) || hasActiveDescendant(t));
|
|
|
|
|
|
}, [allMains, childMap, showFullMap]);
|
2026-08-11 15:37:04 +08:00
|
|
|
|
|
2026-08-09 18:16:47 +08:00
|
|
|
|
return (
|
2026-08-10 13:12:23 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
{/* 模式切换 */}
|
|
|
|
|
|
<div className="mb-3 flex justify-center">
|
|
|
|
|
|
<button onClick={() => setShowFullMap(!showFullMap)}
|
|
|
|
|
|
className="rounded-full bg-gray-100 px-4 py-1.5 text-xs font-medium text-gray-600 hover:bg-gray-200 transition-colors">
|
|
|
|
|
|
{showFullMap ? "🔼 收起,仅看当前并发任务" : "👁️ 展开全景流转树 (查看包含已完工在内的完整历史)"}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2026-08-09 18:16:47 +08:00
|
|
|
|
|
2026-08-11 15:37:04 +08:00
|
|
|
|
{/* ─── 统一垂直时间线布局(焦点/全景共用) ─── */}
|
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
|
{visibleMains.map(mainTask => {
|
2026-08-11 15:40:43 +08:00
|
|
|
|
// 🔧 侧翼严格过滤:主线归主轴,仅 SPAWN 协助分支进入左右翼
|
|
|
|
|
|
const directChildren = (childMap[mainTask.id] || []).filter(c => !isMain(c));
|
2026-08-11 15:37:04 +08:00
|
|
|
|
const hasLegacyActive = directChildren.some(c => !isMain(c) && !active(mainTask.status));
|
|
|
|
|
|
const leftDirect = directChildren.filter((_, i) => i % 2 === 0);
|
|
|
|
|
|
const rightDirect = directChildren.filter((_, i) => i % 2 === 1);
|
|
|
|
|
|
const lineStyle = hasLegacyActive && !active(mainTask.status);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div key={mainTask.id} className="relative">
|
|
|
|
|
|
<div className="absolute left-1/2 top-0 bottom-0 w-0.5 bg-gray-200 -translate-x-1/2 z-0" />
|
|
|
|
|
|
<div className="flex flex-row items-start w-full">
|
2026-08-11 10:02:06 +08:00
|
|
|
|
{/* 左翼 — 递归渲染,子子孙孙向外延伸 */}
|
2026-08-10 13:26:31 +08:00
|
|
|
|
<div className="flex-1 flex flex-col items-end justify-center gap-2 pr-2">
|
2026-08-11 15:37:04 +08:00
|
|
|
|
{leftDirect.map(c => renderBranch(c, 'left', lineStyle, mainTask.id))}
|
2026-08-10 13:21:30 +08:00
|
|
|
|
</div>
|
2026-08-11 15:37:04 +08:00
|
|
|
|
{/* 中央 */}
|
|
|
|
|
|
<div className="shrink-0 z-10 relative">
|
|
|
|
|
|
<SlimCard task={mainTask} active={active(mainTask.status)}
|
|
|
|
|
|
assigneeName={assigneeNames?.[mainTask.assignee_id || ""]} onAction={onAction} currentUser={currentUser} onViewRecords={setRecordsTask} />
|
|
|
|
|
|
{active(mainTask.status) && (
|
|
|
|
|
|
<div className="absolute -top-1 -left-1 h-3 w-3 rounded-full bg-green-400 border-2 border-white" />
|
|
|
|
|
|
)}
|
2026-08-10 13:21:30 +08:00
|
|
|
|
</div>
|
2026-08-11 10:02:06 +08:00
|
|
|
|
{/* 右翼 — 递归渲染,子子孙孙向外延伸 */}
|
2026-08-10 13:26:31 +08:00
|
|
|
|
<div className="flex-1 flex flex-col items-start justify-center gap-2 pl-2">
|
2026-08-11 15:37:04 +08:00
|
|
|
|
{rightDirect.map(c => renderBranch(c, 'right', lineStyle, mainTask.id))}
|
2026-08-10 13:21:30 +08:00
|
|
|
|
</div>
|
2026-08-09 18:16:47 +08:00
|
|
|
|
</div>
|
2026-08-10 13:12:23 +08:00
|
|
|
|
|
2026-08-11 15:37:04 +08:00
|
|
|
|
{visibleMains.indexOf(mainTask) < visibleMains.length - 1 && (
|
|
|
|
|
|
<div className="flex justify-center py-2">
|
|
|
|
|
|
<span className="text-[10px] text-gray-300">▼</span>
|
2026-08-10 13:21:30 +08:00
|
|
|
|
</div>
|
2026-08-11 15:37:04 +08:00
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
})}
|
|
|
|
|
|
{visibleMains.length === 0 && (
|
|
|
|
|
|
<p className="text-center text-xs text-gray-400 py-8">
|
|
|
|
|
|
{showFullMap ? "暂无流转记录" : "当前无活跃主线任务"}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2026-08-07 11:44:12 +08:00
|
|
|
|
|
2026-08-10 13:12:23 +08:00
|
|
|
|
{/* 记录弹窗 */}
|
|
|
|
|
|
{recordsTask && (
|
|
|
|
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
|
|
|
|
<div className="absolute inset-0 bg-black/40 backdrop-blur-sm" onClick={() => setRecordsTask(null)} />
|
|
|
|
|
|
<div className="relative z-10 mx-4 max-h-[80vh] w-full max-w-md overflow-y-auto rounded-xl bg-white p-5 shadow-2xl">
|
|
|
|
|
|
<div className="mb-3 flex items-center justify-between"><h3 className="text-sm font-bold">提交记录 — {recordsTask.task_name}</h3><button onClick={() => setRecordsTask(null)} className="rounded p-1 text-gray-400 hover:bg-gray-100"><X className="h-4 w-4" /></button></div>
|
|
|
|
|
|
{(recordsTask.records || []).length === 0 ? <p className="py-8 text-center text-sm text-gray-400">暂无记录</p> :
|
|
|
|
|
|
<div className="space-y-2">{[...recordsTask.records!].reverse().map((r, i) => (
|
|
|
|
|
|
<div key={r.id} className="flex gap-2">
|
|
|
|
|
|
<div className={`mt-1.5 h-2 w-2 shrink-0 rounded-full ${i === 0 ? "bg-blue-500" : "bg-gray-300"}`} />
|
|
|
|
|
|
<div className="flex-1 rounded bg-gray-50 px-3 py-2"><p className="text-[10px] text-gray-400">{fmtTime(r.created_at)}</p>
|
|
|
|
|
|
{(r.note || r.remark) && <p className="mt-0.5 text-xs text-gray-700">{r.note || r.remark}</p>}
|
2026-08-12 16:08:37 +08:00
|
|
|
|
{(() => { const imgs = parseImages(r.images); if (!imgs.length) return null; return <div className="mt-1 flex gap-1 flex-wrap">{imgs.map((img, j) => <img key={j} src={imageUrl(img)} className="h-14 w-14 rounded border object-cover cursor-pointer hover:opacity-80 transition-opacity" onClick={() => window.open(imageUrl(img))} />)}</div>; })()}
|
2026-08-10 13:12:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
))}</div>}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-08-09 18:16:47 +08:00
|
|
|
|
</div>
|
2026-08-07 11:44:12 +08:00
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default TaskFlowView;
|