index.mock.ts 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. import config from '@/config/axios/config'
  2. import { faker } from '@faker-js/faker'
  3. import { toAnyString } from '@/utils'
  4. const { code } = config
  5. const delay = 1000
  6. const adminList = [
  7. {
  8. path: '/dashboard',
  9. component: '#',
  10. redirect: '/dashboard/analysis',
  11. name: 'Dashboard',
  12. meta: {
  13. title: 'router.dashboard',
  14. icon: 'ant-design:dashboard-filled',
  15. alwaysShow: true
  16. },
  17. children: [
  18. {
  19. path: 'analysis',
  20. component: 'views/Dashboard/Analysis',
  21. name: 'Analysis',
  22. meta: {
  23. title: 'router.analysis',
  24. noCache: true,
  25. affix: true
  26. }
  27. },
  28. {
  29. path: 'workplace',
  30. component: 'views/Dashboard/Workplace',
  31. name: 'Workplace',
  32. meta: {
  33. title: 'router.workplace',
  34. noCache: true,
  35. affix: true
  36. }
  37. }
  38. ]
  39. },
  40. {
  41. path: '/external-link',
  42. component: '#',
  43. meta: {},
  44. name: 'ExternalLink',
  45. children: [
  46. {
  47. path: 'https://element-plus-admin-doc.cn/',
  48. name: 'DocumentLink',
  49. meta: {
  50. title: 'router.document',
  51. icon: 'clarity:document-solid'
  52. }
  53. }
  54. ]
  55. },
  56. {
  57. path: '/guide',
  58. component: '#',
  59. name: 'Guide',
  60. meta: {},
  61. children: [
  62. {
  63. path: 'index',
  64. component: 'views/Guide/Guide',
  65. name: 'GuideDemo',
  66. meta: {
  67. title: 'router.guide',
  68. icon: 'cib:telegram-plane'
  69. }
  70. }
  71. ]
  72. },
  73. {
  74. path: '/components',
  75. component: '#',
  76. redirect: '/components/form/default-form',
  77. name: 'ComponentsDemo',
  78. meta: {
  79. title: 'router.component',
  80. icon: 'bx:bxs-component',
  81. alwaysShow: true
  82. },
  83. children: [
  84. {
  85. path: 'form',
  86. component: '##',
  87. name: 'Form',
  88. meta: {
  89. title: 'router.form',
  90. alwaysShow: true
  91. },
  92. children: [
  93. {
  94. path: 'default-form',
  95. component: 'views/Components/Form/DefaultForm',
  96. name: 'DefaultForm',
  97. meta: {
  98. title: 'router.defaultForm'
  99. }
  100. },
  101. {
  102. path: 'use-form',
  103. component: 'views/Components/Form/UseFormDemo',
  104. name: 'UseForm',
  105. meta: {
  106. title: 'UseForm'
  107. }
  108. }
  109. ]
  110. },
  111. {
  112. path: 'table',
  113. component: '##',
  114. redirect: '/components/table/default-table',
  115. name: 'TableDemo',
  116. meta: {
  117. title: 'router.table',
  118. alwaysShow: true
  119. },
  120. children: [
  121. {
  122. path: 'default-table',
  123. component: 'views/Components/Table/DefaultTable',
  124. name: 'DefaultTable',
  125. meta: {
  126. title: 'router.defaultTable'
  127. }
  128. },
  129. {
  130. path: 'use-table',
  131. component: 'views/Components/Table/UseTableDemo',
  132. name: 'UseTable',
  133. meta: {
  134. title: 'UseTable'
  135. }
  136. },
  137. {
  138. path: 'tree-table',
  139. component: 'views/Components/Table/TreeTable',
  140. name: 'TreeTable',
  141. meta: {
  142. title: 'TreeTable'
  143. }
  144. },
  145. {
  146. path: 'table-image-preview',
  147. component: 'views/Components/Table/TableImagePreview',
  148. name: 'TableImagePreview',
  149. meta: {
  150. title: 'router.PicturePreview'
  151. }
  152. },
  153. {
  154. path: 'table-video-preview',
  155. component: 'views/Components/Table/TableVideoPreview',
  156. name: 'TableVideoPreview',
  157. meta: {
  158. title: 'router.tableVideoPreview'
  159. }
  160. }
  161. // {
  162. // path: 'ref-table',
  163. // component: 'views/Components/Table/RefTable',
  164. // name: 'RefTable',
  165. // meta: {
  166. // title: 'RefTable'
  167. // }
  168. // }
  169. ]
  170. },
  171. {
  172. path: 'editor-demo',
  173. component: '##',
  174. redirect: '/components/editor-demo/editor',
  175. name: 'EditorDemo',
  176. meta: {
  177. title: 'router.editor',
  178. alwaysShow: true
  179. },
  180. children: [
  181. {
  182. path: 'editor',
  183. component: 'views/Components/Editor/Editor',
  184. name: 'Editor',
  185. meta: {
  186. title: 'router.richText'
  187. }
  188. },
  189. {
  190. path: 'json-editor',
  191. component: 'views/Components/Editor/JsonEditor',
  192. name: 'JsonEditor',
  193. meta: {
  194. title: 'router.jsonEditor'
  195. }
  196. }
  197. ]
  198. },
  199. {
  200. path: 'search',
  201. component: 'views/Components/Search',
  202. name: 'Search',
  203. meta: {
  204. title: 'router.search'
  205. }
  206. },
  207. {
  208. path: 'descriptions',
  209. component: 'views/Components/Descriptions',
  210. name: 'Descriptions',
  211. meta: {
  212. title: 'router.descriptions'
  213. }
  214. },
  215. {
  216. path: 'image-viewer',
  217. component: 'views/Components/ImageViewer',
  218. name: 'ImageViewer',
  219. meta: {
  220. title: 'router.imageViewer'
  221. }
  222. },
  223. {
  224. path: 'dialog',
  225. component: 'views/Components/Dialog',
  226. name: 'Dialog',
  227. meta: {
  228. title: 'router.dialog'
  229. }
  230. },
  231. {
  232. path: 'icon',
  233. component: 'views/Components/Icon',
  234. name: 'Icon',
  235. meta: {
  236. title: 'router.icon'
  237. }
  238. },
  239. {
  240. path: 'icon-picker',
  241. component: 'views/Components/IconPicker',
  242. name: 'IconPicker',
  243. meta: {
  244. title: 'router.iconPicker'
  245. }
  246. },
  247. {
  248. path: 'echart',
  249. component: 'views/Components/Echart',
  250. name: 'Echart',
  251. meta: {
  252. title: 'router.echart'
  253. }
  254. },
  255. {
  256. path: 'count-to',
  257. component: 'views/Components/CountTo',
  258. name: 'CountTo',
  259. meta: {
  260. title: 'router.countTo'
  261. }
  262. },
  263. {
  264. path: 'qrcode',
  265. component: 'views/Components/Qrcode',
  266. name: 'Qrcode',
  267. meta: {
  268. title: 'router.qrcode'
  269. }
  270. },
  271. {
  272. path: 'highlight',
  273. component: 'views/Components/Highlight',
  274. name: 'Highlight',
  275. meta: {
  276. title: 'router.highlight'
  277. }
  278. },
  279. {
  280. path: 'infotip',
  281. component: 'views/Components/Infotip',
  282. name: 'Infotip',
  283. meta: {
  284. title: 'router.infotip'
  285. }
  286. },
  287. {
  288. path: 'input-password',
  289. component: 'views/Components/InputPassword',
  290. name: 'InputPassword',
  291. meta: {
  292. title: 'router.inputPassword'
  293. }
  294. },
  295. {
  296. path: 'waterfall',
  297. component: 'views/Components/Waterfall',
  298. name: 'Waterfall',
  299. meta: {
  300. title: 'router.waterfall'
  301. }
  302. },
  303. {
  304. path: 'image-cropping',
  305. component: 'views/Components/ImageCropping',
  306. name: 'ImageCropping',
  307. meta: {
  308. title: 'router.imageCropping'
  309. }
  310. },
  311. {
  312. path: 'video-player',
  313. component: 'views/Components/VideoPlayer',
  314. name: 'VideoPlayer',
  315. meta: {
  316. title: 'router.videoPlayer'
  317. }
  318. }
  319. ]
  320. },
  321. {
  322. path: '/function',
  323. component: '#',
  324. redirect: '/function/multipleTabs',
  325. name: 'Function',
  326. meta: {
  327. title: 'router.function',
  328. icon: 'ri:function-fill',
  329. alwaysShow: true
  330. },
  331. children: [
  332. {
  333. path: 'multipleTabs',
  334. component: 'views/Function/MultipleTabs',
  335. name: 'MultipleTabs',
  336. meta: {
  337. title: 'router.multipleTabs'
  338. }
  339. },
  340. {
  341. path: 'multipleTabs-demo/:id',
  342. component: 'views/Function/MultipleTabsDemo',
  343. name: 'MultipleTabsDemo',
  344. meta: {
  345. hidden: true,
  346. title: 'router.details',
  347. canTo: true
  348. }
  349. },
  350. {
  351. path: 'request',
  352. component: 'views/Function/Request',
  353. name: 'Request',
  354. meta: {
  355. title: 'router.request'
  356. }
  357. },
  358. {
  359. path: 'test',
  360. component: 'views/Function/Test',
  361. name: 'Test',
  362. meta: {
  363. title: 'router.permission',
  364. permission: ['add', 'edit', 'delete']
  365. }
  366. }
  367. ]
  368. },
  369. {
  370. path: '/hooks',
  371. component: '#',
  372. redirect: '/hooks/useWatermark',
  373. name: 'Hooks',
  374. meta: {
  375. title: 'hooks',
  376. icon: 'ic:outline-webhook',
  377. alwaysShow: true
  378. },
  379. children: [
  380. {
  381. path: 'useWatermark',
  382. component: 'views/hooks/useWatermark',
  383. name: 'UseWatermark',
  384. meta: {
  385. title: 'useWatermark'
  386. }
  387. },
  388. {
  389. path: 'useTagsView',
  390. component: 'views/hooks/useTagsView',
  391. name: 'UseTagsView',
  392. meta: {
  393. title: 'useTagsView'
  394. }
  395. },
  396. {
  397. path: 'useValidator',
  398. component: 'views/hooks/useValidator',
  399. name: 'UseValidator',
  400. meta: {
  401. title: 'useValidator'
  402. }
  403. },
  404. {
  405. path: 'useCrudSchemas',
  406. component: 'views/hooks/useCrudSchemas',
  407. name: 'UseCrudSchemas',
  408. meta: {
  409. title: 'useCrudSchemas'
  410. }
  411. },
  412. {
  413. path: 'useClipboard',
  414. component: 'views/hooks/useClipboard',
  415. name: 'UseClipboard',
  416. meta: {
  417. title: 'useClipboard'
  418. }
  419. },
  420. {
  421. path: 'useNetwork',
  422. component: 'views/hooks/useNetwork',
  423. name: 'UseNetwork',
  424. meta: {
  425. title: 'useNetwork'
  426. }
  427. }
  428. ]
  429. },
  430. {
  431. path: '/level',
  432. component: '#',
  433. redirect: '/level/menu1/menu1-1/menu1-1-1',
  434. name: 'Level',
  435. meta: {
  436. title: 'router.level',
  437. icon: 'carbon:skill-level-advanced'
  438. },
  439. children: [
  440. {
  441. path: 'menu1',
  442. name: 'Menu1',
  443. component: '##',
  444. redirect: '/level/menu1/menu1-1/menu1-1-1',
  445. meta: {
  446. title: 'router.menu1'
  447. },
  448. children: [
  449. {
  450. path: 'menu1-1',
  451. name: 'Menu11',
  452. component: '##',
  453. redirect: '/level/menu1/menu1-1/menu1-1-1',
  454. meta: {
  455. title: 'router.menu11',
  456. alwaysShow: true
  457. },
  458. children: [
  459. {
  460. path: 'menu1-1-1',
  461. name: 'Menu111',
  462. component: 'views/Level/Menu111',
  463. meta: {
  464. title: 'router.menu111'
  465. }
  466. }
  467. ]
  468. },
  469. {
  470. path: 'menu1-2',
  471. name: 'Menu12',
  472. component: 'views/Level/Menu12',
  473. meta: {
  474. title: 'router.menu12'
  475. }
  476. }
  477. ]
  478. },
  479. {
  480. path: 'menu2',
  481. name: 'Menu2Demo',
  482. component: 'views/Level/Menu2',
  483. meta: {
  484. title: 'router.menu2'
  485. }
  486. }
  487. ]
  488. },
  489. {
  490. path: '/example',
  491. component: '#',
  492. redirect: '/example/example-dialog',
  493. name: 'Example',
  494. meta: {
  495. title: 'router.example',
  496. icon: 'ep:management',
  497. alwaysShow: true
  498. },
  499. children: [
  500. {
  501. path: 'example-dialog',
  502. component: 'views/Example/Dialog/ExampleDialog',
  503. name: 'ExampleDialog',
  504. meta: {
  505. title: 'router.exampleDialog'
  506. }
  507. },
  508. {
  509. path: 'example-page',
  510. component: 'views/Example/Page/ExamplePage',
  511. name: 'ExamplePage',
  512. meta: {
  513. title: 'router.examplePage'
  514. }
  515. },
  516. {
  517. path: 'example-add',
  518. component: 'views/Example/Page/ExampleAdd',
  519. name: 'ExampleAdd',
  520. meta: {
  521. title: 'router.exampleAdd',
  522. noTagsView: true,
  523. noCache: true,
  524. hidden: true,
  525. showMainRoute: true,
  526. activeMenu: '/example/example-page'
  527. }
  528. },
  529. {
  530. path: 'example-edit',
  531. component: 'views/Example/Page/ExampleEdit',
  532. name: 'ExampleEdit',
  533. meta: {
  534. title: 'router.exampleEdit',
  535. noTagsView: true,
  536. noCache: true,
  537. hidden: true,
  538. showMainRoute: true,
  539. activeMenu: '/example/example-page'
  540. }
  541. },
  542. {
  543. path: 'example-detail',
  544. component: 'views/Example/Page/ExampleDetail',
  545. name: 'ExampleDetail',
  546. meta: {
  547. title: 'router.exampleDetail',
  548. noTagsView: true,
  549. noCache: true,
  550. hidden: true,
  551. showMainRoute: true,
  552. activeMenu: '/example/example-page'
  553. }
  554. }
  555. ]
  556. },
  557. {
  558. path: '/error',
  559. component: '#',
  560. redirect: '/error/404',
  561. name: 'Error',
  562. meta: {
  563. title: 'router.errorPage',
  564. icon: 'ci:error',
  565. alwaysShow: true
  566. },
  567. children: [
  568. {
  569. path: '404-demo',
  570. component: 'views/Error/404',
  571. name: '404Demo',
  572. meta: {
  573. title: '404'
  574. }
  575. },
  576. {
  577. path: '403-demo',
  578. component: 'views/Error/403',
  579. name: '403Demo',
  580. meta: {
  581. title: '403'
  582. }
  583. },
  584. {
  585. path: '500-demo',
  586. component: 'views/Error/500',
  587. name: '500Demo',
  588. meta: {
  589. title: '500'
  590. }
  591. }
  592. ]
  593. },
  594. {
  595. path: '/authorization',
  596. component: '#',
  597. redirect: '/authorization/user',
  598. name: 'Authorization',
  599. meta: {
  600. title: 'router.authorization',
  601. icon: 'eos-icons:role-binding',
  602. alwaysShow: true
  603. },
  604. children: [
  605. {
  606. path: 'department',
  607. component: 'views/Authorization/Department/Department',
  608. name: 'Department',
  609. meta: {
  610. title: 'router.department'
  611. }
  612. },
  613. {
  614. path: 'user',
  615. component: 'views/Authorization/User/User',
  616. name: 'User',
  617. meta: {
  618. title: 'router.user'
  619. }
  620. },
  621. {
  622. path: 'menu',
  623. component: 'views/Authorization/Menu/Menu',
  624. name: 'Menu',
  625. meta: {
  626. title: 'router.menuManagement'
  627. }
  628. },
  629. {
  630. path: 'role',
  631. component: 'views/Authorization/Role/Role',
  632. name: 'Role',
  633. meta: {
  634. title: 'router.role'
  635. }
  636. }
  637. ]
  638. }
  639. ]
  640. const testList: string[] = [
  641. '/dashboard',
  642. '/dashboard/analysis',
  643. '/dashboard/workplace',
  644. 'external-link',
  645. 'https://element-plus-admin-doc.cn/',
  646. '/guide',
  647. '/guide/index',
  648. '/components',
  649. '/components/form',
  650. '/components/form/default-form',
  651. '/components/form/use-form',
  652. '/components/form/ref-form',
  653. '/components/table',
  654. '/components/table/default-table',
  655. '/components/table/use-table',
  656. '/components/table/tree-table',
  657. '/components/table/table-image-preview',
  658. '/components/table/table-video-preview',
  659. '/components/table/ref-table',
  660. '/components/editor-demo',
  661. '/components/editor-demo/editor',
  662. '/components/editor-demo/json-editor',
  663. '/components/search',
  664. '/components/descriptions',
  665. '/components/image-viewer',
  666. '/components/dialog',
  667. '/components/icon',
  668. '/components/iconPicker',
  669. '/components/echart',
  670. '/components/count-to',
  671. '/components/qrcode',
  672. '/components/highlight',
  673. '/components/infotip',
  674. '/components/input-password',
  675. '/components/waterfall',
  676. '/components/image-cropping',
  677. '/components/video-player',
  678. 'function',
  679. '/function/multiple-tabs',
  680. '/function/multiple-tabs-demo/:id',
  681. '/function/request',
  682. '/function/test',
  683. '/hooks',
  684. '/hooks/useWatermark',
  685. '/hooks/useTagsView',
  686. '/hooks/useValidator',
  687. '/hooks/useCrudSchemas',
  688. '/hooks/useClipboard',
  689. '/hooks/useNetwork',
  690. '/level',
  691. '/level/menu1',
  692. '/level/menu1/menu1-1',
  693. '/level/menu1/menu1-1/menu1-1-1',
  694. '/level/menu1/menu1-2',
  695. '/level/menu2',
  696. '/example',
  697. '/example/example-dialog',
  698. '/example/example-page',
  699. '/example/example-add',
  700. '/example/example-edit',
  701. '/example/example-detail',
  702. '/authorization',
  703. '/authorization/department',
  704. '/authorization/user',
  705. '/authorization/role',
  706. '/authorization/menu',
  707. '/error',
  708. '/error/404-demo',
  709. '/error/403-demo',
  710. '/error/500-demo'
  711. ]
  712. const List: any[] = []
  713. const roleNames = ['超级管理员', '管理员', '普通用户', '游客']
  714. const menus = [
  715. [
  716. {
  717. path: '/dashboard',
  718. component: '#',
  719. redirect: '/dashboard/analysis',
  720. name: 'Dashboard',
  721. status: faker.number.int({ min: 0, max: 1 }),
  722. id: 1,
  723. meta: {
  724. title: '首页',
  725. icon: 'ant-design:dashboard-filled',
  726. alwaysShow: true
  727. },
  728. children: [
  729. {
  730. path: 'analysis',
  731. component: 'views/Dashboard/Analysis',
  732. name: 'Analysis',
  733. status: faker.number.int({ min: 0, max: 1 }),
  734. id: 2,
  735. meta: {
  736. title: '分析页',
  737. noCache: true
  738. }
  739. },
  740. {
  741. path: 'workplace',
  742. component: 'views/Dashboard/Workplace',
  743. name: 'Workplace',
  744. status: faker.number.int({ min: 0, max: 1 }),
  745. id: 3,
  746. meta: {
  747. title: '工作台',
  748. noCache: true
  749. }
  750. }
  751. ]
  752. },
  753. {
  754. path: '/external-link',
  755. component: '#',
  756. meta: {
  757. title: '文档',
  758. icon: 'clarity:document-solid'
  759. },
  760. name: 'ExternalLink',
  761. status: faker.number.int({ min: 0, max: 1 }),
  762. id: 4,
  763. children: [
  764. {
  765. path: 'https://element-plus-admin-doc.cn/',
  766. name: 'DocumentLink',
  767. status: faker.number.int({ min: 0, max: 1 }),
  768. id: 5,
  769. meta: {
  770. title: '文档'
  771. }
  772. }
  773. ]
  774. },
  775. {
  776. path: '/level',
  777. component: '#',
  778. redirect: '/level/menu1/menu1-1/menu1-1-1',
  779. name: 'Level',
  780. status: faker.number.int({ min: 0, max: 1 }),
  781. id: 6,
  782. meta: {
  783. title: '菜单',
  784. icon: 'carbon:skill-level-advanced'
  785. },
  786. children: [
  787. {
  788. path: 'menu1',
  789. name: 'Menu1',
  790. component: '##',
  791. status: faker.number.int({ min: 0, max: 1 }),
  792. id: 7,
  793. redirect: '/level/menu1/menu1-1/menu1-1-1',
  794. meta: {
  795. title: '菜单1'
  796. },
  797. children: [
  798. {
  799. path: 'menu1-1',
  800. name: 'Menu11',
  801. component: '##',
  802. status: faker.number.int({ min: 0, max: 1 }),
  803. id: 8,
  804. redirect: '/level/menu1/menu1-1/menu1-1-1',
  805. meta: {
  806. title: '菜单1-1',
  807. alwaysShow: true
  808. },
  809. children: [
  810. {
  811. path: 'menu1-1-1',
  812. name: 'Menu111',
  813. component: 'views/Level/Menu111',
  814. status: faker.number.int({ min: 0, max: 1 }),
  815. id: 9,
  816. permission: ['edit', 'add', 'delete'],
  817. meta: {
  818. title: '菜单1-1-1',
  819. permission: ['edit', 'add', 'delete']
  820. }
  821. }
  822. ]
  823. },
  824. {
  825. path: 'menu1-2',
  826. name: 'Menu12',
  827. component: 'views/Level/Menu12',
  828. status: faker.number.int({ min: 0, max: 1 }),
  829. id: 10,
  830. permission: ['edit', 'add', 'delete'],
  831. meta: {
  832. title: '菜单1-2',
  833. permission: ['edit', 'add', 'delete']
  834. }
  835. }
  836. ]
  837. },
  838. {
  839. path: 'menu2',
  840. name: 'Menu2Demo',
  841. component: 'views/Level/Menu2',
  842. status: faker.number.int({ min: 0, max: 1 }),
  843. id: 11,
  844. permission: ['edit', 'add', 'delete'],
  845. meta: {
  846. title: '菜单2',
  847. permission: ['edit', 'add', 'delete']
  848. }
  849. }
  850. ]
  851. },
  852. {
  853. path: '/example',
  854. component: '#',
  855. redirect: '/example/example-dialog',
  856. name: 'Example',
  857. status: faker.number.int({ min: 0, max: 1 }),
  858. id: 12,
  859. meta: {
  860. title: '综合示例',
  861. icon: 'ep:management',
  862. alwaysShow: true
  863. },
  864. children: [
  865. {
  866. path: 'example-dialog',
  867. component: 'views/Example/Dialog/ExampleDialog',
  868. name: 'ExampleDialog',
  869. status: faker.number.int({ min: 0, max: 1 }),
  870. id: 13,
  871. permission: ['edit', 'add', 'delete'],
  872. meta: {
  873. title: '综合示例-弹窗',
  874. permission: ['edit', 'add', 'delete']
  875. }
  876. },
  877. {
  878. path: 'example-page',
  879. component: 'views/Example/Page/ExamplePage',
  880. name: 'ExamplePage',
  881. status: faker.number.int({ min: 0, max: 1 }),
  882. id: 14,
  883. permission: ['edit', 'add', 'delete'],
  884. meta: {
  885. title: '综合示例-页面',
  886. permission: ['edit', 'add', 'delete']
  887. }
  888. },
  889. {
  890. path: 'example-add',
  891. component: 'views/Example/Page/ExampleAdd',
  892. name: 'ExampleAdd',
  893. status: faker.number.int({ min: 0, max: 1 }),
  894. id: 15,
  895. permission: ['edit', 'add', 'delete'],
  896. meta: {
  897. title: '综合示例-新增',
  898. noTagsView: true,
  899. noCache: true,
  900. hidden: true,
  901. showMainRoute: true,
  902. activeMenu: '/example/example-page',
  903. permission: ['edit', 'add', 'delete']
  904. }
  905. },
  906. {
  907. path: 'example-edit',
  908. component: 'views/Example/Page/ExampleEdit',
  909. name: 'ExampleEdit',
  910. status: faker.number.int({ min: 0, max: 1 }),
  911. id: 16,
  912. permission: ['edit', 'add', 'delete'],
  913. meta: {
  914. title: '综合示例-编辑',
  915. noTagsView: true,
  916. noCache: true,
  917. hidden: true,
  918. showMainRoute: true,
  919. activeMenu: '/example/example-page',
  920. permission: ['edit', 'add', 'delete']
  921. }
  922. },
  923. {
  924. path: 'example-detail',
  925. component: 'views/Example/Page/ExampleDetail',
  926. name: 'ExampleDetail',
  927. status: faker.number.int({ min: 0, max: 1 }),
  928. id: 17,
  929. permission: ['edit', 'add', 'delete'],
  930. meta: {
  931. title: '综合示例-详情',
  932. noTagsView: true,
  933. noCache: true,
  934. hidden: true,
  935. showMainRoute: true,
  936. activeMenu: '/example/example-page',
  937. permission: ['edit', 'add', 'delete']
  938. }
  939. }
  940. ]
  941. }
  942. ],
  943. [
  944. {
  945. path: '/dashboard',
  946. component: '#',
  947. redirect: '/dashboard/analysis',
  948. name: 'Dashboard',
  949. status: faker.number.int({ min: 0, max: 1 }),
  950. id: 1,
  951. meta: {
  952. title: '首页',
  953. icon: 'ant-design:dashboard-filled',
  954. alwaysShow: true
  955. },
  956. children: [
  957. {
  958. path: 'analysis',
  959. component: 'views/Dashboard/Analysis',
  960. name: 'Analysis',
  961. status: faker.number.int({ min: 0, max: 1 }),
  962. id: 2,
  963. meta: {
  964. title: '分析页',
  965. noCache: true
  966. }
  967. },
  968. {
  969. path: 'workplace',
  970. component: 'views/Dashboard/Workplace',
  971. name: 'Workplace',
  972. status: faker.number.int({ min: 0, max: 1 }),
  973. id: 3,
  974. meta: {
  975. title: '工作台',
  976. noCache: true
  977. }
  978. }
  979. ]
  980. }
  981. ],
  982. [
  983. {
  984. path: '/external-link',
  985. component: '#',
  986. meta: {
  987. title: '文档',
  988. icon: 'clarity:document-solid'
  989. },
  990. name: 'ExternalLink',
  991. status: faker.number.int({ min: 0, max: 1 }),
  992. id: 4,
  993. children: [
  994. {
  995. path: 'https://element-plus-admin-doc.cn/',
  996. name: 'DocumentLink',
  997. status: faker.number.int({ min: 0, max: 1 }),
  998. id: 5,
  999. meta: {
  1000. title: '文档'
  1001. }
  1002. }
  1003. ]
  1004. },
  1005. {
  1006. path: '/level',
  1007. component: '#',
  1008. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1009. name: 'Level',
  1010. status: faker.number.int({ min: 0, max: 1 }),
  1011. id: 6,
  1012. meta: {
  1013. title: '菜单',
  1014. icon: 'carbon:skill-level-advanced'
  1015. },
  1016. children: [
  1017. {
  1018. path: 'menu1',
  1019. name: 'Menu1',
  1020. component: '##',
  1021. status: faker.number.int({ min: 0, max: 1 }),
  1022. id: 7,
  1023. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1024. meta: {
  1025. title: '菜单1'
  1026. },
  1027. children: [
  1028. {
  1029. path: 'menu1-1',
  1030. name: 'Menu11',
  1031. component: '##',
  1032. status: faker.number.int({ min: 0, max: 1 }),
  1033. id: 8,
  1034. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1035. meta: {
  1036. title: '菜单1-1',
  1037. alwaysShow: true
  1038. },
  1039. children: [
  1040. {
  1041. path: 'menu1-1-1',
  1042. name: 'Menu111',
  1043. component: 'views/Level/Menu111',
  1044. status: faker.number.int({ min: 0, max: 1 }),
  1045. id: 9,
  1046. permission: ['edit', 'add', 'delete'],
  1047. meta: {
  1048. title: '菜单1-1-1',
  1049. permission: ['edit', 'add', 'delete']
  1050. }
  1051. }
  1052. ]
  1053. },
  1054. {
  1055. path: 'menu1-2',
  1056. name: 'Menu12',
  1057. component: 'views/Level/Menu12',
  1058. status: faker.number.int({ min: 0, max: 1 }),
  1059. id: 10,
  1060. permission: ['edit', 'add', 'delete'],
  1061. meta: {
  1062. title: '菜单1-2',
  1063. permission: ['edit', 'add', 'delete']
  1064. }
  1065. }
  1066. ]
  1067. },
  1068. {
  1069. path: 'menu2',
  1070. name: 'Menu2Demo',
  1071. component: 'views/Level/Menu2',
  1072. status: faker.number.int({ min: 0, max: 1 }),
  1073. id: 11,
  1074. permission: ['edit', 'add', 'delete'],
  1075. meta: {
  1076. title: '菜单2',
  1077. permission: ['edit', 'add', 'delete']
  1078. }
  1079. }
  1080. ]
  1081. }
  1082. ],
  1083. [
  1084. {
  1085. path: '/example',
  1086. component: '#',
  1087. redirect: '/example/example-dialog',
  1088. name: 'Example',
  1089. status: faker.number.int({ min: 0, max: 1 }),
  1090. id: 12,
  1091. meta: {
  1092. title: '综合示例',
  1093. icon: 'ep:management',
  1094. alwaysShow: true
  1095. },
  1096. children: [
  1097. {
  1098. path: 'example-detail',
  1099. component: 'views/Example/Page/ExampleDetail',
  1100. name: 'ExampleDetail',
  1101. status: faker.number.int({ min: 0, max: 1 }),
  1102. id: 17,
  1103. permission: ['edit', 'add', 'delete'],
  1104. meta: {
  1105. title: '综合示例-详情',
  1106. noTagsView: true,
  1107. noCache: true,
  1108. hidden: true,
  1109. showMainRoute: true,
  1110. activeMenu: '/example/example-page',
  1111. permission: ['edit', 'add', 'delete']
  1112. }
  1113. }
  1114. ]
  1115. }
  1116. ]
  1117. ]
  1118. for (let i = 0; i < 4; i++) {
  1119. List.push({
  1120. id: toAnyString(),
  1121. // timestamp: +Mock.Random.date('T'),
  1122. roleName: roleNames[i],
  1123. role: faker.lorem.sentence(1),
  1124. status: faker.number.int({ min: 0, max: 1 }),
  1125. createTime: faker.date.anytime(),
  1126. remark: faker.lorem.sentence(),
  1127. menu: menus[i]
  1128. })
  1129. }
  1130. export default [
  1131. // 列表接口
  1132. {
  1133. url: '/mock/role/list',
  1134. method: 'GET',
  1135. delay,
  1136. body: () => {
  1137. return {
  1138. code: code,
  1139. data: adminList
  1140. }
  1141. }
  1142. },
  1143. {
  1144. url: '/mock/role/table',
  1145. method: 'GET',
  1146. delay,
  1147. body: () => {
  1148. return {
  1149. code: code,
  1150. data: {
  1151. list: List,
  1152. total: 4
  1153. }
  1154. }
  1155. }
  1156. },
  1157. // 列表接口
  1158. {
  1159. url: '/mock/role/list2',
  1160. method: 'GET',
  1161. delay,
  1162. body: () => {
  1163. return {
  1164. code: code,
  1165. data: testList
  1166. }
  1167. }
  1168. },
  1169. {
  1170. url: '/mock/role/table',
  1171. method: 'GET',
  1172. delay,
  1173. body: () => {
  1174. return {
  1175. code: code,
  1176. data: {
  1177. list: List,
  1178. total: 4
  1179. }
  1180. }
  1181. }
  1182. }
  1183. ]