From 3372b156bdb62002e4c14f9bd91aa2f3f0e96ea9 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 26 Mar 2025 14:36:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BA=E8=A1=A8=E6=A0=BC~~?= =?UTF-8?q?~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/robot_management.html | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/plugins/stats_dashboard/templates/robot_management.html b/plugins/stats_dashboard/templates/robot_management.html index 43f5cc0..982d0eb 100644 --- a/plugins/stats_dashboard/templates/robot_management.html +++ b/plugins/stats_dashboard/templates/robot_management.html @@ -151,8 +151,8 @@

消息数量趋势

- -
+ +
@@ -180,8 +180,8 @@
暂无数据
- -
+ +

统计摘要

@@ -522,25 +522,40 @@ this.trendLoading = false; } else { this.$message.error('加载消息趋势失败'); + // 设置默认值 + this.trendData = { dates: [], counts: [] }; this.trendLoading = false; } }) .catch(error => { console.error('加载消息趋势失败:', error); this.$message.error('加载消息趋势失败: ' + error.message); + // 设置默认值 + this.trendData = { dates: [], counts: [] }; this.trendLoading = false; }); }, // 计算百分比的方法 getPercentage(index) { - if (!this.trendData || !this.trendData.counts) return 0; + if (!this.trendData || !this.trendData.counts || !Array.isArray(this.trendData.counts)) return 0; + if (index < 0 || index >= this.trendData.counts.length) return 0; + const count = parseInt(this.trendData.counts[index] || 0); return this.totalMessages > 0 ? ((count / this.totalMessages) * 100).toFixed(2) : 0; + }, + + // 确保在打开对话框时重置 trendData + viewMessageTrend(group) { + this.currentGroupId = group.group_id; + this.currentGroupName = group.group_name || group.group_id; + // 重置 trendData 为默认值 + this.trendData = { dates: [], counts: [] }; + this.trendDialogVisible = true; } - // ... 保留其他方法 ... + // ... 其他方法保持不变 ... } });