index.mock.ts 28 KB

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