refactor: 整合财务系统到主应用并重构后端架构
主要变更: - 将独立的 web-finance 应用整合到 web-antd 主应用中 - 重命名 backend-mock 为 backend,增强后端功能 - 新增财务模块 API 端点(账户、预算、类别、交易) - 增强财务仪表板和报表功能 - 添加 SQLite 数据存储支持和财务数据导入脚本 - 优化路由结构,删除冗余的 finance-system 模块 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -34,4 +34,46 @@ const resetRoutes = () => resetStaticRoutes(router, routes);
|
||||
// 创建路由守卫
|
||||
createRouterGuard(router);
|
||||
|
||||
// Flatten FinWise Pro menu after each route change
|
||||
router.afterEach(() => {
|
||||
const flattenFinWiseProMenu = () => {
|
||||
const submenus = document.querySelectorAll('.vben-sub-menu');
|
||||
let finwiseMenu: Element | null = null;
|
||||
|
||||
submenus.forEach(menu => {
|
||||
const titleEl = menu.querySelector('.vben-sub-menu-content__title');
|
||||
if (titleEl?.textContent?.includes('FinWise Pro')) {
|
||||
finwiseMenu = menu;
|
||||
}
|
||||
});
|
||||
|
||||
if (!finwiseMenu) return;
|
||||
|
||||
const parentMenu = finwiseMenu.parentElement;
|
||||
const childrenUL = finwiseMenu.querySelector('.vben-menu');
|
||||
|
||||
if (!childrenUL || !parentMenu) return;
|
||||
|
||||
// Check if already processed
|
||||
if ((finwiseMenu as HTMLElement).getAttribute('data-hide-finwise') === 'true') return;
|
||||
|
||||
// Move all children to the parent menu
|
||||
const children = Array.from(childrenUL.children);
|
||||
children.forEach(child => {
|
||||
parentMenu.insertBefore(child, finwiseMenu);
|
||||
});
|
||||
|
||||
// Mark for hiding via CSS and hide directly
|
||||
(finwiseMenu as HTMLElement).setAttribute('data-hide-finwise', 'true');
|
||||
(finwiseMenu as HTMLElement).style.display = 'none';
|
||||
};
|
||||
|
||||
// Run multiple times to catch menu rendering
|
||||
setTimeout(flattenFinWiseProMenu, 100);
|
||||
setTimeout(flattenFinWiseProMenu, 300);
|
||||
setTimeout(flattenFinWiseProMenu, 500);
|
||||
setTimeout(flattenFinWiseProMenu, 1000);
|
||||
setTimeout(flattenFinWiseProMenu, 2000);
|
||||
});
|
||||
|
||||
export { resetRoutes, router };
|
||||
|
||||
106
apps/web-antd/src/router/routes/modules/business-modules.ts
Normal file
106
apps/web-antd/src/router/routes/modules/business-modules.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
name: 'FinanceDashboard',
|
||||
path: '/dashboard-finance',
|
||||
alias: ['/finance/dashboard'],
|
||||
component: () => import('#/views/finance/dashboard/index.vue'),
|
||||
meta: {
|
||||
affixTab: true,
|
||||
icon: 'mdi:chart-box',
|
||||
order: 1,
|
||||
title: '📊 财务仪表板',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceTransactions',
|
||||
path: '/transactions',
|
||||
alias: ['/finance/transactions'],
|
||||
component: () => import('#/views/finance/transactions/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:swap-horizontal',
|
||||
order: 2,
|
||||
title: '💰 交易管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceAccounts',
|
||||
path: '/accounts',
|
||||
alias: ['/finance/accounts'],
|
||||
component: () => import('#/views/finance/accounts/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:account-multiple',
|
||||
order: 3,
|
||||
title: '🏦 账户管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceCategories',
|
||||
path: '/categories',
|
||||
alias: ['/finance/categories'],
|
||||
component: () => import('#/views/finance/categories/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:tag-multiple',
|
||||
order: 4,
|
||||
title: '🏷️ 分类管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceBudgets',
|
||||
path: '/budgets',
|
||||
alias: ['/finance/budgets'],
|
||||
component: () => import('#/views/finance/budgets/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:target',
|
||||
order: 5,
|
||||
title: '🎯 预算管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceStatistics',
|
||||
path: '/statistics',
|
||||
alias: ['/finance/statistics'],
|
||||
component: () => import('#/views/finance/statistics/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:chart-box-outline',
|
||||
order: 6,
|
||||
title: '📊 财务统计',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceReports',
|
||||
path: '/reports',
|
||||
alias: ['/finance/reports'],
|
||||
component: () => import('#/views/finance/reports/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:chart-line',
|
||||
order: 7,
|
||||
title: '📈 报表分析',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceTools',
|
||||
path: '/tools',
|
||||
alias: ['/finance/tools'],
|
||||
component: () => import('#/views/finance/tools/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:tools',
|
||||
order: 8,
|
||||
title: '🛠️ 财务工具',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceSettings',
|
||||
path: '/fin-settings',
|
||||
alias: ['/finance/settings'],
|
||||
component: () => import('#/views/finance/settings/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:cog',
|
||||
order: 9,
|
||||
title: '⚙️ 系统设置',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
@@ -1,37 +1,10 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
meta: {
|
||||
icon: 'lucide:layout-dashboard',
|
||||
order: -1,
|
||||
title: $t('page.dashboard.title'),
|
||||
},
|
||||
name: 'Dashboard',
|
||||
path: '/dashboard',
|
||||
children: [
|
||||
{
|
||||
name: 'Analytics',
|
||||
path: '/analytics',
|
||||
component: () => import('#/views/dashboard/analytics/index.vue'),
|
||||
meta: {
|
||||
affixTab: true,
|
||||
icon: 'lucide:area-chart',
|
||||
title: $t('page.dashboard.analytics'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Workspace',
|
||||
path: '/workspace',
|
||||
component: () => import('#/views/dashboard/workspace/index.vue'),
|
||||
meta: {
|
||||
icon: 'carbon:workspace',
|
||||
title: $t('page.dashboard.workspace'),
|
||||
},
|
||||
},
|
||||
],
|
||||
name: 'Workspace',
|
||||
path: '/workspace',
|
||||
redirect: '/dashboard-finance',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
meta: {
|
||||
icon: 'mdi:bank',
|
||||
order: 1,
|
||||
title: '💎 FinWise Pro',
|
||||
},
|
||||
name: 'FinWisePro',
|
||||
path: '/finance',
|
||||
children: [
|
||||
{
|
||||
name: 'FinanceDashboard',
|
||||
path: 'dashboard',
|
||||
component: () => import('#/views/finance/dashboard/index.vue'),
|
||||
meta: {
|
||||
affixTab: true,
|
||||
icon: 'mdi:chart-box',
|
||||
title: '📊 财务仪表板',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'TransactionManagement',
|
||||
path: 'transactions',
|
||||
component: () => import('#/views/finance/transactions/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:swap-horizontal',
|
||||
title: '💰 交易管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AccountManagement',
|
||||
path: 'accounts',
|
||||
component: () => import('#/views/finance/accounts/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:account-multiple',
|
||||
title: '🏦 账户管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'CategoryManagement',
|
||||
path: 'categories',
|
||||
component: () => import('#/views/finance/categories/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:tag-multiple',
|
||||
title: '🏷️ 分类管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'BudgetManagement',
|
||||
path: 'budgets',
|
||||
component: () => import('#/views/finance/budgets/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:target',
|
||||
title: '🎯 预算管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'ReportsAnalytics',
|
||||
path: 'reports',
|
||||
component: () => import('#/views/finance/reports/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:chart-line',
|
||||
title: '📈 报表分析',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceTools',
|
||||
path: 'tools',
|
||||
component: () => import('#/views/finance/tools/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:tools',
|
||||
title: '🛠️ 财务工具',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'FinanceSettings',
|
||||
path: 'settings',
|
||||
component: () => import('#/views/finance/settings/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:cog',
|
||||
title: '⚙️ 系统设置',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
Reference in New Issue
Block a user