index.mock.ts 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. import Mock from 'mockjs'
  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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 1),
  770. id: 4,
  771. children: [
  772. {
  773. path: 'https://element-plus-admin-doc.cn/',
  774. name: 'DocumentLink',
  775. status: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 1),
  1000. id: 4,
  1001. children: [
  1002. {
  1003. path: 'https://element-plus-admin-doc.cn/',
  1004. name: 'DocumentLink',
  1005. status: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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: Mock.Random.integer(0, 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. Mock.mock({
  1129. id: toAnyString(),
  1130. // timestamp: +Mock.Random.date('T'),
  1131. roleName: roleNames[i],
  1132. role: '@first',
  1133. status: Mock.Random.integer(0, 1),
  1134. createTime: '@datetime',
  1135. remark: '@cword(10, 15)',
  1136. menu: menus[i]
  1137. })
  1138. )
  1139. }
  1140. export default [
  1141. // 列表接口
  1142. {
  1143. url: '/mock/role/list',
  1144. method: 'get',
  1145. timeout,
  1146. response: () => {
  1147. return {
  1148. code: SUCCESS_CODE,
  1149. data: adminList
  1150. }
  1151. }
  1152. },
  1153. {
  1154. url: '/mock/role/table',
  1155. method: 'get',
  1156. timeout,
  1157. response: () => {
  1158. return {
  1159. code: SUCCESS_CODE,
  1160. data: {
  1161. list: List,
  1162. total: 4
  1163. }
  1164. }
  1165. }
  1166. },
  1167. // 列表接口
  1168. {
  1169. url: '/mock/role/list2',
  1170. method: 'get',
  1171. timeout,
  1172. response: () => {
  1173. return {
  1174. code: SUCCESS_CODE,
  1175. data: testList
  1176. }
  1177. }
  1178. },
  1179. {
  1180. url: '/mock/role/table',
  1181. method: 'get',
  1182. timeout,
  1183. response: () => {
  1184. return {
  1185. code: SUCCESS_CODE,
  1186. data: {
  1187. list: List,
  1188. total: 4
  1189. }
  1190. }
  1191. }
  1192. }
  1193. ]