feat: 增强财务管理系统功能与分析能力

主要更新:
- 🎯 新增综合分析仪表板,包含关键指标卡片、预算对比、智能洞察等组件
- 📊 增强数据可视化能力,新增标签云分析、时间维度分析等图表
- 📱 优化移动端响应式设计,改进触控交互体验
- 🔧 新增多个API模块(base、budget、tag),完善数据管理
- 🗂️ 重构路由结构,新增贷款、快速添加、设置、统计等独立模块
- 🔄 优化数据导入导出功能,增强数据迁移能力
- 🐛 修复多个已知问题,提升系统稳定性

技术改进:
- 使用IndexedDB提升本地存储性能
- 实现模拟API服务,支持离线开发
- 增加自动化测试脚本,确保功能稳定
- 优化打包配置,提升构建效率

文件变更:
- 新增42个文件
- 修改55个文件
- 包含测试脚本、配置文件、组件和API模块

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
你的用户名
2025-08-24 16:41:58 +08:00
parent 4b4616de1e
commit 675fe0a1a8
154 changed files with 10035 additions and 3978 deletions

View File

@@ -2,58 +2,63 @@ import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({
headless: false // 有头模式,方便观察
headless: false, // 有头模式,方便观察
});
const context = await browser.newContext();
const page = await context.newPage();
// 收集所有控制台错误
const consoleErrors = [];
page.on('console', msg => {
page.on('console', (msg) => {
if (msg.type() === 'error') {
consoleErrors.push({
url: page.url(),
error: msg.text()
error: msg.text(),
});
}
});
// 收集所有网络错误
const networkErrors = [];
page.on('response', response => {
page.on('response', (response) => {
if (response.status() >= 400) {
networkErrors.push({
url: response.url(),
status: response.status(),
statusText: response.statusText()
statusText: response.statusText(),
});
}
});
try {
console.log('开始测试所有菜单页面...\n');
// 访问首页
await page.goto('http://localhost:5666/', {
waitUntil: 'networkidle',
timeout: 30000
timeout: 30_000,
});
// 检查是否需要登录
if (page.url().includes('/auth/login')) {
console.log('执行登录...');
// 填写登录信息
const usernameInput = await page.locator('input').first();
await usernameInput.fill('vben');
const passwordInput = await page.locator('input[type="password"]').first();
const passwordInput = await page
.locator('input[type="password"]')
.first();
await passwordInput.fill('123456');
// 点击登录按钮
const loginButton = await page.locator('button').filter({ hasText: '登录' }).first();
const loginButton = await page
.locator('button')
.filter({ hasText: '登录' })
.first();
await loginButton.click();
// 等待登录完成
await page.waitForTimeout(3000);
console.log('登录成功\n');
@@ -80,41 +85,43 @@ import { chromium } from 'playwright';
for (const menu of menuPaths) {
console.log(`\n测试菜单: ${menu.name}`);
console.log(`访问路径: ${menu.path}`);
try {
// 访问页面
await page.goto(`http://localhost:5666${menu.path}`, {
waitUntil: 'networkidle',
timeout: 20000
timeout: 20_000,
});
// 等待页面加载
await page.waitForTimeout(2000);
// 检查页面状态
const pageTitle = await page.title();
console.log(`✓ 页面标题: ${pageTitle}`);
// 检查是否有错误提示
const errorAlerts = await page.locator('.ant-alert-error').count();
if (errorAlerts > 0) {
console.log(`⚠️ 发现 ${errorAlerts} 个错误提示`);
}
// 检查是否有空状态
const emptyStates = await page.locator('.ant-empty').count();
if (emptyStates > 0) {
console.log(` 发现 ${emptyStates} 个空状态组件`);
}
// 检查主要内容区域
const mainContent = await page.locator('.ant-card, .page-main, main').first();
const mainContent = await page
.locator('.ant-card, .page-main, main')
.first();
if (await mainContent.isVisible()) {
console.log('✓ 主要内容区域已加载');
} else {
console.log('✗ 主要内容区域未找到');
}
// 对特定页面进行额外检查
if (menu.path.includes('/finance/')) {
// 检查表格
@@ -122,12 +129,12 @@ import { chromium } from 'playwright';
if (tables > 0) {
console.log(`✓ 找到 ${tables} 个数据表格`);
}
// 检查操作按钮
const buttons = await page.locator('button').count();
console.log(`✓ 找到 ${buttons} 个操作按钮`);
}
if (menu.path.includes('/analytics/')) {
// 检查图表
const charts = await page.locator('canvas').count();
@@ -135,21 +142,20 @@ import { chromium } from 'playwright';
console.log(`✓ 找到 ${charts} 个图表`);
}
}
// 截图保存
await page.screenshot({
path: `test-screenshots/${menu.path.replace(/\//g, '-')}.png`,
fullPage: true
await page.screenshot({
path: `test-screenshots/${menu.path.replaceAll('/', '-')}.png`,
fullPage: true,
});
} catch (error) {
console.log(`✗ 访问失败: ${error.message}`);
}
}
// 输出总结
console.log('\n========== 测试总结 ==========');
if (consoleErrors.length > 0) {
console.log('\n控制台错误:');
consoleErrors.forEach((err, index) => {
@@ -158,7 +164,7 @@ import { chromium } from 'playwright';
} else {
console.log('\n✓ 没有控制台错误');
}
if (networkErrors.length > 0) {
console.log('\n网络错误:');
networkErrors.forEach((err, index) => {
@@ -167,9 +173,8 @@ import { chromium } from 'playwright';
} else {
console.log('\n✓ 没有网络错误');
}
console.log('\n测试完成截图已保存到 test-screenshots 目录');
} catch (error) {
console.error('测试失败:', error);
} finally {
@@ -177,4 +182,4 @@ import { chromium } from 'playwright';
await page.waitForTimeout(5000);
await browser.close();
}
})();
})();