You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

259 lines
7.5 KiB
Plaintext

import { createBrowserRouter } from 'react-router-dom'
import { Suspense, lazy } from 'react'
import Login from '../pages/Login'
import WorkFlowList from '../pages/WorkFlowList'
import Home from '../pages/Home'
import {
UserOutlined,
AppstoreOutlined,
SendOutlined,
BellOutlined,
FieldTimeOutlined,
CheckCircleOutlined,
EditOutlined,
SwitcherOutlined,
SearchOutlined,
FormOutlined,
ApiOutlined,
UnorderedListOutlined,
ApartmentOutlined,
BarsOutlined,
} from '@ant-design/icons';
import { Spin } from 'antd'
import Error404 from '../pages/error/Error404'
import TodoList from '../pages/workflow/TodoList'
const PrivateRoute = () => {
return (
<>
</>
)
}
export const menuRoutes = [
{
path: '/wf',
key: 'workflow',
icon: <AppstoreOutlined />,
label: '基础功能',
meta: {
icon: <AppstoreOutlined />,
label: '基础功能',
},
element: <Home />,
redirect: '/wf/todo',
children: [{
path: 'start',
key: '/wf/start',
icon: <SendOutlined />,
label: '发起',
meta: {
icon: <SendOutlined />,
label: '发起',
},
async lazy() {
const Start = (await import('../pages/workflow/Start')).default
return { Component: Start }
}
}, {
indexed: true,
path: 'todo',
key: '/wf/todo',
icon: <BellOutlined />,
label: '待办',
meta: {
icon: <BellOutlined />,
label: '待办',
},
element: <TodoList />
},
// {
// path: 'running',
// key: 'wfRunning',
// meta: {
// icon: <FieldTimeOutlined />,
// label: '在途',
// },
// component: () => import('@/views/workflow/Running.vue')
// }, {
// path: 'completed',
// key: 'wfCompleted',
// meta: {
// icon: <CheckCircleOutlined />,
// label: '已完成',
// },
// component: () => import('@/views/workflow/Completed.vue')
// }, {
// path: 'query',
// key: 'wfQuery',
// meta: {
// icon: <SearchOutlined />,
// label: '查询',
// scop: '2',
// },
// component: () => import('@/views/workflow/IntegratedQuery.vue')
// }, {
// path: 'draft',
// key: 'wfDraft',
// meta: {
// icon: <FormOutlined />,
// label: '草稿',
// },
// component: () => import('@/views/workflow/Draft.vue')
// }, {
// path: 'cc',
// key: 'wfCC',
// meta: {
// icon: <EditOutlined />,
// label: '抄送',
// },
// component: () => import('@/views/workflow/Send.vue')
// }, {
// path: 'batch',
// key: 'wfBatch',
// meta: {
// icon: <SwitcherOutlined />,
// label: '批处理',
// },
// component: () => import('@/views/workflow/Batch.vue')
// }
]
},
{
path: '/query',
key: 'query',
icon: <SearchOutlined />,
label: '流程查询',
meta: {
icon: <SearchOutlined />,
label: '流程查询',
},
element: <Home />,
redirect: '/query/start',
children: [
{
path: 'start',
key: '/query/start',
icon: <SendOutlined />,
label: '我发起的',
scop: '1',//查询范围
meta: {
icon: <SendOutlined />,
label: '我发起的',
scop: '1',//查询范围
},
async lazy() {
const IntegratedQuery = (await import('../pages/workflow/IntegratedQuery')).default
return { Component: IntegratedQuery }
}
}, {
path: 'participation',
key: '/query/participation',
icon: <UserOutlined />,
label: '我参与的',
scop: '0',//查询范围
meta: {
icon: <UserOutlined />,
label: '我参与的',
scop: '0',//查询范围
},
async lazy() {
const IntegratedQuery = (await import('../pages/workflow/IntegratedQuery')).default
return { Component: IntegratedQuery }
}
}
]
},
{
path: '/functionCall',
key: 'functionCall',
icon: <ApiOutlined />,
label: 'API列表',
meta: {
icon: <AppstoreOutlined />,
label: '功能调用',
},
element: <Home />,
redirect: '/functionCall/FlowTree',
children: [
{
path: 'FlowTree',
key: '/functionCall/FlowTree',
icon: <ApartmentOutlined />,
label: '流程设计',
meta: {
icon: <ApartmentOutlined />,
label: '流程设计',
},
async lazy() {
const CallPort = (await import('../pages/functionCall/CallPort')).default
return { Component: CallPort }
}
}, {
path: 'FormTree',
key: '/functionCall/FormTree',
icon: <BarsOutlined />,
label: '表单设计',
meta: {
icon: <BarsOutlined />,
label: '表单设计',
},
async lazy() {
const CallPort = (await import('../pages/functionCall/CallPort')).default
return { Component: CallPort }
}
}
]
},
{
path: '/apis',
key: "Apis",
icon: <ApiOutlined />,
label: 'API列表',
meta: {
icon: <ApiOutlined />,
label: 'API列表',
},
redirect: '/apis/list',
element: <Home />,
children: [
{
path: 'list',
key: '/apis/list',
icon: <UnorderedListOutlined />,
label: '工具包接口',
meta: {
icon: <UnorderedListOutlined />,
label: '工具包接口',
},
async lazy() {
const List = (await import('../pages/api/List')).default
return { Component: List }
}
}
]
},
]
const staticRoutes = [
{
path: "/",
name: 'HomeRedirect',
exact: true,
errorElement: <Error404 />,
redirect: '/wf/todo'
},
{
path: '/login',
key: 'login',
element: <Login />
},
]
const routes = [...menuRoutes, ...staticRoutes]
export const router = createBrowserRouter(routes)