From 6eb81953f5016949a86e91c9cd0f7bc445cb31b7 Mon Sep 17 00:00:00 2001 From: duxingchen Date: Mon, 31 Aug 2026 17:20:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BD=91=E9=A1=B5=E7=AB=AF):=20=E6=B5=81?= =?UTF-8?q?=E8=BD=AC=E6=A0=91=E5=9C=A8=E5=BA=93=E4=BB=BB=E5=8A=A1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E3=80=8E=E8=B0=81=E8=BD=AC=E5=85=A5=E5=9C=A8=E5=BA=93?= =?UTF-8?q?=E3=80=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TaskFlowView 在库/入库任务节点显示『📥 转入在库: 创建人中文名』 - TaskResponse 类型补 created_by 字段 --- .../src/components/TaskTree/TaskFlowView.tsx | 17 ++++++++++++++--- frontend/src/types/api.ts | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) 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 {