fix: Vue 代码审查修复 + 前后端功能完善#1
Merged
Merged
Conversation
- 将时序数据存储方案统一调整为 PostgreSQL 时序表,移除 InfluxDB 相关说明 - 更新 `.env.example` 环境变量模板,对齐后端配置项并补充 Redis/JWT 等配置 - 完善 `.gitignore` 规则,增加 Python 虚拟环境及缓存目录过滤 - 调整 `README.md` 与 `CLAUDE.md` 中的目录结构与测试分布说明 - 归档早期 UI 原型 HTML 文件,更新开发计划与测试策略等相关文档
## Vue Review HIGH 修复 (6 项)
- analysis.ts: 恢复 exportDailyReport/exportAnalysisReport 的 responseReturn:'body'
修复 Blob 导出被响应拦截器拦截导致运行时错误的回归
- screen/meter.vue, overview.vue, project.vue: 重新注册 watchThemeAndRerender
修复主题切换后图表颜色不刷新的问题;清理死代码导入 (watch/isDark)
- screen/meter.vue: setInterval 回调包裹 .catch() 防止悬浮 Promise 拒绝
- data-quality.vue: 新增 lastTrend ref 存储最新数据,主题切换从 ref 重渲染
修复主题切换时图表被清空的 bug
- daily.vue, data-quality.vue: 3 处空 catch 改为 console.error 避免静默吞错
## Vue Review MEDIUM 修复 (2 项)
- daily.vue: 硬编码 dayjs('2025-03-01') → 滚动日期 dayjs().subtract(90,'day')
预设改为近7/30/90天/近一年;dateRange 类型 [any,any] → [Dayjs,Dayjs]
## Backend lint 修复
- analysis_mongo_service.py: 修复 F821 timezone 未定义 (datetime.now(timezone.utc))
- analysis_service.py: 移除未使用变量 meter_subq (F841)
- task_service.py: 移除未使用变量 failed_points/failed_count (F841)
- ruff format 统一代码格式
## 其他改动
- 后端: collector 采集配置、MongoDB 集成、analysis_service、scheduler
- 文档: CHANGELOG、架构文档、MongoDB 设计文档
- 新增 analysis 报表页面 (11 个运维报表视图)
- Docker Compose 一键启动配置
Co-authored-by: ZCode <agent@zcode.dev>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
后端: - MongoDB集成: motor客户端 + meter_sessions集合 + PG-Mongo双写 - 分析API全部接入真实数据: daily/compare/consistency从MongoDB查询 - 10个运维报表清除全部假数据(142580/8911/186等) - 任务调度引擎: APScheduler + execute_task从MongoDB读取真实OBIS值 - EEPROM/Stack诊断数据解析 - 三相数据/96点负荷曲线/365天计费/费率分布 - 修复execute_task status bug + catch块返回500而非假数据 - system/db-monitor真实探测PG/Mongo/Redis - docker-compose.yml + .env补充MongoDB配置 前端: - daily.vue重构为6 Tab(概览/三相/负荷/计费/事件/诊断) - 15个页面设计统一化 + 清除所有Math.random假数据 - 项目下拉框只显示3个真实DCPP项目 - 设备列表显示真实序列号 - 暗色模式切换不再闪屏 测试: 147 passed, 5 skipped
26aec98 将 daily_analysis 端点改为 MongoDB 不可用时抛 BusinessException(500), 原测试断言 status_code == 200 在 CI(无 MongoDB)中失败。 修复:接受 200(MongoDB 可用)或 500(MongoDB 不可用), 与 test_compare_analysis 的既有模式一致。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 变更摘要
Vue Review HIGH 修复 (6 项)
exportDailyReport/exportAnalysisReport的responseReturn:'body',修复 Blob 导出被响应拦截器拦截导致运行时错误的回归watchThemeAndRerender,修复主题切换后图表颜色不刷新的问题;清理死代码导入setInterval回调包裹.catch()防止悬浮 Promise 拒绝lastTrendref 存储最新数据,主题切换从 ref 重渲染,修复主题切换时图表被清空的 bugcatch改为console.error避免静默吞错Vue Review MEDIUM 修复 (2 项)
dayjs('2025-03-01')→ 滚动日期dayjs().subtract(90,'day');预设改为近7/30/90天/近一年;dateRange类型[any,any]→[Dayjs,Dayjs]Backend lint 修复
timezone未定义(真 bug)meter_subq(F841)failed_points/failed_count(F841)ruff format统一代码格式(10 个文件)其他改动
✅ 检查状态
vue-tsc --noEmit通过ruff check通过ruff format --check通过