feat(产品管理): 当前人时间着色与任务全景一致

- 当前人时间按滞留时长着色:<1h 绿 / ≥1h 橙 / ≥24h 红
- 与任务全景「当前人滞留」列的配色逻辑统一
This commit is contained in:
2026-08-28 11:33:57 +08:00
parent 90f5718e68
commit d9a70793f7

View File

@ -240,7 +240,16 @@ export default function AdminProductsPage() {
<InfoRow icon={Hash} label="规格型号" value={p.spec_model || "—"} />
<InfoRow icon={Tag} label="订单编号" value={p.order_no || "—"} />
<InfoRow icon={MapPin} label="当前位置" value={p.current_location_name || p.current_location_id || "—"} />
<InfoRow icon={Timer} label="当前人时间" value={formatDuration(p.active_duration_hours)} />
<div className="flex items-center gap-2 text-xs">
<Timer className="h-3 w-3 shrink-0 text-gray-400" />
<span className="shrink-0 text-gray-400"></span>
{(() => {
const h = p.active_duration_hours;
if (h == null) return <span className="truncate font-medium text-gray-700"></span>;
const cls = h >= 24 ? "bg-red-50 text-red-600" : h >= 1 ? "bg-orange-50 text-orange-600" : "bg-emerald-50 text-emerald-600";
return <span className={`rounded-md px-1.5 py-0.5 font-bold ${cls}`}>{formatDuration(h)}</span>;
})()}
</div>
<InfoRow icon={CalendarDays} label="生产总天数" value={formatProductionDays(p.created_at)} />
<InfoRow icon={Clock} label="创建时间" value={new Date(p.created_at).toLocaleDateString("zh-CN")} />
</div>