gohttpdUi/mock/role/index.mock.ts

1199 lines
28 KiB
TypeScript
Raw Normal View History

2023-11-29 16:14:48 +08:00
import { faker } from '@faker-js/faker'
import { SUCCESS_CODE } from '@/constants'
2023-08-05 20:34:55 +08:00
import { toAnyString } from '@/utils'
2022-02-19 20:34:44 +08:00
2023-12-10 10:11:14 +08:00
const timeout = 1000
2022-02-19 20:34:44 +08:00
const adminList = [
{
path: '/dashboard',
component: '#',
redirect: '/dashboard/analysis',
name: 'Dashboard',
meta: {
title: 'router.dashboard',
icon: 'ant-design:dashboard-filled',
alwaysShow: true
},
children: [
{
path: 'analysis',
component: 'views/Dashboard/Analysis',
name: 'Analysis',
meta: {
title: 'router.analysis',
2023-11-29 21:09:37 +08:00
noCache: true,
affix: true
2022-02-19 20:34:44 +08:00
}
},
{
path: 'workplace',
component: 'views/Dashboard/Workplace',
name: 'Workplace',
meta: {
title: 'router.workplace',
2023-11-29 21:09:37 +08:00
noCache: true,
affix: true
2022-02-19 20:34:44 +08:00
}
}
]
},
{
path: '/external-link',
component: '#',
meta: {},
name: 'ExternalLink',
children: [
{
path: 'https://element-plus-admin-doc.cn/',
name: 'DocumentLink',
meta: {
title: 'router.document',
icon: 'clarity:document-solid'
}
}
]
},
2022-02-19 20:34:44 +08:00
{
path: '/guide',
component: '#',
name: 'Guide',
meta: {},
children: [
{
path: 'index',
component: 'views/Guide/Guide',
name: 'GuideDemo',
meta: {
title: 'router.guide',
icon: 'cib:telegram-plane'
}
}
]
},
{
path: '/components',
component: '#',
2022-08-20 10:22:58 +08:00
redirect: '/components/form/default-form',
2022-02-19 20:34:44 +08:00
name: 'ComponentsDemo',
meta: {
title: 'router.component',
icon: 'bx:bxs-component',
alwaysShow: true
},
children: [
{
path: 'form',
component: '##',
name: 'Form',
meta: {
title: 'router.form',
alwaysShow: true
},
children: [
{
path: 'default-form',
component: 'views/Components/Form/DefaultForm',
name: 'DefaultForm',
meta: {
title: 'router.defaultForm'
}
},
{
path: 'use-form',
component: 'views/Components/Form/UseFormDemo',
name: 'UseForm',
meta: {
title: 'UseForm'
}
}
]
},
{
path: 'table',
component: '##',
2022-08-20 10:22:58 +08:00
redirect: '/components/table/default-table',
2022-02-19 20:34:44 +08:00
name: 'TableDemo',
meta: {
title: 'router.table',
alwaysShow: true
},
children: [
{
path: 'default-table',
component: 'views/Components/Table/DefaultTable',
name: 'DefaultTable',
meta: {
title: 'router.defaultTable'
}
},
{
path: 'use-table',
component: 'views/Components/Table/UseTableDemo',
name: 'UseTable',
meta: {
title: 'UseTable'
}
},
2023-07-10 17:46:15 +08:00
{
path: 'tree-table',
component: 'views/Components/Table/TreeTable',
name: 'TreeTable',
meta: {
2023-08-06 09:45:13 +08:00
title: 'TreeTable'
2023-07-20 16:37:18 +08:00
}
},
{
path: 'table-image-preview',
component: 'views/Components/Table/TableImagePreview',
name: 'TableImagePreview',
meta: {
title: 'router.PicturePreview'
2023-07-10 17:46:15 +08:00
}
2023-11-19 16:14:36 +08:00
},
{
path: 'table-video-preview',
component: 'views/Components/Table/TableVideoPreview',
name: 'TableVideoPreview',
meta: {
title: 'router.tableVideoPreview'
}
2023-12-07 14:20:11 +08:00
},
{
path: 'card-table',
component: 'views/Components/Table/CardTable',
name: 'CardTable',
meta: {
title: 'router.cardTable'
}
2022-02-19 20:34:44 +08:00
}
2023-08-06 09:45:13 +08:00
// {
// path: 'ref-table',
// component: 'views/Components/Table/RefTable',
// name: 'RefTable',
// meta: {
// title: 'RefTable'
// }
// }
2022-02-19 20:34:44 +08:00
]
},
{
path: 'editor-demo',
component: '##',
2022-08-20 10:22:58 +08:00
redirect: '/components/editor-demo/editor',
2022-02-19 20:34:44 +08:00
name: 'EditorDemo',
meta: {
title: 'router.editor',
alwaysShow: true
},
children: [
{
path: 'editor',
component: 'views/Components/Editor/Editor',
name: 'Editor',
meta: {
title: 'router.richText'
}
2023-08-26 10:10:49 +08:00
},
{
path: 'json-editor',
component: 'views/Components/Editor/JsonEditor',
name: 'JsonEditor',
meta: {
title: 'router.jsonEditor'
}
2022-02-19 20:34:44 +08:00
}
]
},
{
path: 'search',
component: 'views/Components/Search',
name: 'Search',
meta: {
title: 'router.search'
}
},
{
path: 'descriptions',
component: 'views/Components/Descriptions',
name: 'Descriptions',
meta: {
title: 'router.descriptions'
}
},
{
path: 'image-viewer',
component: 'views/Components/ImageViewer',
name: 'ImageViewer',
meta: {
title: 'router.imageViewer'
}
},
{
path: 'dialog',
component: 'views/Components/Dialog',
name: 'Dialog',
meta: {
title: 'router.dialog'
}
},
{
path: 'icon',
component: 'views/Components/Icon',
name: 'Icon',
meta: {
title: 'router.icon'
}
},
2023-09-22 14:33:59 +08:00
{
path: 'icon-picker',
component: 'views/Components/IconPicker',
name: 'IconPicker',
meta: {
title: 'router.iconPicker'
}
},
2022-02-19 20:34:44 +08:00
{
path: 'echart',
component: 'views/Components/Echart',
name: 'Echart',
meta: {
title: 'router.echart'
}
},
{
path: 'count-to',
component: 'views/Components/CountTo',
name: 'CountTo',
meta: {
title: 'router.countTo'
}
},
{
path: 'qrcode',
component: 'views/Components/Qrcode',
name: 'Qrcode',
meta: {
title: 'router.qrcode'
}
},
{
path: 'highlight',
component: 'views/Components/Highlight',
name: 'Highlight',
meta: {
title: 'router.highlight'
}
},
{
path: 'infotip',
component: 'views/Components/Infotip',
name: 'Infotip',
meta: {
title: 'router.infotip'
}
2022-03-27 08:45:16 +08:00
},
{
path: 'input-password',
component: 'views/Components/InputPassword',
name: 'InputPassword',
meta: {
title: 'router.inputPassword'
}
2023-09-27 17:55:12 +08:00
},
{
path: 'waterfall',
component: 'views/Components/Waterfall',
name: 'Waterfall',
meta: {
title: 'router.waterfall'
}
2023-11-14 17:59:44 +08:00
},
{
path: 'image-cropping',
component: 'views/Components/ImageCropping',
name: 'ImageCropping',
meta: {
title: 'router.imageCropping'
}
2023-11-19 10:59:00 +08:00
},
{
path: 'video-player',
component: 'views/Components/VideoPlayer',
name: 'VideoPlayer',
meta: {
title: 'router.videoPlayer'
}
2022-02-19 20:34:44 +08:00
}
]
},
2023-08-12 09:47:13 +08:00
{
path: '/function',
component: '#',
redirect: '/function/multipleTabs',
name: 'Function',
meta: {
title: 'router.function',
icon: 'ri:function-fill',
alwaysShow: true
},
children: [
{
path: 'multipleTabs',
component: 'views/Function/MultipleTabs',
name: 'MultipleTabs',
meta: {
title: 'router.multipleTabs'
}
},
{
path: 'multiple-tabs-demo/:id',
2023-08-12 09:47:13 +08:00
component: 'views/Function/MultipleTabsDemo',
name: 'MultipleTabsDemo',
meta: {
hidden: true,
title: 'router.details',
canTo: true
}
2023-09-27 15:13:43 +08:00
},
{
path: 'request',
component: 'views/Function/Request',
name: 'Request',
meta: {
title: 'router.request'
}
2023-10-14 10:43:04 +08:00
},
{
path: 'test',
2023-11-29 21:09:37 +08:00
component: 'views/Function/Test',
2023-10-14 10:43:04 +08:00
name: 'Test',
meta: {
title: 'router.permission',
permission: ['add', 'edit', 'delete']
}
2023-08-12 09:47:13 +08:00
}
]
},
2022-03-26 10:08:13 +08:00
{
path: '/hooks',
component: '#',
redirect: '/hooks/useWatermark',
name: 'Hooks',
meta: {
title: 'hooks',
icon: 'ic:outline-webhook',
alwaysShow: true
},
children: [
{
path: 'useWatermark',
component: 'views/hooks/useWatermark',
name: 'UseWatermark',
meta: {
title: 'useWatermark'
}
2022-07-01 21:44:00 +08:00
},
{
2023-08-13 14:06:54 +08:00
path: 'useTagsView',
component: 'views/hooks/useTagsView',
name: 'UseTagsView',
2022-07-01 21:44:00 +08:00
meta: {
2023-08-13 14:06:54 +08:00
title: 'useTagsView'
2022-07-01 21:44:00 +08:00
}
2023-08-16 16:17:35 +08:00
},
{
path: 'useValidator',
component: 'views/hooks/useValidator',
name: 'UseValidator',
meta: {
title: 'useValidator'
}
2023-08-26 10:37:06 +08:00
},
{
path: 'useCrudSchemas',
component: 'views/hooks/useCrudSchemas',
name: 'UseCrudSchemas',
meta: {
title: 'useCrudSchemas'
}
2023-09-27 10:51:47 +08:00
},
{
path: 'useClipboard',
component: 'views/hooks/useClipboard',
name: 'UseClipboard',
meta: {
title: 'useClipboard'
}
2023-09-27 10:59:19 +08:00
},
{
path: 'useNetwork',
component: 'views/hooks/useNetwork',
name: 'UseNetwork',
meta: {
title: 'useNetwork'
}
2022-03-26 10:08:13 +08:00
}
]
},
2022-02-19 20:34:44 +08:00
{
path: '/level',
component: '#',
redirect: '/level/menu1/menu1-1/menu1-1-1',
name: 'Level',
meta: {
title: 'router.level',
icon: 'carbon:skill-level-advanced'
},
children: [
{
path: 'menu1',
name: 'Menu1',
component: '##',
redirect: '/level/menu1/menu1-1/menu1-1-1',
meta: {
title: 'router.menu1'
},
children: [
{
path: 'menu1-1',
name: 'Menu11',
component: '##',
redirect: '/level/menu1/menu1-1/menu1-1-1',
meta: {
title: 'router.menu11',
alwaysShow: true
},
children: [
{
path: 'menu1-1-1',
name: 'Menu111',
component: 'views/Level/Menu111',
meta: {
title: 'router.menu111'
}
}
]
},
{
path: 'menu1-2',
name: 'Menu12',
component: 'views/Level/Menu12',
meta: {
title: 'router.menu12'
}
}
]
},
{
path: 'menu2',
name: 'Menu2Demo',
component: 'views/Level/Menu2',
meta: {
title: 'router.menu2'
}
}
]
},
{
path: '/example',
component: '#',
redirect: '/example/example-dialog',
name: 'Example',
meta: {
title: 'router.example',
icon: 'ep:management',
alwaysShow: true
},
children: [
{
path: 'example-dialog',
component: 'views/Example/Dialog/ExampleDialog',
name: 'ExampleDialog',
meta: {
title: 'router.exampleDialog'
}
},
{
path: 'example-page',
component: 'views/Example/Page/ExamplePage',
name: 'ExamplePage',
meta: {
title: 'router.examplePage'
}
},
{
path: 'example-add',
component: 'views/Example/Page/ExampleAdd',
name: 'ExampleAdd',
meta: {
title: 'router.exampleAdd',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page'
}
},
{
path: 'example-edit',
component: 'views/Example/Page/ExampleEdit',
name: 'ExampleEdit',
meta: {
title: 'router.exampleEdit',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page'
}
},
{
path: 'example-detail',
component: 'views/Example/Page/ExampleDetail',
name: 'ExampleDetail',
meta: {
title: 'router.exampleDetail',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page'
}
}
]
},
{
path: '/error',
component: '#',
redirect: '/error/404',
name: 'Error',
meta: {
title: 'router.errorPage',
icon: 'ci:error',
alwaysShow: true
},
children: [
{
path: '404-demo',
component: 'views/Error/404',
name: '404Demo',
meta: {
title: '404'
}
},
{
path: '403-demo',
component: 'views/Error/403',
name: '403Demo',
meta: {
title: '403'
}
},
{
path: '500-demo',
component: 'views/Error/500',
name: '500Demo',
meta: {
title: '500'
}
}
]
2023-08-06 09:45:13 +08:00
},
{
path: '/authorization',
component: '#',
redirect: '/authorization/user',
name: 'Authorization',
meta: {
title: 'router.authorization',
icon: 'eos-icons:role-binding',
alwaysShow: true
},
children: [
{
path: 'department',
component: 'views/Authorization/Department/Department',
name: 'Department',
meta: {
title: 'router.department'
}
},
{
path: 'user',
component: 'views/Authorization/User/User',
name: 'User',
meta: {
title: 'router.user'
}
},
{
path: 'menu',
component: 'views/Authorization/Menu/Menu',
name: 'Menu',
meta: {
title: 'router.menuManagement'
}
},
{
path: 'role',
component: 'views/Authorization/Role/Role',
name: 'Role',
meta: {
title: 'router.role'
}
}
]
2022-02-19 20:34:44 +08:00
}
]
const testList: string[] = [
'/dashboard',
'/dashboard/analysis',
'/dashboard/workplace',
'external-link',
'https://element-plus-admin-doc.cn/',
2022-02-19 20:34:44 +08:00
'/guide',
'/guide/index',
'/components',
'/components/form',
'/components/form/default-form',
'/components/form/use-form',
'/components/form/ref-form',
'/components/table',
'/components/table/default-table',
'/components/table/use-table',
2023-07-10 17:46:15 +08:00
'/components/table/tree-table',
2023-07-20 16:37:18 +08:00
'/components/table/table-image-preview',
2023-11-19 16:14:36 +08:00
'/components/table/table-video-preview',
2022-02-19 20:34:44 +08:00
'/components/table/ref-table',
2023-12-07 14:20:11 +08:00
'/components/table/card-table',
2022-02-19 20:34:44 +08:00
'/components/editor-demo',
'/components/editor-demo/editor',
2023-08-26 10:10:49 +08:00
'/components/editor-demo/json-editor',
2022-02-19 20:34:44 +08:00
'/components/search',
'/components/descriptions',
'/components/image-viewer',
'/components/dialog',
'/components/icon',
2023-09-22 14:33:59 +08:00
'/components/iconPicker',
2022-02-19 20:34:44 +08:00
'/components/echart',
'/components/count-to',
'/components/qrcode',
'/components/highlight',
'/components/infotip',
2023-09-27 17:55:12 +08:00
'/components/input-password',
'/components/waterfall',
2023-11-14 17:59:44 +08:00
'/components/image-cropping',
2023-11-19 10:59:00 +08:00
'/components/video-player',
2023-08-12 09:47:13 +08:00
'function',
'/function/multiple-tabs',
'/function/multiple-tabs-demo/:id',
2023-09-27 15:13:43 +08:00
'/function/request',
2023-10-14 10:43:04 +08:00
'/function/test',
2022-03-26 10:08:13 +08:00
'/hooks',
'/hooks/useWatermark',
2023-08-13 14:06:54 +08:00
'/hooks/useTagsView',
2023-08-16 16:17:35 +08:00
'/hooks/useValidator',
2023-08-26 10:37:06 +08:00
'/hooks/useCrudSchemas',
2023-09-27 10:51:47 +08:00
'/hooks/useClipboard',
2023-09-27 10:59:19 +08:00
'/hooks/useNetwork',
2022-02-19 20:34:44 +08:00
'/level',
'/level/menu1',
'/level/menu1/menu1-1',
'/level/menu1/menu1-1/menu1-1-1',
'/level/menu1/menu1-2',
'/level/menu2',
'/example',
'/example/example-dialog',
'/example/example-page',
'/example/example-add',
'/example/example-edit',
'/example/example-detail',
2023-08-06 09:45:13 +08:00
'/authorization',
'/authorization/department',
'/authorization/user',
'/authorization/role',
'/authorization/menu',
2022-02-19 20:34:44 +08:00
'/error',
'/error/404-demo',
'/error/403-demo',
'/error/500-demo'
]
2023-08-05 20:34:55 +08:00
const List: any[] = []
2023-08-06 08:27:40 +08:00
const roleNames = ['超级管理员', '管理员', '普通用户', '游客']
const menus = [
[
{
path: '/dashboard',
component: '#',
redirect: '/dashboard/analysis',
name: 'Dashboard',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 1,
meta: {
title: '首页',
icon: 'ant-design:dashboard-filled',
alwaysShow: true
},
children: [
{
path: 'analysis',
component: 'views/Dashboard/Analysis',
name: 'Analysis',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 2,
meta: {
title: '分析页',
noCache: true
}
},
{
path: 'workplace',
component: 'views/Dashboard/Workplace',
name: 'Workplace',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 3,
meta: {
title: '工作台',
noCache: true
}
}
]
},
{
path: '/external-link',
component: '#',
meta: {
title: '文档',
icon: 'clarity:document-solid'
},
name: 'ExternalLink',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 4,
children: [
{
path: 'https://element-plus-admin-doc.cn/',
name: 'DocumentLink',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 5,
meta: {
title: '文档'
}
}
]
},
{
path: '/level',
component: '#',
redirect: '/level/menu1/menu1-1/menu1-1-1',
name: 'Level',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 6,
meta: {
title: '菜单',
icon: 'carbon:skill-level-advanced'
},
children: [
{
path: 'menu1',
name: 'Menu1',
component: '##',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 7,
redirect: '/level/menu1/menu1-1/menu1-1-1',
meta: {
title: '菜单1'
},
children: [
{
path: 'menu1-1',
name: 'Menu11',
component: '##',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 8,
redirect: '/level/menu1/menu1-1/menu1-1-1',
meta: {
title: '菜单1-1',
alwaysShow: true
},
children: [
{
path: 'menu1-1-1',
name: 'Menu111',
component: 'views/Level/Menu111',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 9,
permission: ['edit', 'add', 'delete'],
meta: {
title: '菜单1-1-1',
permission: ['edit', 'add', 'delete']
}
}
]
},
{
path: 'menu1-2',
name: 'Menu12',
component: 'views/Level/Menu12',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 10,
permission: ['edit', 'add', 'delete'],
meta: {
title: '菜单1-2',
permission: ['edit', 'add', 'delete']
}
}
]
},
{
path: 'menu2',
name: 'Menu2Demo',
component: 'views/Level/Menu2',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 11,
permission: ['edit', 'add', 'delete'],
meta: {
title: '菜单2',
permission: ['edit', 'add', 'delete']
}
}
]
},
{
path: '/example',
component: '#',
redirect: '/example/example-dialog',
name: 'Example',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 12,
meta: {
title: '综合示例',
icon: 'ep:management',
alwaysShow: true
},
children: [
{
path: 'example-dialog',
component: 'views/Example/Dialog/ExampleDialog',
name: 'ExampleDialog',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 13,
permission: ['edit', 'add', 'delete'],
meta: {
title: '综合示例-弹窗',
permission: ['edit', 'add', 'delete']
}
},
{
path: 'example-page',
component: 'views/Example/Page/ExamplePage',
name: 'ExamplePage',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 14,
permission: ['edit', 'add', 'delete'],
meta: {
title: '综合示例-页面',
permission: ['edit', 'add', 'delete']
}
},
{
path: 'example-add',
component: 'views/Example/Page/ExampleAdd',
name: 'ExampleAdd',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 15,
permission: ['edit', 'add', 'delete'],
meta: {
title: '综合示例-新增',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page',
permission: ['edit', 'add', 'delete']
}
},
{
path: 'example-edit',
component: 'views/Example/Page/ExampleEdit',
name: 'ExampleEdit',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 16,
permission: ['edit', 'add', 'delete'],
meta: {
title: '综合示例-编辑',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page',
permission: ['edit', 'add', 'delete']
}
},
{
path: 'example-detail',
component: 'views/Example/Page/ExampleDetail',
name: 'ExampleDetail',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 17,
permission: ['edit', 'add', 'delete'],
meta: {
title: '综合示例-详情',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page',
permission: ['edit', 'add', 'delete']
}
}
]
}
],
[
{
path: '/dashboard',
component: '#',
redirect: '/dashboard/analysis',
name: 'Dashboard',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 1,
meta: {
title: '首页',
icon: 'ant-design:dashboard-filled',
alwaysShow: true
},
children: [
{
path: 'analysis',
component: 'views/Dashboard/Analysis',
name: 'Analysis',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 2,
meta: {
title: '分析页',
noCache: true
}
},
{
path: 'workplace',
component: 'views/Dashboard/Workplace',
name: 'Workplace',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 3,
meta: {
title: '工作台',
noCache: true
}
}
]
}
],
[
{
path: '/external-link',
component: '#',
meta: {
title: '文档',
icon: 'clarity:document-solid'
},
name: 'ExternalLink',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 4,
children: [
{
path: 'https://element-plus-admin-doc.cn/',
name: 'DocumentLink',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 5,
meta: {
title: '文档'
}
}
]
},
{
path: '/level',
component: '#',
redirect: '/level/menu1/menu1-1/menu1-1-1',
name: 'Level',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 6,
meta: {
title: '菜单',
icon: 'carbon:skill-level-advanced'
},
children: [
{
path: 'menu1',
name: 'Menu1',
component: '##',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 7,
redirect: '/level/menu1/menu1-1/menu1-1-1',
meta: {
title: '菜单1'
},
children: [
{
path: 'menu1-1',
name: 'Menu11',
component: '##',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 8,
redirect: '/level/menu1/menu1-1/menu1-1-1',
meta: {
title: '菜单1-1',
alwaysShow: true
},
children: [
{
path: 'menu1-1-1',
name: 'Menu111',
component: 'views/Level/Menu111',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 9,
permission: ['edit', 'add', 'delete'],
meta: {
title: '菜单1-1-1',
permission: ['edit', 'add', 'delete']
}
}
]
},
{
path: 'menu1-2',
name: 'Menu12',
component: 'views/Level/Menu12',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 10,
permission: ['edit', 'add', 'delete'],
meta: {
title: '菜单1-2',
permission: ['edit', 'add', 'delete']
}
}
]
},
{
path: 'menu2',
name: 'Menu2Demo',
component: 'views/Level/Menu2',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 11,
permission: ['edit', 'add', 'delete'],
meta: {
title: '菜单2',
permission: ['edit', 'add', 'delete']
}
}
]
}
],
[
{
path: '/example',
component: '#',
redirect: '/example/example-dialog',
name: 'Example',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 12,
meta: {
title: '综合示例',
icon: 'ep:management',
alwaysShow: true
},
children: [
{
path: 'example-detail',
component: 'views/Example/Page/ExampleDetail',
name: 'ExampleDetail',
2023-11-29 16:14:48 +08:00
status: faker.number.int({ min: 0, max: 1 }),
2023-08-06 08:27:40 +08:00
id: 17,
permission: ['edit', 'add', 'delete'],
meta: {
title: '综合示例-详情',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example/example-page',
permission: ['edit', 'add', 'delete']
}
}
]
}
]
]
2023-08-05 20:34:55 +08:00
2023-08-06 08:27:40 +08:00
for (let i = 0; i < 4; i++) {
2023-11-29 16:14:48 +08:00
List.push({
id: toAnyString(),
// timestamp: +Mock.Random.date('T'),
roleName: roleNames[i],
role: faker.lorem.sentence(1),
status: faker.number.int({ min: 0, max: 1 }),
createTime: faker.date.anytime(),
remark: faker.lorem.sentence(),
menu: menus[i]
})
2023-08-05 20:34:55 +08:00
}
2022-02-19 20:34:44 +08:00
export default [
// 列表接口
{
2023-11-29 15:34:17 +08:00
url: '/mock/role/list',
2023-12-10 10:11:14 +08:00
method: 'get',
timeout,
response: () => {
2023-08-27 09:03:39 +08:00
return {
code: SUCCESS_CODE,
data: adminList
2023-08-27 09:03:39 +08:00
}
}
},
{
2023-11-29 15:34:17 +08:00
url: '/mock/role/table',
2023-12-10 10:11:14 +08:00
method: 'get',
timeout,
response: () => {
2023-08-27 09:03:39 +08:00
return {
code: SUCCESS_CODE,
2023-08-27 09:03:39 +08:00
data: {
list: List,
total: 4
2023-08-27 09:03:39 +08:00
}
}
}
},
// 列表接口
{
2023-11-29 15:34:17 +08:00
url: '/mock/role/list2',
2023-12-10 10:11:14 +08:00
method: 'get',
timeout,
response: () => {
2022-02-19 20:34:44 +08:00
return {
code: SUCCESS_CODE,
data: testList
2022-02-19 20:34:44 +08:00
}
}
2023-08-05 20:34:55 +08:00
},
{
2023-11-29 15:34:17 +08:00
url: '/mock/role/table',
2023-12-10 10:11:14 +08:00
method: 'get',
timeout,
response: () => {
2023-08-05 20:34:55 +08:00
return {
code: SUCCESS_CODE,
2023-08-05 20:34:55 +08:00
data: {
list: List,
total: 4
2023-08-05 20:34:55 +08:00
}
}
}
2022-02-19 20:34:44 +08:00
}
2023-11-29 15:34:17 +08:00
]