78ff060420
- 模板 art-design-pro(MIT)GitHub 直连克隆后裁剪落地 admin/:删除演示页面/示例数据/mock/未用组件,保留构建与依赖清单 - 品牌化:应用名/标题/侧栏与登录页 logo/浏览器 favicon 全部替换为 all-kefu 自有资源(static/kefu-small.png),中文界面 - 八页骨架:login / force-change-password / dashboard / tenants / conversations / config / stats / settings 占位页 + 6 组路由模块 - 权限菜单:meta.roles 前端过滤,super 全量,tenant 隐藏 租户管理/平台设置(角色值与后端一致) - 开发代理:/api 直转 + /api/public 与 /static 携带租户 Host 改写(VITE_TENANT_PREVIEW_HOST),适配后端 TenantHostMiddleware - 认证 API 为开发桩(角色调试开关),Task 3 对接真实登录 Co-Authored-By: Claude Code <noreply@anthropic.com>
68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
/**
|
|
* 工作标签页管理模块
|
|
*
|
|
* 提供工作标签页(Worktab)的自动管理功能
|
|
*
|
|
* ## 主要功能
|
|
*
|
|
* - 根据路由导航自动创建和更新工作标签页
|
|
* - iframe 页面标签页特殊处理
|
|
* - 标签页信息提取(标题、路径、缓存状态等)
|
|
* - 固定标签页支持
|
|
* - 根据系统设置控制标签页显示
|
|
* - 首页标签页特殊处理
|
|
*
|
|
* ## 使用场景
|
|
*
|
|
* - 路由守卫中自动创建标签页
|
|
* - 页面切换时更新标签页状态
|
|
* - 多标签页导航系统
|
|
*
|
|
* @module utils/navigation/worktab
|
|
* @author Art Design Pro Team
|
|
*/
|
|
import { useWorktabStore } from '@/store/modules/worktab'
|
|
import { RouteLocationNormalized } from 'vue-router'
|
|
import { isIframe } from './route'
|
|
import { useSettingStore } from '@/store/modules/setting'
|
|
import { IframeRouteManager } from '@/router/core'
|
|
import { useCommon } from '@/hooks/core/useCommon'
|
|
|
|
/**
|
|
* 根据当前路由信息设置工作标签页(worktab)
|
|
* @param to 当前路由对象
|
|
*/
|
|
export const setWorktab = (to: RouteLocationNormalized): void => {
|
|
const worktabStore = useWorktabStore()
|
|
const { meta, path, name, params, query } = to
|
|
if (!meta.isHideTab) {
|
|
// 如果是 iframe 页面,则特殊处理工作标签页
|
|
if (isIframe(path)) {
|
|
const iframeRoute = IframeRouteManager.getInstance().findByPath(to.path)
|
|
|
|
if (iframeRoute?.meta) {
|
|
worktabStore.openTab({
|
|
title: iframeRoute.meta.title,
|
|
icon: meta.icon as string,
|
|
path,
|
|
name: name as string,
|
|
keepAlive: meta.keepAlive as boolean,
|
|
params,
|
|
query
|
|
})
|
|
}
|
|
} else if (useSettingStore().showWorkTab || path === useCommon().homePath.value) {
|
|
worktabStore.openTab({
|
|
title: meta.title as string,
|
|
icon: meta.icon as string,
|
|
path,
|
|
name: name as string,
|
|
keepAlive: meta.keepAlive as boolean,
|
|
params,
|
|
query,
|
|
fixedTab: meta.fixedTab as boolean
|
|
})
|
|
}
|
|
}
|
|
}
|