From 00741ae288e6f5ff73d473405889daa80f1d77b7 Mon Sep 17 00:00:00 2001 From: duxingchen Date: Fri, 14 Aug 2026 14:49:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(analytics):=20=E6=9F=B1=E8=89=B2=E5=AF=B9?= =?UTF-8?q?=E9=BD=90=E5=9B=BE=E4=BE=8B=E3=80=81=E5=88=B7=E6=96=B0=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E5=AE=9A=E4=BD=8D=20tab=E3=80=81=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=9B=B4=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - custom series 补 itemStyle.color,使柱色与 legend/tooltip 色点一致 - activeTab 根据 URL 参数智能初始化(选人→人员视图,选设备→轨迹流转) - 视图及页头文案从「个人能力图谱/设备流转对比」改为「人员视图/轨迹流转」 --- .../src/pages/admin/AnalyticsDashboard.tsx | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) 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 ? (
) : (