This commit is contained in:
dap 2025-02-05 19:41:33 +08:00
parent ba3fc0fe10
commit b8ed931eb6
3 changed files with 26 additions and 13 deletions

View File

@ -3,6 +3,7 @@ import type { RouteRecordRaw } from 'vue-router';
import { mergeRouteModules, traverseTreeValues } from '@vben/utils'; import { mergeRouteModules, traverseTreeValues } from '@vben/utils';
import { coreRoutes, fallbackNotFoundRoute } from './core'; import { coreRoutes, fallbackNotFoundRoute } from './core';
import { workflowIframeRoutes } from './workflow-iframe';
const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', { const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', {
eager: true, eager: true,
@ -26,11 +27,14 @@ const externalRoutes: RouteRecordRaw[] = [];
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
...coreRoutes, ...coreRoutes,
...externalRoutes, ...externalRoutes,
...workflowIframeRoutes,
fallbackNotFoundRoute, fallbackNotFoundRoute,
]; ];
/** 基本路由(登录, 第三方登录, 注册等) + workflowIframe路由不需要拦截 */
const basicRoutes = [...coreRoutes, ...workflowIframeRoutes];
/** 基本路由列表,这些路由不需要进入权限拦截 */ /** 基本路由列表,这些路由不需要进入权限拦截 */
const coreRouteNames = traverseTreeValues(coreRoutes, (route) => route.name); const coreRouteNames = traverseTreeValues(basicRoutes, (route) => route.name);
/** 有权限校验的路由列表,包含动态路由和静态路由 */ /** 有权限校验的路由列表,包含动态路由和静态路由 */
const accessRoutes = [...dynamicRoutes, ...staticRoutes]; const accessRoutes = [...dynamicRoutes, ...staticRoutes];

View File

@ -60,6 +60,9 @@ const localRoutes: RouteRecordStringComponent[] = [
name: 'WorkflowDesigner', name: 'WorkflowDesigner',
path: '/workflow/designer', path: '/workflow/designer',
}, },
/**
* iframe路由 ./workflow-iframe.ts
*/
{ {
component: 'workflow/leave/leave-form', component: 'workflow/leave/leave-form',
meta: { meta: {
@ -71,18 +74,6 @@ const localRoutes: RouteRecordStringComponent[] = [
name: 'WorkflowLeaveIndex', name: 'WorkflowLeaveIndex',
path: '/workflow/leaveEdit/index', path: '/workflow/leaveEdit/index',
}, },
// 这里是iframe使用的 去掉外层的BasicLayout
{
component: 'workflow/leave/leave-form',
meta: {
title: '请假申请',
hideInMenu: true,
// 不使用基础布局(仅在顶级生效)
noBasicLayout: true,
},
name: 'WorkflowLeaveInner',
path: '/workflow/leaveEdit/index/iframe',
},
]; ];
/** /**

View File

@ -0,0 +1,18 @@
import type { RouteRecordRaw } from '@vben/types';
/**
* workflow表单的iframe内嵌路由
* 😅
*/
export const workflowIframeRoutes: RouteRecordRaw[] = [
// 这里是iframe使用的 去掉外层的BasicLayout
{
name: 'WorkflowLeaveInner',
path: '/workflow/leaveEdit/index/iframe',
component: () => import('#/views/workflow/leave/leave-form.vue'),
meta: {
hideInTab: true,
title: '请假申请',
},
},
];