index.mock.ts 28 KB

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