2026-05-06 22:23:42 +08:00
|
|
|
import { computed } from 'vue'
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
|
feat: refactor monolithic App.vue into modular Vue component architecture
- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
2026-04-28 17:20:52 +08:00
|
|
|
import { icons } from '../data/icons.js'
|
|
|
|
|
|
2026-05-24 21:44:17 +08:00
|
|
|
export const appViews = ['overview', 'workbench', 'documents', 'requests', 'approval', 'archive', 'policies', 'audit', 'employees', 'logs', 'settings']
|
2026-05-06 22:23:42 +08:00
|
|
|
|
feat: refactor monolithic App.vue into modular Vue component architecture
- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
2026-04-28 17:20:52 +08:00
|
|
|
export const navItems = [
|
2026-04-29 23:35:56 +08:00
|
|
|
{
|
|
|
|
|
id: 'overview',
|
|
|
|
|
label: '总览',
|
2026-05-06 22:23:42 +08:00
|
|
|
navHint: '查看系统总览与关键指标',
|
2026-04-29 23:35:56 +08:00
|
|
|
icon: icons.dashboard,
|
2026-05-06 22:23:42 +08:00
|
|
|
title: '财务运营总览',
|
|
|
|
|
desc: '聚合差旅申请、审批效率、风险信号与 SLA 表现。'
|
2026-04-29 23:35:56 +08:00
|
|
|
},
|
2026-05-05 18:22:47 +08:00
|
|
|
{
|
|
|
|
|
id: 'workbench',
|
|
|
|
|
label: '个人工作台',
|
2026-05-06 22:23:42 +08:00
|
|
|
navHint: '集中处理个人待办',
|
2026-05-05 18:22:47 +08:00
|
|
|
icon: icons.workspace,
|
|
|
|
|
title: '个人工作台',
|
2026-05-06 22:23:42 +08:00
|
|
|
desc: '聚焦当前待办、快捷操作与助手入口。'
|
2026-05-05 18:22:47 +08:00
|
|
|
},
|
2026-05-24 21:44:17 +08:00
|
|
|
{
|
|
|
|
|
id: 'documents',
|
|
|
|
|
label: '单据中心',
|
|
|
|
|
navHint: '统一查看申请、报销、审批与归档',
|
|
|
|
|
icon: icons.file,
|
|
|
|
|
title: '单据中心',
|
|
|
|
|
desc: '统一查看申请、报销、审批与归档。'
|
|
|
|
|
},
|
2026-04-29 23:35:56 +08:00
|
|
|
{
|
|
|
|
|
id: 'requests',
|
2026-05-22 16:00:19 +08:00
|
|
|
label: '报销中心',
|
|
|
|
|
navHint: '查看和管理报销单据',
|
2026-04-29 23:35:56 +08:00
|
|
|
icon: icons.list,
|
2026-05-22 16:00:19 +08:00
|
|
|
title: '报销中心',
|
2026-05-13 03:29:10 +00:00
|
|
|
desc: '集中查看草稿、审批进度、票据状态与风险提示。'
|
2026-04-30 17:11:24 +08:00
|
|
|
},
|
2026-05-01 00:39:24 +08:00
|
|
|
{
|
|
|
|
|
id: 'approval',
|
|
|
|
|
label: '审批中心',
|
2026-05-06 22:23:42 +08:00
|
|
|
navHint: '处理审批任务',
|
2026-05-01 00:39:24 +08:00
|
|
|
icon: icons.approval,
|
|
|
|
|
title: '审批中心',
|
2026-05-06 22:23:42 +08:00
|
|
|
desc: '按优先级处理待审批事项,控制时效与风险。'
|
2026-05-01 00:39:24 +08:00
|
|
|
},
|
2026-05-22 16:00:19 +08:00
|
|
|
{
|
|
|
|
|
id: 'archive',
|
|
|
|
|
label: '归档中心',
|
|
|
|
|
navHint: '查阅公司已归档财务数据',
|
|
|
|
|
icon: icons.archive,
|
|
|
|
|
title: '归档中心',
|
|
|
|
|
desc: '集中保存公司已归档入账的报销单据,形成完整财务归档库。'
|
|
|
|
|
},
|
2026-04-29 23:35:56 +08:00
|
|
|
{
|
|
|
|
|
id: 'policies',
|
2026-05-06 22:23:42 +08:00
|
|
|
label: '制度知识',
|
|
|
|
|
navHint: '查看制度与知识库',
|
2026-04-29 23:35:56 +08:00
|
|
|
icon: icons.file,
|
2026-05-06 22:23:42 +08:00
|
|
|
title: '制度与知识库',
|
2026-05-14 02:59:54 +00:00
|
|
|
desc: '统一管理制度文档、检索入口与知识资产。'
|
2026-04-29 23:35:56 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'audit',
|
2026-05-11 01:53:30 +00:00
|
|
|
label: '任务规则中心',
|
|
|
|
|
navHint: '查看和管理任务规则配置',
|
2026-05-05 22:35:38 +08:00
|
|
|
icon: icons.skill,
|
2026-05-11 01:53:30 +00:00
|
|
|
title: '任务规则中心',
|
|
|
|
|
desc: '集中管理规则文件、外部 MCP 服务与定时任务调度。'
|
2026-05-06 11:00:38 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'employees',
|
|
|
|
|
label: '员工管理',
|
2026-05-06 22:23:42 +08:00
|
|
|
navHint: '维护员工与组织信息',
|
2026-05-06 11:00:38 +08:00
|
|
|
icon: icons.users,
|
2026-05-06 22:23:42 +08:00
|
|
|
title: '员工与组织管理',
|
|
|
|
|
desc: '维护员工账号、组织结构与角色权限。'
|
2026-05-07 15:55:23 +08:00
|
|
|
},
|
2026-05-22 23:47:28 +08:00
|
|
|
{
|
|
|
|
|
id: 'logs',
|
|
|
|
|
label: '日志管理',
|
|
|
|
|
navHint: '查看 Hermes 调用与系统运行日志',
|
|
|
|
|
icon: icons.logs,
|
|
|
|
|
title: '日志管理',
|
|
|
|
|
desc: '集中查看 Hermes 归纳任务进度、调用明细与系统运行日志。'
|
|
|
|
|
},
|
2026-05-07 15:55:23 +08:00
|
|
|
{
|
|
|
|
|
id: 'settings',
|
|
|
|
|
label: '系统设置',
|
|
|
|
|
navHint: '维护企业品牌、管理员安全与系统配置',
|
|
|
|
|
icon: icons.settings,
|
|
|
|
|
title: '系统设置中心',
|
|
|
|
|
desc: '集中配置公司名称、管理员账号安全、模型接入、日志策略与邮箱通知。'
|
2026-04-29 23:35:56 +08:00
|
|
|
}
|
feat: refactor monolithic App.vue into modular Vue component architecture
- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
2026-04-28 17:20:52 +08:00
|
|
|
]
|
|
|
|
|
|
2026-05-06 22:23:42 +08:00
|
|
|
const viewRouteNames = {
|
|
|
|
|
overview: 'app-overview',
|
|
|
|
|
workbench: 'app-workbench',
|
2026-05-24 21:44:17 +08:00
|
|
|
documents: 'app-documents',
|
2026-05-06 22:23:42 +08:00
|
|
|
requests: 'app-requests',
|
|
|
|
|
approval: 'app-approval',
|
2026-05-22 16:00:19 +08:00
|
|
|
archive: 'app-archive',
|
2026-05-06 22:23:42 +08:00
|
|
|
policies: 'app-policies',
|
|
|
|
|
audit: 'app-audit',
|
2026-05-15 09:36:32 +00:00
|
|
|
logs: 'app-logs',
|
2026-05-07 15:55:23 +08:00
|
|
|
employees: 'app-employees',
|
|
|
|
|
settings: 'app-settings'
|
2026-05-06 22:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-22 23:47:28 +08:00
|
|
|
const routeNameViews = Object.fromEntries(
|
|
|
|
|
Object.entries(viewRouteNames).map(([view, routeName]) => [routeName, view])
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
routeNameViews['app-request-detail'] = 'requests'
|
2026-05-24 21:44:17 +08:00
|
|
|
routeNameViews['app-document-detail'] = 'documents'
|
2026-05-22 23:47:28 +08:00
|
|
|
routeNameViews['app-log-detail'] = 'logs'
|
|
|
|
|
|
|
|
|
|
export function resolveAppViewFromRoute(route) {
|
|
|
|
|
const routeName = String(route?.name || '').trim()
|
|
|
|
|
if (routeNameViews[routeName]) {
|
|
|
|
|
return routeNameViews[routeName]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const metaView = String(route?.meta?.appView || '').trim()
|
|
|
|
|
return appViews.includes(metaView) ? metaView : 'overview'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function resolveTargetRouteName(view) {
|
|
|
|
|
return viewRouteNames[view] || viewRouteNames.overview
|
|
|
|
|
}
|
|
|
|
|
|
feat: refactor monolithic App.vue into modular Vue component architecture
- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
2026-04-28 17:20:52 +08:00
|
|
|
export function useNavigation() {
|
2026-05-06 22:23:42 +08:00
|
|
|
const route = useRoute()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
const activeView = computed({
|
|
|
|
|
get() {
|
2026-05-22 23:47:28 +08:00
|
|
|
return resolveAppViewFromRoute(route)
|
2026-05-06 22:23:42 +08:00
|
|
|
},
|
|
|
|
|
set(view) {
|
|
|
|
|
setView(view)
|
|
|
|
|
}
|
|
|
|
|
})
|
feat: refactor monolithic App.vue into modular Vue component architecture
- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
2026-04-28 17:20:52 +08:00
|
|
|
|
|
|
|
|
const currentView = computed(
|
|
|
|
|
() => navItems.find((item) => item.id === activeView.value) ?? navItems[0]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
function setView(view) {
|
2026-05-22 23:47:28 +08:00
|
|
|
const targetName = resolveTargetRouteName(view)
|
2026-05-06 22:23:42 +08:00
|
|
|
|
|
|
|
|
if (route.name === targetName) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-22 23:47:28 +08:00
|
|
|
router.push({ name: targetName, params: {}, query: {}, hash: '' })
|
feat: refactor monolithic App.vue into modular Vue component architecture
- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
2026-04-28 17:20:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { activeView, currentView, setView, navItems }
|
|
|
|
|
}
|