后端优化 agent 资产种子初始化和常量配置,前端新增数字员工 视图和调度对话框组件,重构个人工作台首页布局和洞察面板, 完善审计页面数字员工详情和运行时模型,优化侧边栏导航和图 标配置,新增工作台摘要和工作台数据模块,补充单元测试。
166 lines
4.3 KiB
JavaScript
166 lines
4.3 KiB
JavaScript
import { computed } from 'vue'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
import { icons } from '../data/icons.js'
|
|
|
|
export const appViews = [
|
|
'overview',
|
|
'workbench',
|
|
'documents',
|
|
'budget',
|
|
'audit',
|
|
'digitalEmployees',
|
|
'employees',
|
|
'policies',
|
|
'logs',
|
|
'settings'
|
|
]
|
|
|
|
export const navItems = [
|
|
{
|
|
id: 'overview',
|
|
label: '总览',
|
|
navHint: '查看系统总览与关键指标',
|
|
icon: icons.dashboard,
|
|
title: '财务运营总览',
|
|
desc: '聚合差旅申请、审批效率、风险信号与 SLA 表现。'
|
|
},
|
|
{
|
|
id: 'workbench',
|
|
label: '个人工作台',
|
|
navHint: '集中处理个人待办',
|
|
icon: icons.briefcase,
|
|
title: '个人工作台',
|
|
desc: '聚焦当前待办、快捷操作与助手入口。'
|
|
},
|
|
{
|
|
id: 'documents',
|
|
label: '单据中心',
|
|
navHint: '统一查看申请、报销、审批与归档',
|
|
icon: icons.file,
|
|
title: '单据中心',
|
|
desc: '统一查看申请、报销、审批与归档。'
|
|
},
|
|
{
|
|
id: 'budget',
|
|
label: '预算中心',
|
|
navHint: '管理预算额度、预算占用与超预算预警',
|
|
icon: icons.budget,
|
|
title: '预算中心',
|
|
desc: '配置部门、项目及费用类型预算,跟踪申请占用、报销核销与超预算预警。'
|
|
},
|
|
{
|
|
id: 'audit',
|
|
label: '规则中心',
|
|
navHint: '查看和管理规则配置',
|
|
icon: icons.skill,
|
|
title: '规则中心',
|
|
desc: '集中管理财务规则、风险规则与外部 MCP 服务。'
|
|
},
|
|
{
|
|
id: 'digitalEmployees',
|
|
label: '数字员工',
|
|
navHint: '查看和管理后台自动执行的技能',
|
|
icon: icons.digitalEmployee,
|
|
title: '数字员工',
|
|
desc: '集中查看后台自动执行的技能、执行计划和运行状态。'
|
|
},
|
|
{
|
|
id: 'employees',
|
|
label: '员工管理',
|
|
navHint: '维护员工与组织信息',
|
|
icon: icons.users,
|
|
title: '员工与组织管理',
|
|
desc: '维护员工账号、组织结构与角色权限。'
|
|
},
|
|
{
|
|
id: 'policies',
|
|
label: '制度知识',
|
|
navHint: '查看制度与知识库',
|
|
icon: icons.library,
|
|
title: '制度与知识库',
|
|
desc: '统一管理制度文档、检索入口与知识资产。'
|
|
},
|
|
{
|
|
id: 'logs',
|
|
label: '日志管理',
|
|
navHint: '查看 Hermes 调用与系统运行日志',
|
|
icon: icons.logs,
|
|
title: '日志管理',
|
|
desc: '集中查看 Hermes 归纳任务进度、调用明细与系统运行日志。'
|
|
},
|
|
{
|
|
id: 'settings',
|
|
label: '系统设置',
|
|
navHint: '维护企业品牌、管理员安全与系统配置',
|
|
icon: icons.settings,
|
|
title: '系统设置中心',
|
|
desc: '集中配置公司名称、管理员账号安全、模型接入、日志策略与邮箱通知。'
|
|
}
|
|
]
|
|
|
|
const viewRouteNames = {
|
|
overview: 'app-overview',
|
|
workbench: 'app-workbench',
|
|
documents: 'app-documents',
|
|
budget: 'app-budget',
|
|
policies: 'app-policies',
|
|
audit: 'app-audit',
|
|
digitalEmployees: 'app-digitalEmployees',
|
|
logs: 'app-logs',
|
|
employees: 'app-employees',
|
|
settings: 'app-settings'
|
|
}
|
|
|
|
const routeNameViews = Object.fromEntries(
|
|
Object.entries(viewRouteNames).map(([view, routeName]) => [routeName, view])
|
|
)
|
|
|
|
routeNameViews['app-request-detail'] = 'documents'
|
|
routeNameViews['app-document-detail'] = 'documents'
|
|
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
|
|
}
|
|
|
|
export function useNavigation() {
|
|
const route = useRoute()
|
|
const router = useRouter()
|
|
|
|
const activeView = computed({
|
|
get() {
|
|
return resolveAppViewFromRoute(route)
|
|
},
|
|
set(view) {
|
|
setView(view)
|
|
}
|
|
})
|
|
|
|
const currentView = computed(
|
|
() => navItems.find((item) => item.id === activeView.value) ?? navItems[0]
|
|
)
|
|
|
|
function setView(view) {
|
|
const targetName = resolveTargetRouteName(view)
|
|
|
|
if (route.name === targetName) {
|
|
return
|
|
}
|
|
|
|
router.push({ name: targetName, params: {}, query: {}, hash: '' })
|
|
}
|
|
|
|
return { activeView, currentView, setView, navItems }
|
|
}
|