diff --git a/src/pages/dashboard.vue b/src/pages/dashboard.vue index 007a141c..8a94b16c 100644 --- a/src/pages/dashboard.vue +++ b/src/pages/dashboard.vue @@ -134,6 +134,8 @@ let dashboardGridContentResizeFrame: number | null = null let dashboardGridResizeRefreshFrame: number | null = null let dashboardRevealFrame: number | null = null let isDashboardRevealPending = false +// 标记最近一次响应式档位切换,避免快速缩放时较早的异步配置覆盖最新档位。 +let dashboardLayoutProfileSwitchId = 0 // 是否正在手动缩放组件,避免自动测高抢回用户拖动中的高度。 const isDashboardGridResizing = ref(false) @@ -1337,13 +1339,15 @@ watch( const nextProfile = resolveDashboardLayoutProfile() if (nextProfile === dashboardLayoutProfile.value) return - if (dashboardGrid.value && !isSyncingDashboardGrid.value && !isDashboardGridLayoutResetPending.value) { - persistDashboardGridLayout(false) - } - + // GridStack 可能已先完成列数压缩;档位切换只读取目标配置,不能保存当前自动重排结果。 + const profileSwitchId = ++dashboardLayoutProfileSwitchId dashboardLayoutProfile.value = nextProfile const profileConfig = await loadDashboardProfileConfig(nextProfile) + if (profileSwitchId !== dashboardLayoutProfileSwitchId || dashboardLayoutProfile.value !== nextProfile) return + const legacyEnable = profileConfig?.enabled === undefined ? await loadLegacyDashboardEnableConfig() : undefined + if (profileSwitchId !== dashboardLayoutProfileSwitchId || dashboardLayoutProfile.value !== nextProfile) return + dashboardGridLayout.value = profileConfig?.items ?? {} enableConfig.value = mergeDashboardEnableConfig(profileConfig?.enabled ?? legacyEnable) if (profileConfig?.enabled === undefined && legacyEnable !== undefined) { diff --git a/src/views/dashboard/AnalyticsCpu.vue b/src/views/dashboard/AnalyticsCpu.vue index fe0368c5..5ef4cf22 100644 --- a/src/views/dashboard/AnalyticsCpu.vue +++ b/src/views/dashboard/AnalyticsCpu.vue @@ -94,7 +94,7 @@ const chartOptions = controlledComputed( }, padding: { top: -10, - left: 8, + left: 0, right: 5, bottom: 5, }, @@ -136,7 +136,6 @@ const chartOptions = controlledComputed( yaxis: { labels: { show: true, - minWidth: 32, formatter: (value: number) => `${Math.round(value)}%`, style: { colors: axisLabelColor, diff --git a/src/views/dashboard/AnalyticsMemory.vue b/src/views/dashboard/AnalyticsMemory.vue index e7e5597d..fe9ba38b 100644 --- a/src/views/dashboard/AnalyticsMemory.vue +++ b/src/views/dashboard/AnalyticsMemory.vue @@ -101,7 +101,7 @@ const chartOptions = controlledComputed( }, padding: { top: -10, - left: 8, + left: 0, right: 5, bottom: 5, }, @@ -143,7 +143,6 @@ const chartOptions = controlledComputed( yaxis: { labels: { show: true, - minWidth: 40, formatter: (value: number) => formatDashboardFileSize(value, 0, totalMemory.value || value), style: { colors: axisLabelColor, diff --git a/src/views/dashboard/AnalyticsNetwork.vue b/src/views/dashboard/AnalyticsNetwork.vue index 3960e141..b2a97358 100644 --- a/src/views/dashboard/AnalyticsNetwork.vue +++ b/src/views/dashboard/AnalyticsNetwork.vue @@ -97,7 +97,7 @@ const chartOptions = controlledComputed( }, padding: { top: -10, - left: 8, + left: 0, right: 5, bottom: 5, }, @@ -145,7 +145,6 @@ const chartOptions = controlledComputed( yaxis: { labels: { show: true, - minWidth: 52, formatter: (value: number) => `${formatDashboardFileSize(value, value >= 1024 ** 2 ? 1 : 0, networkChartMax.value)}/s`, style: {