diff --git a/frontend/src/pages/admin/AnalyticsDashboard.tsx b/frontend/src/pages/admin/AnalyticsDashboard.tsx index 6a8cd23..d35962c 100644 --- a/frontend/src/pages/admin/AnalyticsDashboard.tsx +++ b/frontend/src/pages/admin/AnalyticsDashboard.tsx @@ -74,7 +74,13 @@ export default function AnalyticsDashboard() { (searchParams.get("product_sns") || searchParams.get("product_sn") || searchParams.get("sn") || "") .split(",").filter(Boolean), ); - const [activeTab, setActiveTab] = useState("capability"); + const [activeTab, setActiveTab] = useState<"capability" | "flow">(() => { + // 根据 URL 参数智能判断初始 tab:选了人 → 个人能力图谱;没选人但选了设备 → 设备流转对比 + const hasAssignee = (searchParams.get("assignee_id") || "").split(",").filter(Boolean).length > 0; + const hasDevice = (searchParams.get("product_sns") || searchParams.get("product_sn") || searchParams.get("sn") || "") + .split(",").filter(Boolean).length > 0; + return !hasAssignee && hasDevice ? "flow" : "capability"; + }); // ─── 下拉选项 + 数据 ───────────────────────────────────── const [options, setOptions] = useState({ assignees: [], spec_models: [], devices: [] }); @@ -425,6 +431,7 @@ export default function AnalyticsDashboard() { name: s.name, type: "custom" as const, z: 2, + itemStyle: { color: BRANCH_COLORS[index % BRANCH_COLORS.length] }, dimensions: ['device', 'start', 'end', 'task', 'duration', 'is_main'], encode: { x: 0, y: [1, 2] }, renderItem: (params: any, api: any) => { @@ -477,7 +484,7 @@ export default function AnalyticsDashboard() {

📊 效能分析看板

-

个人能力图谱 / 设备流转对比 · ECharts 可视化

+

人员视图 / 轨迹流转 · ECharts 可视化

@@ -643,12 +650,12 @@ export default function AnalyticsDashboard() { label: ( - 个人能力图谱 + 人员视图 ), children: (
-

个人能力图谱(单台设备耗时 · 点击柱子查看备注)

+

人员视图(单台设备耗时 · 点击柱子查看备注)

{capabilityLoading && !capability ? (
@@ -656,7 +663,7 @@ export default function AnalyticsDashboard() { ) : capabilityEmpty ? (
) : ( @@ -674,12 +681,12 @@ export default function AnalyticsDashboard() { label: ( - 设备流转对比 + 轨迹流转 ), children: (
-

设备生命周期时间轴(按人区间 · 并行任务并排显示)

+

轨迹流转(按人区间 · 并行任务并排显示)

{flowLoading && !flow ? (
@@ -687,7 +694,7 @@ export default function AnalyticsDashboard() { ) : flowEmpty ? (
) : (