调整趋势图功能,加入了查询数据库,分析群聊聊天数量的功能

This commit is contained in:
liuwei
2025-03-26 14:06:23 +08:00
parent c3288e8362
commit 857c50426d

View File

@@ -151,8 +151,8 @@
<div v-else>
<div class="chart-container">
<h3>消息数量趋势</h3>
<!-- 使用div作为容器动态创建canvas -->
<div ref="chartContainer" style="width: 100%; height: 300px;"></div>
<!-- 使用唯一ID -->
<div :id="'chart-container-' + currentGroupId" style="width: 100%; height: 300px;"></div>
</div>
<div style="margin-top: 20px; text-align: center;">
<el-radio-group v-model="trendDays" @change="loadMessageTrend">
@@ -455,14 +455,19 @@
try {
console.log('开始渲染图表');
// 获取容器元素
const container = this.$refs.chartContainer;
// 使用唯一ID获取容器元素
const containerId = 'chart-container-' + this.currentGroupId;
console.log('尝试获取图表容器ID:', containerId);
const container = document.getElementById(containerId);
if (!container) {
console.error('找不到图表容器');
console.error('找不到图表容器ID:', containerId);
this.$message.error('无法找到图表容器,请尝试重新打开对话框');
return;
}
console.log('找到图表容器:', container);
// 清空容器
container.innerHTML = '';