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,11 +2,11 @@ import { chromium } from 'playwright';
(async () => {
console.log('开始测试财务管理系统...\n');
// 启动浏览器
const browser = await chromium.launch({
const browser = await chromium.launch({
headless: false,
slowMo: 1000 // 减慢操作速度,便于观察
slowMo: 1000, // 减慢操作速度,便于观察
});
const context = await browser.newContext();
const page = await context.newPage();
@@ -16,57 +16,67 @@ import { chromium } from 'playwright';
console.log('1. 访问系统首页...');
await page.goto('http://localhost:5666/');
await page.waitForLoadState('networkidle');
// 检查是否需要登录
try {
const loginButton = await page.locator('button:has-text("登录")').first();
if (await loginButton.isVisible({ timeout: 3000 })) {
console.log(' 需要登录,执行登录操作...');
// 截图查看登录页面
await page.screenshot({ path: 'login-page.png' });
// 尝试填写登录表单 - 使用更通用的选择器
const usernameInput = await page.locator('input[type="text"], input[placeholder*="账号"], input[placeholder*="用户"]').first();
const passwordInput = await page.locator('input[type="password"]').first();
const usernameInput = await page
.locator(
'input[type="text"], input[placeholder*="账号"], input[placeholder*="用户"]',
)
.first();
const passwordInput = await page
.locator('input[type="password"]')
.first();
await usernameInput.fill('vben');
await passwordInput.fill('123456');
await loginButton.click();
// 等待页面跳转或加载完成
await page.waitForLoadState('networkidle', { timeout: 10000 });
await page.waitForLoadState('networkidle', { timeout: 10_000 });
console.log(' 登录操作完成\n');
}
} catch (e) {
} catch {
console.log(' 跳过登录步骤,可能已登录或无需登录\n');
}
// 等待页面稳定
await page.waitForTimeout(2000);
// 2. 直接访问财务仪表板
console.log('2. 访问财务仪表板...');
try {
await page.goto('http://localhost:5666/finance/dashboard');
await page.waitForLoadState('networkidle');
const dashboardTitle = await page.locator('text=总收入, text=总支出').first();
const dashboardTitle = await page
.locator('text=总收入, text=总支出')
.first();
if (await dashboardTitle.isVisible({ timeout: 5000 })) {
console.log(' ✓ 财务仪表板加载成功\n');
}
} catch (e) {
} catch {
console.log(' 财务仪表板访问失败,尝试其他页面...\n');
}
// 3. 测试交易管理
console.log('3. 测试交易管理模块...');
try {
await page.goto('http://localhost:5666/finance/transaction');
await page.waitForLoadState('networkidle');
const newTransactionBtn = await page.locator('button:has-text("新建交易")').first();
const newTransactionBtn = await page
.locator('button:has-text("新建交易")')
.first();
if (await newTransactionBtn.isVisible({ timeout: 5000 })) {
console.log(' ✓ 交易管理页面加载成功');
// 测试新建交易对话框
await newTransactionBtn.click();
await page.waitForTimeout(1000);
@@ -77,54 +87,59 @@ import { chromium } from 'playwright';
await page.waitForTimeout(500);
}
}
} catch (e) {
console.log(' 交易管理模块访问出错:', e.message);
} catch (error) {
console.log(' 交易管理模块访问出错:', error.message);
}
console.log('');
// 4. 测试分类管理
console.log('4. 测试分类管理模块...');
try {
await page.goto('http://localhost:5666/finance/category');
await page.waitForLoadState('networkidle');
if (await page.locator('text=新建分类').first().isVisible({ timeout: 5000 })) {
if (
await page.locator('text=新建分类').first().isVisible({ timeout: 5000 })
) {
console.log(' ✓ 分类管理模块加载成功\n');
}
} catch (e) {
} catch {
console.log(' 分类管理模块访问出错\n');
}
// 5. 测试人员管理
console.log('5. 测试人员管理模块...');
try {
await page.goto('http://localhost:5666/finance/person');
await page.waitForLoadState('networkidle');
if (await page.locator('text=新建人员').first().isVisible({ timeout: 5000 })) {
if (
await page.locator('text=新建人员').first().isVisible({ timeout: 5000 })
) {
console.log(' ✓ 人员管理模块加载成功\n');
}
} catch (e) {
} catch {
console.log(' 人员管理模块访问出错\n');
}
// 6. 测试贷款管理
console.log('6. 测试贷款管理模块...');
try {
await page.goto('http://localhost:5666/finance/loan');
await page.waitForLoadState('networkidle');
if (await page.locator('text=新建贷款').first().isVisible({ timeout: 5000 })) {
if (
await page.locator('text=新建贷款').first().isVisible({ timeout: 5000 })
) {
console.log(' ✓ 贷款管理模块加载成功\n');
}
} catch (e) {
} catch {
console.log(' 贷款管理模块访问出错\n');
}
// 7. 截图保存测试结果
console.log('7. 保存测试截图...');
await page.screenshot({ path: 'finance-system-test.png', fullPage: true });
console.log(' ✓ 截图已保存为 finance-system-test.png\n');
console.log('✅ 所有测试通过!财务管理系统运行正常。');
} catch (error) {
console.error('❌ 测试失败:', error);
await page.screenshot({ path: 'finance-system-error.png', fullPage: true });
@@ -134,4 +149,4 @@ import { chromium } from 'playwright';
await page.waitForTimeout(3000);
await browser.close();
}
})();
})();