fix: 仓储任务节点修复(assignee=None + WAREHOUSE 类型) + 前端防御性渲染
- webhook 生成任务 assignee_id 置 None,不再填中文,避免前端解析报错跳过渲染
- task_type=WAREHOUSE,并同步 isMain 判断(后端+双端前端)使其画在中央主干道
- 前端对扫码入库/出库任务:不请求用户数据,直接显示 📦 + 'MOM 仓储系统'
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { memo, useMemo, useState, useEffect } from "react";
|
||||
import { Image } from "antd";
|
||||
import { FileText, User, X } from "lucide-react";
|
||||
import { FileText, Package, User, X } from "lucide-react";
|
||||
import type { TaskResponse } from "../../types/api";
|
||||
import { TASK_STATUS } from "../../types/api";
|
||||
import { getStatusConfig } from "../../constants/task";
|
||||
@ -13,7 +13,7 @@ import type { ModalTarget } from "./TaskTreeViewer";
|
||||
// 工具
|
||||
// ============================================================
|
||||
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())}`; }
|
||||
function isMain(t: TaskResponse) { return !t.parent_task_id || t.task_type === "TRANSFER" || t.task_type === "RECOVERY"; }
|
||||
function isMain(t: TaskResponse) { return !t.parent_task_id || t.task_type === "TRANSFER" || t.task_type === "RECOVERY" || t.task_type === "WAREHOUSE"; }
|
||||
function active(s: string) { return s === "WIP" || s === "PENDING"; }
|
||||
/** 微型右箭头 SVG */
|
||||
function ArrowRight({ color = "#9ca3af", big }: { color?: string; big?: boolean }) {
|
||||
@ -117,17 +117,29 @@ const SlimCard = memo(function SlimCard({
|
||||
<span className={`rounded-full ${sz.status} font-medium ${cfg.bg} ${cfg.text}`}>{cfg.label}</span>
|
||||
</div>
|
||||
<p className={`${sz.title} font-bold text-gray-800 truncate`}>{task.task_name}</p>
|
||||
{/* 操作人(带用户图标)+ 在库转入人 */}
|
||||
{/* 操作人(带用户图标)+ 在库转入人;仓储任务防御性渲染为系统节点 */}
|
||||
<div className={`${sz.metaRow} flex items-center gap-1`}>
|
||||
{!isWarehouse && (
|
||||
<span className={`${sz.assignee} text-gray-400 truncate inline-flex items-center gap-0.5`}>
|
||||
<User className="h-2.5 w-2.5 shrink-0" />{assigneeName || task.assignee_id || "—"}
|
||||
</span>
|
||||
)}
|
||||
{/* 📥 在库任务:显示实际执行"转入在库"的操作人(任务负责人) */}
|
||||
{isWarehouse && task.assignee_id && (
|
||||
<span className={`${sz.sub} text-emerald-600`}>📥 转入在库: {assigneeName || task.assignee_id}</span>
|
||||
)}
|
||||
{(() => {
|
||||
const isSystemTask = task.task_name?.includes("扫码") || task.task_type === "WAREHOUSE";
|
||||
if (isSystemTask) {
|
||||
// ★ 仓储系统任务:不请求用户数据,直接显示系统图标 + 固定名(assignee_id 为 null 不报错)
|
||||
return (
|
||||
<span className={`${sz.assignee} text-gray-400 truncate inline-flex items-center gap-0.5`}>
|
||||
<Package className="h-2.5 w-2.5 shrink-0" />MOM 仓储系统
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (isWarehouse && task.assignee_id) {
|
||||
return (
|
||||
<span className={`${sz.sub} text-emerald-600`}>📥 转入在库: {assigneeName || task.assignee_id}</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className={`${sz.assignee} text-gray-400 truncate inline-flex items-center gap-0.5`}>
|
||||
<User className="h-2.5 w-2.5 shrink-0" />{assigneeName || task.assignee_id || "—"}
|
||||
</span>
|
||||
);
|
||||
})()}
|
||||
</div>
|
||||
{/* 单行时间(精确到分钟) */}
|
||||
<p className={`${sz.time} text-gray-300`}>
|
||||
|
||||
Reference in New Issue
Block a user