index.mock.ts 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  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. path: 'avatars',
  328. component: 'views/Components/Avatars',
  329. name: 'Avatars',
  330. meta: {
  331. title: 'router.avatars'
  332. }
  333. }
  334. ]
  335. },
  336. {
  337. path: '/function',
  338. component: '#',
  339. redirect: '/function/multipleTabs',
  340. name: 'Function',
  341. meta: {
  342. title: 'router.function',
  343. icon: 'ri:function-fill',
  344. alwaysShow: true
  345. },
  346. children: [
  347. {
  348. path: 'multipleTabs',
  349. component: 'views/Function/MultipleTabs',
  350. name: 'MultipleTabs',
  351. meta: {
  352. title: 'router.multipleTabs'
  353. }
  354. },
  355. {
  356. path: 'multiple-tabs-demo/:id',
  357. component: 'views/Function/MultipleTabsDemo',
  358. name: 'MultipleTabsDemo',
  359. meta: {
  360. hidden: true,
  361. title: 'router.details',
  362. canTo: true
  363. }
  364. },
  365. {
  366. path: 'request',
  367. component: 'views/Function/Request',
  368. name: 'Request',
  369. meta: {
  370. title: 'router.request'
  371. }
  372. },
  373. {
  374. path: 'test',
  375. component: 'views/Function/Test',
  376. name: 'Test',
  377. meta: {
  378. title: 'router.permission',
  379. permission: ['add', 'edit', 'delete']
  380. }
  381. }
  382. ]
  383. },
  384. {
  385. path: '/hooks',
  386. component: '#',
  387. redirect: '/hooks/useWatermark',
  388. name: 'Hooks',
  389. meta: {
  390. title: 'hooks',
  391. icon: 'ic:outline-webhook',
  392. alwaysShow: true
  393. },
  394. children: [
  395. {
  396. path: 'useWatermark',
  397. component: 'views/hooks/useWatermark',
  398. name: 'UseWatermark',
  399. meta: {
  400. title: 'useWatermark'
  401. }
  402. },
  403. {
  404. path: 'useTagsView',
  405. component: 'views/hooks/useTagsView',
  406. name: 'UseTagsView',
  407. meta: {
  408. title: 'useTagsView'
  409. }
  410. },
  411. {
  412. path: 'useValidator',
  413. component: 'views/hooks/useValidator',
  414. name: 'UseValidator',
  415. meta: {
  416. title: 'useValidator'
  417. }
  418. },
  419. {
  420. path: 'useCrudSchemas',
  421. component: 'views/hooks/useCrudSchemas',
  422. name: 'UseCrudSchemas',
  423. meta: {
  424. title: 'useCrudSchemas'
  425. }
  426. },
  427. {
  428. path: 'useClipboard',
  429. component: 'views/hooks/useClipboard',
  430. name: 'UseClipboard',
  431. meta: {
  432. title: 'useClipboard'
  433. }
  434. },
  435. {
  436. path: 'useNetwork',
  437. component: 'views/hooks/useNetwork',
  438. name: 'UseNetwork',
  439. meta: {
  440. title: 'useNetwork'
  441. }
  442. }
  443. ]
  444. },
  445. {
  446. path: '/level',
  447. component: '#',
  448. redirect: '/level/menu1/menu1-1/menu1-1-1',
  449. name: 'Level',
  450. meta: {
  451. title: 'router.level',
  452. icon: 'carbon:skill-level-advanced'
  453. },
  454. children: [
  455. {
  456. path: 'menu1',
  457. name: 'Menu1',
  458. component: '##',
  459. redirect: '/level/menu1/menu1-1/menu1-1-1',
  460. meta: {
  461. title: 'router.menu1'
  462. },
  463. children: [
  464. {
  465. path: 'menu1-1',
  466. name: 'Menu11',
  467. component: '##',
  468. redirect: '/level/menu1/menu1-1/menu1-1-1',
  469. meta: {
  470. title: 'router.menu11',
  471. alwaysShow: true
  472. },
  473. children: [
  474. {
  475. path: 'menu1-1-1',
  476. name: 'Menu111',
  477. component: 'views/Level/Menu111',
  478. meta: {
  479. title: 'router.menu111'
  480. }
  481. }
  482. ]
  483. },
  484. {
  485. path: 'menu1-2',
  486. name: 'Menu12',
  487. component: 'views/Level/Menu12',
  488. meta: {
  489. title: 'router.menu12'
  490. }
  491. }
  492. ]
  493. },
  494. {
  495. path: 'menu2',
  496. name: 'Menu2Demo',
  497. component: 'views/Level/Menu2',
  498. meta: {
  499. title: 'router.menu2'
  500. }
  501. }
  502. ]
  503. },
  504. {
  505. path: '/example',
  506. component: '#',
  507. redirect: '/example/example-dialog',
  508. name: 'Example',
  509. meta: {
  510. title: 'router.example',
  511. icon: 'ep:management',
  512. alwaysShow: true
  513. },
  514. children: [
  515. {
  516. path: 'example-dialog',
  517. component: 'views/Example/Dialog/ExampleDialog',
  518. name: 'ExampleDialog',
  519. meta: {
  520. title: 'router.exampleDialog'
  521. }
  522. },
  523. {
  524. path: 'example-page',
  525. component: 'views/Example/Page/ExamplePage',
  526. name: 'ExamplePage',
  527. meta: {
  528. title: 'router.examplePage'
  529. }
  530. },
  531. {
  532. path: 'example-add',
  533. component: 'views/Example/Page/ExampleAdd',
  534. name: 'ExampleAdd',
  535. meta: {
  536. title: 'router.exampleAdd',
  537. noTagsView: true,
  538. noCache: true,
  539. hidden: true,
  540. showMainRoute: true,
  541. activeMenu: '/example/example-page'
  542. }
  543. },
  544. {
  545. path: 'example-edit',
  546. component: 'views/Example/Page/ExampleEdit',
  547. name: 'ExampleEdit',
  548. meta: {
  549. title: 'router.exampleEdit',
  550. noTagsView: true,
  551. noCache: true,
  552. hidden: true,
  553. showMainRoute: true,
  554. activeMenu: '/example/example-page'
  555. }
  556. },
  557. {
  558. path: 'example-detail',
  559. component: 'views/Example/Page/ExampleDetail',
  560. name: 'ExampleDetail',
  561. meta: {
  562. title: 'router.exampleDetail',
  563. noTagsView: true,
  564. noCache: true,
  565. hidden: true,
  566. showMainRoute: true,
  567. activeMenu: '/example/example-page'
  568. }
  569. }
  570. ]
  571. },
  572. {
  573. path: '/error',
  574. component: '#',
  575. redirect: '/error/404',
  576. name: 'Error',
  577. meta: {
  578. title: 'router.errorPage',
  579. icon: 'ci:error',
  580. alwaysShow: true
  581. },
  582. children: [
  583. {
  584. path: '404-demo',
  585. component: 'views/Error/404',
  586. name: '404Demo',
  587. meta: {
  588. title: '404'
  589. }
  590. },
  591. {
  592. path: '403-demo',
  593. component: 'views/Error/403',
  594. name: '403Demo',
  595. meta: {
  596. title: '403'
  597. }
  598. },
  599. {
  600. path: '500-demo',
  601. component: 'views/Error/500',
  602. name: '500Demo',
  603. meta: {
  604. title: '500'
  605. }
  606. }
  607. ]
  608. },
  609. {
  610. path: '/authorization',
  611. component: '#',
  612. redirect: '/authorization/user',
  613. name: 'Authorization',
  614. meta: {
  615. title: 'router.authorization',
  616. icon: 'eos-icons:role-binding',
  617. alwaysShow: true
  618. },
  619. children: [
  620. {
  621. path: 'department',
  622. component: 'views/Authorization/Department/Department',
  623. name: 'Department',
  624. meta: {
  625. title: 'router.department'
  626. }
  627. },
  628. {
  629. path: 'user',
  630. component: 'views/Authorization/User/User',
  631. name: 'User',
  632. meta: {
  633. title: 'router.user'
  634. }
  635. },
  636. {
  637. path: 'menu',
  638. component: 'views/Authorization/Menu/Menu',
  639. name: 'Menu',
  640. meta: {
  641. title: 'router.menuManagement'
  642. }
  643. },
  644. {
  645. path: 'role',
  646. component: 'views/Authorization/Role/Role',
  647. name: 'Role',
  648. meta: {
  649. title: 'router.role'
  650. }
  651. }
  652. ]
  653. }
  654. ]
  655. const testList: string[] = [
  656. '/dashboard',
  657. '/dashboard/analysis',
  658. '/dashboard/workplace',
  659. 'external-link',
  660. 'https://element-plus-admin-doc.cn/',
  661. '/guide',
  662. '/guide/index',
  663. '/components',
  664. '/components/form',
  665. '/components/form/default-form',
  666. '/components/form/use-form',
  667. '/components/form/ref-form',
  668. '/components/table',
  669. '/components/table/default-table',
  670. '/components/table/use-table',
  671. '/components/table/tree-table',
  672. '/components/table/table-image-preview',
  673. '/components/table/table-video-preview',
  674. '/components/table/ref-table',
  675. '/components/table/card-table',
  676. '/components/editor-demo',
  677. '/components/editor-demo/editor',
  678. '/components/editor-demo/json-editor',
  679. '/components/search',
  680. '/components/descriptions',
  681. '/components/image-viewer',
  682. '/components/dialog',
  683. '/components/icon',
  684. '/components/iconPicker',
  685. '/components/echart',
  686. '/components/count-to',
  687. '/components/qrcode',
  688. '/components/highlight',
  689. '/components/infotip',
  690. '/components/input-password',
  691. '/components/waterfall',
  692. '/components/image-cropping',
  693. '/components/video-player',
  694. '/components/avatars',
  695. 'function',
  696. '/function/multiple-tabs',
  697. '/function/multiple-tabs-demo/:id',
  698. '/function/request',
  699. '/function/test',
  700. '/hooks',
  701. '/hooks/useWatermark',
  702. '/hooks/useTagsView',
  703. '/hooks/useValidator',
  704. '/hooks/useCrudSchemas',
  705. '/hooks/useClipboard',
  706. '/hooks/useNetwork',
  707. '/level',
  708. '/level/menu1',
  709. '/level/menu1/menu1-1',
  710. '/level/menu1/menu1-1/menu1-1-1',
  711. '/level/menu1/menu1-2',
  712. '/level/menu2',
  713. '/example',
  714. '/example/example-dialog',
  715. '/example/example-page',
  716. '/example/example-add',
  717. '/example/example-edit',
  718. '/example/example-detail',
  719. '/authorization',
  720. '/authorization/department',
  721. '/authorization/user',
  722. '/authorization/role',
  723. '/authorization/menu',
  724. '/error',
  725. '/error/404-demo',
  726. '/error/403-demo',
  727. '/error/500-demo'
  728. ]
  729. const List: any[] = []
  730. const roleNames = ['超级管理员', '管理员', '普通用户', '游客']
  731. const menus = [
  732. [
  733. {
  734. path: '/dashboard',
  735. component: '#',
  736. redirect: '/dashboard/analysis',
  737. name: 'Dashboard',
  738. status: Mock.Random.integer(0, 1),
  739. id: 1,
  740. meta: {
  741. title: '首页',
  742. icon: 'ant-design:dashboard-filled',
  743. alwaysShow: true
  744. },
  745. children: [
  746. {
  747. path: 'analysis',
  748. component: 'views/Dashboard/Analysis',
  749. name: 'Analysis',
  750. status: Mock.Random.integer(0, 1),
  751. id: 2,
  752. meta: {
  753. title: '分析页',
  754. noCache: true
  755. }
  756. },
  757. {
  758. path: 'workplace',
  759. component: 'views/Dashboard/Workplace',
  760. name: 'Workplace',
  761. status: Mock.Random.integer(0, 1),
  762. id: 3,
  763. meta: {
  764. title: '工作台',
  765. noCache: true
  766. }
  767. }
  768. ]
  769. },
  770. {
  771. path: '/external-link',
  772. component: '#',
  773. meta: {
  774. title: '文档',
  775. icon: 'clarity:document-solid'
  776. },
  777. name: 'ExternalLink',
  778. status: Mock.Random.integer(0, 1),
  779. id: 4,
  780. children: [
  781. {
  782. path: 'https://element-plus-admin-doc.cn/',
  783. name: 'DocumentLink',
  784. status: Mock.Random.integer(0, 1),
  785. id: 5,
  786. meta: {
  787. title: '文档'
  788. }
  789. }
  790. ]
  791. },
  792. {
  793. path: '/level',
  794. component: '#',
  795. redirect: '/level/menu1/menu1-1/menu1-1-1',
  796. name: 'Level',
  797. status: Mock.Random.integer(0, 1),
  798. id: 6,
  799. meta: {
  800. title: '菜单',
  801. icon: 'carbon:skill-level-advanced'
  802. },
  803. children: [
  804. {
  805. path: 'menu1',
  806. name: 'Menu1',
  807. component: '##',
  808. status: Mock.Random.integer(0, 1),
  809. id: 7,
  810. redirect: '/level/menu1/menu1-1/menu1-1-1',
  811. meta: {
  812. title: '菜单1'
  813. },
  814. children: [
  815. {
  816. path: 'menu1-1',
  817. name: 'Menu11',
  818. component: '##',
  819. status: Mock.Random.integer(0, 1),
  820. id: 8,
  821. redirect: '/level/menu1/menu1-1/menu1-1-1',
  822. meta: {
  823. title: '菜单1-1',
  824. alwaysShow: true
  825. },
  826. children: [
  827. {
  828. path: 'menu1-1-1',
  829. name: 'Menu111',
  830. component: 'views/Level/Menu111',
  831. status: Mock.Random.integer(0, 1),
  832. id: 9,
  833. permission: ['edit', 'add', 'delete'],
  834. meta: {
  835. title: '菜单1-1-1',
  836. permission: ['edit', 'add', 'delete']
  837. }
  838. }
  839. ]
  840. },
  841. {
  842. path: 'menu1-2',
  843. name: 'Menu12',
  844. component: 'views/Level/Menu12',
  845. status: Mock.Random.integer(0, 1),
  846. id: 10,
  847. permission: ['edit', 'add', 'delete'],
  848. meta: {
  849. title: '菜单1-2',
  850. permission: ['edit', 'add', 'delete']
  851. }
  852. }
  853. ]
  854. },
  855. {
  856. path: 'menu2',
  857. name: 'Menu2Demo',
  858. component: 'views/Level/Menu2',
  859. status: Mock.Random.integer(0, 1),
  860. id: 11,
  861. permission: ['edit', 'add', 'delete'],
  862. meta: {
  863. title: '菜单2',
  864. permission: ['edit', 'add', 'delete']
  865. }
  866. }
  867. ]
  868. },
  869. {
  870. path: '/example',
  871. component: '#',
  872. redirect: '/example/example-dialog',
  873. name: 'Example',
  874. status: Mock.Random.integer(0, 1),
  875. id: 12,
  876. meta: {
  877. title: '综合示例',
  878. icon: 'ep:management',
  879. alwaysShow: true
  880. },
  881. children: [
  882. {
  883. path: 'example-dialog',
  884. component: 'views/Example/Dialog/ExampleDialog',
  885. name: 'ExampleDialog',
  886. status: Mock.Random.integer(0, 1),
  887. id: 13,
  888. permission: ['edit', 'add', 'delete'],
  889. meta: {
  890. title: '综合示例-弹窗',
  891. permission: ['edit', 'add', 'delete']
  892. }
  893. },
  894. {
  895. path: 'example-page',
  896. component: 'views/Example/Page/ExamplePage',
  897. name: 'ExamplePage',
  898. status: Mock.Random.integer(0, 1),
  899. id: 14,
  900. permission: ['edit', 'add', 'delete'],
  901. meta: {
  902. title: '综合示例-页面',
  903. permission: ['edit', 'add', 'delete']
  904. }
  905. },
  906. {
  907. path: 'example-add',
  908. component: 'views/Example/Page/ExampleAdd',
  909. name: 'ExampleAdd',
  910. status: Mock.Random.integer(0, 1),
  911. id: 15,
  912. permission: ['edit', 'add', 'delete'],
  913. meta: {
  914. title: '综合示例-新增',
  915. noTagsView: true,
  916. noCache: true,
  917. hidden: true,
  918. showMainRoute: true,
  919. activeMenu: '/example/example-page',
  920. permission: ['edit', 'add', 'delete']
  921. }
  922. },
  923. {
  924. path: 'example-edit',
  925. component: 'views/Example/Page/ExampleEdit',
  926. name: 'ExampleEdit',
  927. status: Mock.Random.integer(0, 1),
  928. id: 16,
  929. permission: ['edit', 'add', 'delete'],
  930. meta: {
  931. title: '综合示例-编辑',
  932. noTagsView: true,
  933. noCache: true,
  934. hidden: true,
  935. showMainRoute: true,
  936. activeMenu: '/example/example-page',
  937. permission: ['edit', 'add', 'delete']
  938. }
  939. },
  940. {
  941. path: 'example-detail',
  942. component: 'views/Example/Page/ExampleDetail',
  943. name: 'ExampleDetail',
  944. status: Mock.Random.integer(0, 1),
  945. id: 17,
  946. permission: ['edit', 'add', 'delete'],
  947. meta: {
  948. title: '综合示例-详情',
  949. noTagsView: true,
  950. noCache: true,
  951. hidden: true,
  952. showMainRoute: true,
  953. activeMenu: '/example/example-page',
  954. permission: ['edit', 'add', 'delete']
  955. }
  956. }
  957. ]
  958. }
  959. ],
  960. [
  961. {
  962. path: '/dashboard',
  963. component: '#',
  964. redirect: '/dashboard/analysis',
  965. name: 'Dashboard',
  966. status: Mock.Random.integer(0, 1),
  967. id: 1,
  968. meta: {
  969. title: '首页',
  970. icon: 'ant-design:dashboard-filled',
  971. alwaysShow: true
  972. },
  973. children: [
  974. {
  975. path: 'analysis',
  976. component: 'views/Dashboard/Analysis',
  977. name: 'Analysis',
  978. status: Mock.Random.integer(0, 1),
  979. id: 2,
  980. meta: {
  981. title: '分析页',
  982. noCache: true
  983. }
  984. },
  985. {
  986. path: 'workplace',
  987. component: 'views/Dashboard/Workplace',
  988. name: 'Workplace',
  989. status: Mock.Random.integer(0, 1),
  990. id: 3,
  991. meta: {
  992. title: '工作台',
  993. noCache: true
  994. }
  995. }
  996. ]
  997. }
  998. ],
  999. [
  1000. {
  1001. path: '/external-link',
  1002. component: '#',
  1003. meta: {
  1004. title: '文档',
  1005. icon: 'clarity:document-solid'
  1006. },
  1007. name: 'ExternalLink',
  1008. status: Mock.Random.integer(0, 1),
  1009. id: 4,
  1010. children: [
  1011. {
  1012. path: 'https://element-plus-admin-doc.cn/',
  1013. name: 'DocumentLink',
  1014. status: Mock.Random.integer(0, 1),
  1015. id: 5,
  1016. meta: {
  1017. title: '文档'
  1018. }
  1019. }
  1020. ]
  1021. },
  1022. {
  1023. path: '/level',
  1024. component: '#',
  1025. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1026. name: 'Level',
  1027. status: Mock.Random.integer(0, 1),
  1028. id: 6,
  1029. meta: {
  1030. title: '菜单',
  1031. icon: 'carbon:skill-level-advanced'
  1032. },
  1033. children: [
  1034. {
  1035. path: 'menu1',
  1036. name: 'Menu1',
  1037. component: '##',
  1038. status: Mock.Random.integer(0, 1),
  1039. id: 7,
  1040. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1041. meta: {
  1042. title: '菜单1'
  1043. },
  1044. children: [
  1045. {
  1046. path: 'menu1-1',
  1047. name: 'Menu11',
  1048. component: '##',
  1049. status: Mock.Random.integer(0, 1),
  1050. id: 8,
  1051. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1052. meta: {
  1053. title: '菜单1-1',
  1054. alwaysShow: true
  1055. },
  1056. children: [
  1057. {
  1058. path: 'menu1-1-1',
  1059. name: 'Menu111',
  1060. component: 'views/Level/Menu111',
  1061. status: Mock.Random.integer(0, 1),
  1062. id: 9,
  1063. permission: ['edit', 'add', 'delete'],
  1064. meta: {
  1065. title: '菜单1-1-1',
  1066. permission: ['edit', 'add', 'delete']
  1067. }
  1068. }
  1069. ]
  1070. },
  1071. {
  1072. path: 'menu1-2',
  1073. name: 'Menu12',
  1074. component: 'views/Level/Menu12',
  1075. status: Mock.Random.integer(0, 1),
  1076. id: 10,
  1077. permission: ['edit', 'add', 'delete'],
  1078. meta: {
  1079. title: '菜单1-2',
  1080. permission: ['edit', 'add', 'delete']
  1081. }
  1082. }
  1083. ]
  1084. },
  1085. {
  1086. path: 'menu2',
  1087. name: 'Menu2Demo',
  1088. component: 'views/Level/Menu2',
  1089. status: Mock.Random.integer(0, 1),
  1090. id: 11,
  1091. permission: ['edit', 'add', 'delete'],
  1092. meta: {
  1093. title: '菜单2',
  1094. permission: ['edit', 'add', 'delete']
  1095. }
  1096. }
  1097. ]
  1098. }
  1099. ],
  1100. [
  1101. {
  1102. path: '/example',
  1103. component: '#',
  1104. redirect: '/example/example-dialog',
  1105. name: 'Example',
  1106. status: Mock.Random.integer(0, 1),
  1107. id: 12,
  1108. meta: {
  1109. title: '综合示例',
  1110. icon: 'ep:management',
  1111. alwaysShow: true
  1112. },
  1113. children: [
  1114. {
  1115. path: 'example-detail',
  1116. component: 'views/Example/Page/ExampleDetail',
  1117. name: 'ExampleDetail',
  1118. status: Mock.Random.integer(0, 1),
  1119. id: 17,
  1120. permission: ['edit', 'add', 'delete'],
  1121. meta: {
  1122. title: '综合示例-详情',
  1123. noTagsView: true,
  1124. noCache: true,
  1125. hidden: true,
  1126. showMainRoute: true,
  1127. activeMenu: '/example/example-page',
  1128. permission: ['edit', 'add', 'delete']
  1129. }
  1130. }
  1131. ]
  1132. }
  1133. ]
  1134. ]
  1135. for (let i = 0; i < 4; i++) {
  1136. List.push(
  1137. Mock.mock({
  1138. id: toAnyString(),
  1139. // timestamp: +Mock.Random.date('T'),
  1140. roleName: roleNames[i],
  1141. role: '@first',
  1142. status: Mock.Random.integer(0, 1),
  1143. createTime: '@datetime',
  1144. remark: '@cword(10, 15)',
  1145. menu: menus[i]
  1146. })
  1147. )
  1148. }
  1149. export default [
  1150. // 列表接口
  1151. {
  1152. url: '/mock/role/list',
  1153. method: 'get',
  1154. timeout,
  1155. response: () => {
  1156. return {
  1157. code: SUCCESS_CODE,
  1158. data: adminList
  1159. }
  1160. }
  1161. },
  1162. {
  1163. url: '/mock/role/table',
  1164. method: 'get',
  1165. timeout,
  1166. response: () => {
  1167. return {
  1168. code: SUCCESS_CODE,
  1169. data: {
  1170. list: List,
  1171. total: 4
  1172. }
  1173. }
  1174. }
  1175. },
  1176. // 列表接口
  1177. {
  1178. url: '/mock/role/list2',
  1179. method: 'get',
  1180. timeout,
  1181. response: () => {
  1182. return {
  1183. code: SUCCESS_CODE,
  1184. data: testList
  1185. }
  1186. }
  1187. },
  1188. {
  1189. url: '/mock/role/table',
  1190. method: 'get',
  1191. timeout,
  1192. response: () => {
  1193. return {
  1194. code: SUCCESS_CODE,
  1195. data: {
  1196. list: List,
  1197. total: 4
  1198. }
  1199. }
  1200. }
  1201. }
  1202. ]