fix: WIP矩阵-左外连接纳入无任务新品归待接收,PENDING并入待接收,空负责人显式计数为未分配; 表头去待确认列并做TOP N折叠
This commit is contained in:
@ -12,7 +12,7 @@ import { fetchDeviceRecords, type DeviceRecord } from "../services/analyticsApi"
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
// 🔧 固定标准主轴:核心工序 + 状态列始终显示(即使计数为 0),表头不随操作内容增减
|
||||
const FIXED_STEP_COLUMNS = ["备货", "生产", "测试", "维修", "待确认", "已完成", "已入库", "已出库"];
|
||||
const FIXED_STEP_COLUMNS = ["待接收", "备货", "生产", "测试", "维修", "已完成", "已入库", "已出库"];
|
||||
|
||||
// ⏰ 时间筛选(与全局概览一致)
|
||||
type DateRangeKey = "today" | "7d" | "30d" | "custom";
|
||||
@ -42,6 +42,21 @@ function imageUrl(u: string) {
|
||||
return base + path;
|
||||
}
|
||||
|
||||
// ─── 单元格负责人聚合预览:数量解析 + TOP 折叠 ────────────────────
|
||||
function labelCount(label: string): number {
|
||||
const m = label.match(/\((\d+)\)\s*$/);
|
||||
return m ? Number(m[1]) : 1;
|
||||
}
|
||||
function summarizeAssignees(list: string[]): string {
|
||||
if (!list.length) return "";
|
||||
// 数量降序(“未分配”同样参与按台数排序),数量最多者排最前
|
||||
const sorted = [...list].sort((a, b) => labelCount(b) - labelCount(a));
|
||||
if (sorted.length <= 2) return sorted.join("、");
|
||||
// ≥3 人:只显示台数最多的第 1 人(去掉数量后缀),折叠为 “等 N 人”
|
||||
const first = sorted[0].replace(/\(\d+\)\s*$/, "");
|
||||
return `${first}等 ${sorted.length} 人`;
|
||||
}
|
||||
|
||||
export default function MatrixBoard() {
|
||||
const [dateKey, setDateKey] = useState<DateRangeKey>("today");
|
||||
const [customRange, setCustomRange] = useState<[Dayjs, Dayjs] | null>(null);
|
||||
@ -140,11 +155,8 @@ export default function MatrixBoard() {
|
||||
>
|
||||
<div className={`text-sm font-bold leading-none ${v > 0 ? "text-blue-600" : "text-gray-800"}`}>{v}</div>
|
||||
{assignees.length > 0 && (
|
||||
<div
|
||||
className="mx-auto max-w-[90px] truncate text-[10px] leading-tight text-gray-400"
|
||||
title={assignees.join("、")}
|
||||
>
|
||||
{assignees.join("、")}
|
||||
<div className="mx-auto max-w-[92px] text-xs leading-tight text-gray-500">
|
||||
{summarizeAssignees(assignees)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user