diff --git a/frontend/src/components/TaskTree/TaskFlowView.tsx b/frontend/src/components/TaskTree/TaskFlowView.tsx index 4c94722..6ef10aa 100644 --- a/frontend/src/components/TaskTree/TaskFlowView.tsx +++ b/frontend/src/components/TaskTree/TaskFlowView.tsx @@ -87,13 +87,14 @@ const SIZE_MAP = { // 极简卡片 // ============================================================ const SlimCard = memo(function SlimCard({ - task, assigneeName, active, legacy, onAction, currentUser, onViewRecords, rootMainId, size = "sm", + task, assigneeName, active, legacy, onAction, currentUser, onViewRecords, rootMainId, size = "sm", assigneeNames, }: { task: TaskResponse; assigneeName?: string; active: boolean; legacy?: boolean; onAction: (t: ModalTarget) => void; currentUser?: { username?: string; role?: string } | null; onViewRecords?: (t: TaskResponse) => void; rootMainId?: string; size?: "sm" | "lg"; + assigneeNames?: Record; }) { const cfg = getStatusConfig(task.status); const sz = SIZE_MAP[size]; @@ -101,6 +102,12 @@ const SlimCard = memo(function SlimCard({ const isManager = currentUser?.role === "SUPER_ADMIN" || currentUser?.role === "SUPERVISOR"; const main = isMain(task); const isNestedSpawn = !main && rootMainId && task.parent_task_id !== rootMainId && !!task.parent_task_id; + // 📥 在库/入库任务:显示"谁转入在库"(创建该任务的人) + const isWarehouse = !!( + task.task_name?.includes("在库") || + task.task_name?.includes("入库") || + task.assignee_id === "virtual_warehouse" + ); return (
@@ -117,6 +124,10 @@ const SlimCard = memo(function SlimCard({

{legacy &&

源自: {assigneeName || (findParent(task)?.assignee_id) || "历史任务"}

} {isNestedSpawn &&

协助: {findParent(task)?.assignee_id || "—"}

} + {/* 📥 在库任务:显示谁转入在库 */} + {isWarehouse && task.created_by && ( +

📥 转入在库: {assigneeNames?.[task.created_by] || task.created_by}

+ )} {/* 操作按钮 */} {active && isOwner && (
@@ -191,7 +202,7 @@ export const TaskFlowView = memo(function TaskFlowView({ tasks, onAction, curren const arrow = side === 'left' ? (
) : (
); - const card = ; + const card = ; const kidsContainer = kids.length > 0 ? (
{kids.map(k => renderBranch(k, side, isLegacy, rootMainId))} @@ -251,7 +262,7 @@ export const TaskFlowView = memo(function TaskFlowView({ tasks, onAction, curren {/* 中央 */}
+ assigneeName={assigneeNames?.[mainTask.assignee_id || ""]} onAction={onAction} currentUser={currentUser} onViewRecords={setRecordsTask} size={size} assigneeNames={assigneeNames} /> {active(mainTask.status) && (
)} diff --git a/frontend/src/types/api.ts b/frontend/src/types/api.ts index 3df72bb..6e9a7a3 100644 --- a/frontend/src/types/api.ts +++ b/frontend/src/types/api.ts @@ -40,6 +40,8 @@ export interface TaskSummary { export interface TaskResponse extends TaskSummary { child_tasks: TaskResponse[]; records: TaskRecordResponse[]; + /** 🔧 任务创建人(追溯谁转交/发起该工序),如"谁转入在库" */ + created_by?: string | null; } export interface TaskRecordResponse {