fix: 任务进度条补全驳回段 + 在制品名称旁显示SN

1. 任务进度条: 3段→4段 (PENDING|WIP|COMPLETED|REJECTED)
   解决总数11但进度条只覆盖9的视觉缺口
   驳回以红色段显示, 拼图完整

2. 在制品行: 产品SN从第二行移到任务名旁边
   旧: 装配  张三  → 新: 装配 A1B2C3D4  张三
   一行看清: 做什么工序+哪台设备+谁在做
This commit is contained in:
2026-08-12 14:04:14 +08:00
parent 32c234fea1
commit eb9028dcc6

View File

@ -30,10 +30,11 @@ function rangeToParams(key: DateRangeKey, customRange: [Dayjs, Dayjs] | null) {
return { since: since.toISOString() };
}
// ─── 进度条 ───────────────────────────────────────────────
function ProgressBar({ a, b, c, total, labels }: {
// ─── 进度条支持3或4段 ─────────────────────────────────
function ProgressBar({ a, b, c, total, labels, d }: {
a: number; b: number; c: number; total: number;
labels: [string, string, string];
d?: number;
}) {
if (total === 0) return <div className="py-4 text-center text-xs text-gray-400"></div>;
const pct = (n: number) => Math.round((n / total) * 100);
@ -41,6 +42,7 @@ function ProgressBar({ a, b, c, total, labels }: {
{ n: a, color: "bg-amber-400", label: labels[0] },
{ n: b, color: "bg-blue-500", label: labels[1] },
{ n: c, color: "bg-emerald-500", label: labels[2] },
...(d !== undefined ? [{ n: d, color: "bg-red-400", label: "已驳回" }] : []),
].filter(s => s.n > 0);
return (
<div>
@ -87,10 +89,10 @@ function WipRow({ t }: { t: WipTask }) {
<div className="min-w-0 flex-1">
<div className="flex items-baseline gap-2">
<span className="text-sm font-medium text-gray-700 truncate">{t.task_name}</span>
<span className="font-mono text-xs text-gray-400 shrink-0">{t.product_sn}</span>
<span className="text-xs text-gray-400 shrink-0">{t.assignee}</span>
</div>
<div className="mt-0.5 flex items-center gap-2 text-[11px] text-gray-400">
<span className="font-mono">{t.product_sn}</span>
{t.received_at && <span>: {t.received_at}</span>}
</div>
</div>
@ -282,7 +284,7 @@ export default function AdminDashboard() {
<p className="text-3xl font-bold text-gray-800">{stats.tasks_total}<span className="text-sm font-normal text-gray-400"> </span></p>
<p className="mb-3 text-[11px] text-gray-400">PENDING/WIP | COMPLETED </p>
<ProgressBar a={stats.tasks_pending} b={stats.tasks_in_progress} c={stats.tasks_completed}
total={stats.tasks_total} labels={["待接收", "进行中", "已完成"]} />
total={stats.tasks_total} labels={["待接收", "进行中", "已完成"]} d={stats.tasks_rejected} />
</div>
{/* 品质 & 留言 */}