menu.mock.ts 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470
  1. import { defineMock } from "./base";
  2. export default defineMock([
  3. {
  4. url: "menus/routes",
  5. method: ["GET"],
  6. body: {
  7. code: "00000",
  8. data: [
  9. {
  10. path: "/system",
  11. component: "Layout",
  12. redirect: "/system/user",
  13. name: "/system",
  14. meta: {
  15. title: "系统管理",
  16. icon: "system",
  17. hidden: false,
  18. roles: ["ADMIN"],
  19. },
  20. children: [
  21. {
  22. path: "user",
  23. component: "system/user/index",
  24. name: "User",
  25. meta: {
  26. title: "用户管理",
  27. icon: "user",
  28. hidden: false,
  29. roles: ["ADMIN"],
  30. keepAlive: true,
  31. },
  32. },
  33. {
  34. path: "role",
  35. component: "system/role/index",
  36. name: "Role",
  37. meta: {
  38. title: "角色管理",
  39. icon: "role",
  40. hidden: false,
  41. roles: ["ADMIN"],
  42. keepAlive: true,
  43. },
  44. },
  45. {
  46. path: "menu",
  47. component: "system/menu/index",
  48. name: "Menu",
  49. meta: {
  50. title: "菜单管理",
  51. icon: "menu",
  52. hidden: false,
  53. roles: ["ADMIN"],
  54. keepAlive: true,
  55. },
  56. },
  57. {
  58. path: "dept",
  59. component: "system/dept/index",
  60. name: "Dept",
  61. meta: {
  62. title: "部门管理",
  63. icon: "tree",
  64. hidden: false,
  65. roles: ["ADMIN"],
  66. keepAlive: true,
  67. },
  68. },
  69. {
  70. path: "dict",
  71. component: "system/dict/index",
  72. name: "Dict",
  73. meta: {
  74. title: "字典管理",
  75. icon: "dict",
  76. hidden: false,
  77. roles: ["ADMIN"],
  78. keepAlive: true,
  79. },
  80. },
  81. ],
  82. },
  83. {
  84. path: "/api",
  85. component: "Layout",
  86. name: "/api",
  87. meta: {
  88. title: "接口文档",
  89. icon: "api",
  90. hidden: false,
  91. roles: ["ADMIN"],
  92. alwaysShow: true,
  93. },
  94. children: [
  95. {
  96. path: "apifox",
  97. component: "demo/api/apifox",
  98. name: "Apifox",
  99. meta: {
  100. title: "Apifox",
  101. icon: "api",
  102. hidden: false,
  103. roles: ["ADMIN"],
  104. keepAlive: true,
  105. },
  106. },
  107. {
  108. path: "swagger",
  109. component: "demo/api/swagger",
  110. name: "Swagger",
  111. meta: {
  112. title: "Swagger",
  113. icon: "api",
  114. hidden: true,
  115. roles: ["ADMIN"],
  116. keepAlive: true,
  117. },
  118. },
  119. {
  120. path: "knife4j",
  121. component: "demo/api/knife4j",
  122. name: "Knife4j",
  123. meta: {
  124. title: "Knife4j",
  125. icon: "api",
  126. hidden: true,
  127. roles: ["ADMIN"],
  128. keepAlive: true,
  129. },
  130. },
  131. ],
  132. },
  133. {
  134. path: "/doc",
  135. component: "Layout",
  136. name: "/doc",
  137. meta: {
  138. title: "平台文档",
  139. icon: "document",
  140. hidden: false,
  141. roles: ["ADMIN"],
  142. },
  143. children: [
  144. {
  145. path: "internal-doc",
  146. component: "demo/internal-doc",
  147. name: "InternalDoc",
  148. meta: {
  149. title: "平台文档(内嵌)",
  150. icon: "document",
  151. hidden: false,
  152. roles: ["ADMIN"],
  153. },
  154. },
  155. {
  156. path: "https://juejin.cn/post/7228990409909108793",
  157. name: "Https://juejin.cn/post/7228990409909108793",
  158. meta: {
  159. title: "平台文档(外链)",
  160. icon: "link",
  161. hidden: false,
  162. roles: ["ADMIN"],
  163. },
  164. },
  165. ],
  166. },
  167. {
  168. path: "/multi-level",
  169. component: "Layout",
  170. redirect: "/multi-level/multi-level1",
  171. name: "/multiLevel",
  172. meta: {
  173. title: "多级菜单",
  174. icon: "cascader",
  175. hidden: false,
  176. roles: ["ADMIN"],
  177. },
  178. children: [
  179. {
  180. path: "multi-level1",
  181. component: "demo/multi-level/level1",
  182. redirect: "/multi-level/multi-level2",
  183. name: "MultiLevel1",
  184. meta: {
  185. title: "菜单一级",
  186. icon: "",
  187. hidden: false,
  188. roles: ["ADMIN"],
  189. keepAlive: true,
  190. },
  191. children: [
  192. {
  193. path: "multi-level2",
  194. component: "demo/multi-level/children/level2",
  195. redirect: "/multi-level/multi-level2/multi-level3-1",
  196. name: "MultiLevel2",
  197. meta: {
  198. title: "菜单二级",
  199. icon: "",
  200. hidden: false,
  201. roles: ["ADMIN"],
  202. keepAlive: true,
  203. },
  204. children: [
  205. {
  206. path: "multi-level3-1",
  207. component: "demo/multi-level/children/children/level3-1",
  208. name: "MultiLevel31",
  209. meta: {
  210. title: "菜单三级-1",
  211. icon: "",
  212. hidden: false,
  213. roles: ["ADMIN"],
  214. keepAlive: true,
  215. },
  216. },
  217. {
  218. path: "multi-level3-2",
  219. component: "demo/multi-level/children/children/level3-2",
  220. name: "MultiLevel32",
  221. meta: {
  222. title: "菜单三级-2",
  223. icon: "",
  224. hidden: false,
  225. roles: ["ADMIN"],
  226. keepAlive: true,
  227. },
  228. },
  229. ],
  230. },
  231. ],
  232. },
  233. ],
  234. },
  235. {
  236. path: "/component",
  237. component: "Layout",
  238. name: "/component",
  239. meta: {
  240. title: "组件封装",
  241. icon: "menu",
  242. hidden: false,
  243. roles: ["ADMIN"],
  244. },
  245. children: [
  246. {
  247. path: "wang-editor",
  248. component: "demo/wang-editor",
  249. name: "WangEditor",
  250. meta: {
  251. title: "富文本编辑器",
  252. icon: "",
  253. hidden: false,
  254. roles: ["ADMIN"],
  255. keepAlive: true,
  256. },
  257. },
  258. {
  259. path: "upload",
  260. component: "demo/upload",
  261. name: "Upload",
  262. meta: {
  263. title: "图片上传",
  264. icon: "",
  265. hidden: false,
  266. roles: ["ADMIN"],
  267. keepAlive: true,
  268. },
  269. },
  270. {
  271. path: "icon-selector",
  272. component: "demo/icon-selector",
  273. name: "IconSelector",
  274. meta: {
  275. title: "图标选择器",
  276. icon: "",
  277. hidden: false,
  278. roles: ["ADMIN"],
  279. keepAlive: true,
  280. },
  281. },
  282. {
  283. path: "dict-demo",
  284. component: "demo/dict",
  285. name: "DictDemo",
  286. meta: {
  287. title: "字典组件",
  288. icon: "",
  289. hidden: false,
  290. roles: ["ADMIN"],
  291. keepAlive: true,
  292. },
  293. },
  294. {
  295. path: "signature",
  296. component: "demo/signature",
  297. name: "Signature",
  298. meta: {
  299. title: "签名",
  300. icon: "",
  301. hidden: false,
  302. roles: ["ADMIN"],
  303. keepAlive: true,
  304. },
  305. },
  306. {
  307. path: "table",
  308. component: "demo/table",
  309. name: "Table",
  310. meta: {
  311. title: "表格",
  312. icon: "",
  313. hidden: false,
  314. roles: ["ADMIN"],
  315. keepAlive: true,
  316. },
  317. },
  318. {
  319. path: "examples",
  320. component: "demo/examples/index",
  321. name: "Examples1",
  322. meta: {
  323. title: "用例",
  324. icon: "",
  325. hidden: false,
  326. roles: ["ADMIN"],
  327. keepAlive: true,
  328. },
  329. },
  330. ],
  331. },
  332. {
  333. path: "/function",
  334. component: "Layout",
  335. name: "/function",
  336. meta: {
  337. title: "功能演示",
  338. icon: "menu",
  339. hidden: false,
  340. roles: ["ADMIN"],
  341. },
  342. children: [
  343. {
  344. path: "icon-demo",
  345. component: "demo/icons",
  346. name: "IconDemo",
  347. meta: {
  348. title: "Icons",
  349. icon: "el-icon-edit",
  350. hidden: false,
  351. roles: ["ADMIN"],
  352. keepAlive: true,
  353. },
  354. },
  355. {
  356. path: "/function/websocket",
  357. component: "demo/websocket",
  358. name: "/function/websocket",
  359. meta: {
  360. title: "Websocket",
  361. icon: "",
  362. hidden: false,
  363. roles: ["ADMIN"],
  364. keepAlive: true,
  365. },
  366. },
  367. {
  368. path: "other",
  369. component: "demo/other",
  370. name: "Other",
  371. meta: {
  372. title: "敬请期待...",
  373. icon: "",
  374. hidden: false,
  375. roles: ["ADMIN"],
  376. },
  377. },
  378. ],
  379. },
  380. ],
  381. msg: "一切ok",
  382. },
  383. },
  384. {
  385. url: "menus",
  386. method: ["GET"],
  387. body: {
  388. code: "00000",
  389. data: [
  390. {
  391. id: 1,
  392. parentId: 0,
  393. name: "系统管理",
  394. type: "CATALOG",
  395. path: "/system",
  396. component: "Layout",
  397. sort: 1,
  398. visible: 1,
  399. icon: "system",
  400. redirect: "/system/user",
  401. perm: null,
  402. children: [
  403. {
  404. id: 2,
  405. parentId: 1,
  406. name: "用户管理",
  407. type: "MENU",
  408. path: "user",
  409. component: "system/user/index",
  410. sort: 1,
  411. visible: 1,
  412. icon: "user",
  413. redirect: null,
  414. perm: null,
  415. children: [
  416. {
  417. id: 31,
  418. parentId: 2,
  419. name: "用户新增",
  420. type: "BUTTON",
  421. path: "",
  422. component: null,
  423. sort: 1,
  424. visible: 1,
  425. icon: "",
  426. redirect: "",
  427. perm: "sys:user:add",
  428. children: [],
  429. },
  430. {
  431. id: 32,
  432. parentId: 2,
  433. name: "用户编辑",
  434. type: "BUTTON",
  435. path: "",
  436. component: null,
  437. sort: 2,
  438. visible: 1,
  439. icon: "",
  440. redirect: "",
  441. perm: "sys:user:edit",
  442. children: [],
  443. },
  444. {
  445. id: 33,
  446. parentId: 2,
  447. name: "用户删除",
  448. type: "BUTTON",
  449. path: "",
  450. component: null,
  451. sort: 3,
  452. visible: 1,
  453. icon: "",
  454. redirect: "",
  455. perm: "sys:user:delete",
  456. children: [],
  457. },
  458. {
  459. id: 88,
  460. parentId: 2,
  461. name: "重置密码",
  462. type: "BUTTON",
  463. path: "",
  464. component: null,
  465. sort: 4,
  466. visible: 1,
  467. icon: "",
  468. redirect: null,
  469. perm: "sys:user:reset_pwd",
  470. children: [],
  471. },
  472. ],
  473. },
  474. {
  475. id: 3,
  476. parentId: 1,
  477. name: "角色管理",
  478. type: "MENU",
  479. path: "role",
  480. component: "system/role/index",
  481. sort: 2,
  482. visible: 1,
  483. icon: "role",
  484. redirect: null,
  485. perm: null,
  486. children: [
  487. {
  488. id: 70,
  489. parentId: 3,
  490. name: "角色新增",
  491. type: "BUTTON",
  492. path: "",
  493. component: null,
  494. sort: 1,
  495. visible: 1,
  496. icon: "",
  497. redirect: null,
  498. perm: "sys:role:add",
  499. children: [],
  500. },
  501. {
  502. id: 71,
  503. parentId: 3,
  504. name: "角色编辑",
  505. type: "BUTTON",
  506. path: "",
  507. component: null,
  508. sort: 2,
  509. visible: 1,
  510. icon: "",
  511. redirect: null,
  512. perm: "sys:role:edit",
  513. children: [],
  514. },
  515. {
  516. id: 72,
  517. parentId: 3,
  518. name: "角色删除",
  519. type: "BUTTON",
  520. path: "",
  521. component: null,
  522. sort: 3,
  523. visible: 1,
  524. icon: "",
  525. redirect: null,
  526. perm: "sys:role:delete",
  527. children: [],
  528. },
  529. ],
  530. },
  531. {
  532. id: 4,
  533. parentId: 1,
  534. name: "菜单管理",
  535. type: "MENU",
  536. path: "menu",
  537. component: "system/menu/index",
  538. sort: 3,
  539. visible: 1,
  540. icon: "menu",
  541. redirect: null,
  542. perm: null,
  543. children: [
  544. {
  545. id: 73,
  546. parentId: 4,
  547. name: "菜单新增",
  548. type: "BUTTON",
  549. path: "",
  550. component: null,
  551. sort: 1,
  552. visible: 1,
  553. icon: "",
  554. redirect: null,
  555. perm: "sys:menu:add",
  556. children: [],
  557. },
  558. {
  559. id: 74,
  560. parentId: 4,
  561. name: "菜单编辑",
  562. type: "BUTTON",
  563. path: "",
  564. component: null,
  565. sort: 3,
  566. visible: 1,
  567. icon: "",
  568. redirect: null,
  569. perm: "sys:menu:edit",
  570. children: [],
  571. },
  572. {
  573. id: 75,
  574. parentId: 4,
  575. name: "菜单删除",
  576. type: "BUTTON",
  577. path: "",
  578. component: null,
  579. sort: 3,
  580. visible: 1,
  581. icon: "",
  582. redirect: null,
  583. perm: "sys:menu:delete",
  584. children: [],
  585. },
  586. ],
  587. },
  588. {
  589. id: 5,
  590. parentId: 1,
  591. name: "部门管理",
  592. type: "MENU",
  593. path: "dept",
  594. component: "system/dept/index",
  595. sort: 4,
  596. visible: 1,
  597. icon: "tree",
  598. redirect: null,
  599. perm: null,
  600. children: [
  601. {
  602. id: 76,
  603. parentId: 5,
  604. name: "部门新增",
  605. type: "BUTTON",
  606. path: "",
  607. component: null,
  608. sort: 1,
  609. visible: 1,
  610. icon: "",
  611. redirect: null,
  612. perm: "sys:dept:add",
  613. children: [],
  614. },
  615. {
  616. id: 77,
  617. parentId: 5,
  618. name: "部门编辑",
  619. type: "BUTTON",
  620. path: "",
  621. component: null,
  622. sort: 2,
  623. visible: 1,
  624. icon: "",
  625. redirect: null,
  626. perm: "sys:dept:edit",
  627. children: [],
  628. },
  629. {
  630. id: 78,
  631. parentId: 5,
  632. name: "部门删除",
  633. type: "BUTTON",
  634. path: "",
  635. component: null,
  636. sort: 3,
  637. visible: 1,
  638. icon: "",
  639. redirect: null,
  640. perm: "sys:dept:delete",
  641. children: [],
  642. },
  643. ],
  644. },
  645. {
  646. id: 6,
  647. parentId: 1,
  648. name: "字典管理",
  649. type: "MENU",
  650. path: "dict",
  651. component: "system/dict/index",
  652. sort: 5,
  653. visible: 1,
  654. icon: "dict",
  655. redirect: null,
  656. perm: null,
  657. children: [
  658. {
  659. id: 79,
  660. parentId: 6,
  661. name: "字典类型新增",
  662. type: "BUTTON",
  663. path: "",
  664. component: null,
  665. sort: 1,
  666. visible: 1,
  667. icon: "",
  668. redirect: null,
  669. perm: "sys:dict_type:add",
  670. children: [],
  671. },
  672. {
  673. id: 81,
  674. parentId: 6,
  675. name: "字典类型编辑",
  676. type: "BUTTON",
  677. path: "",
  678. component: null,
  679. sort: 2,
  680. visible: 1,
  681. icon: "",
  682. redirect: null,
  683. perm: "sys:dict_type:edit",
  684. children: [],
  685. },
  686. {
  687. id: 84,
  688. parentId: 6,
  689. name: "字典类型删除",
  690. type: "BUTTON",
  691. path: "",
  692. component: null,
  693. sort: 3,
  694. visible: 1,
  695. icon: "",
  696. redirect: null,
  697. perm: "sys:dict_type:delete",
  698. children: [],
  699. },
  700. {
  701. id: 85,
  702. parentId: 6,
  703. name: "字典数据新增",
  704. type: "BUTTON",
  705. path: "",
  706. component: null,
  707. sort: 4,
  708. visible: 1,
  709. icon: "",
  710. redirect: null,
  711. perm: "sys:dict:add",
  712. children: [],
  713. },
  714. {
  715. id: 86,
  716. parentId: 6,
  717. name: "字典数据编辑",
  718. type: "BUTTON",
  719. path: "",
  720. component: null,
  721. sort: 5,
  722. visible: 1,
  723. icon: "",
  724. redirect: null,
  725. perm: "sys:dict:edit",
  726. children: [],
  727. },
  728. {
  729. id: 87,
  730. parentId: 6,
  731. name: "字典数据删除",
  732. type: "BUTTON",
  733. path: "",
  734. component: null,
  735. sort: 6,
  736. visible: 1,
  737. icon: "",
  738. redirect: null,
  739. perm: "sys:dict:delete",
  740. children: [],
  741. },
  742. ],
  743. },
  744. ],
  745. },
  746. {
  747. id: 40,
  748. parentId: 0,
  749. name: "接口文档",
  750. type: "CATALOG",
  751. path: "/api",
  752. component: "Layout",
  753. sort: 7,
  754. visible: 1,
  755. icon: "api",
  756. redirect: "",
  757. perm: null,
  758. children: [
  759. {
  760. id: 41,
  761. parentId: 40,
  762. name: "Apifox",
  763. type: "MENU",
  764. path: "apifox",
  765. component: "demo/api/apifox",
  766. sort: 1,
  767. visible: 1,
  768. icon: "api",
  769. redirect: "",
  770. perm: null,
  771. children: [],
  772. },
  773. {
  774. id: 103,
  775. parentId: 40,
  776. name: "Swagger",
  777. type: "MENU",
  778. path: "swagger",
  779. component: "demo/api/swagger",
  780. sort: 2,
  781. visible: 0,
  782. icon: "api",
  783. redirect: "",
  784. perm: null,
  785. children: [],
  786. },
  787. {
  788. id: 104,
  789. parentId: 40,
  790. name: "Knife4j",
  791. type: "MENU",
  792. path: "knife4j",
  793. component: "demo/api/knife4j",
  794. sort: 3,
  795. visible: 0,
  796. icon: "api",
  797. redirect: "",
  798. perm: null,
  799. children: [],
  800. },
  801. ],
  802. },
  803. {
  804. id: 26,
  805. parentId: 0,
  806. name: "平台文档",
  807. type: "CATALOG",
  808. path: "/doc",
  809. component: "Layout",
  810. sort: 8,
  811. visible: 1,
  812. icon: "document",
  813. redirect: null,
  814. perm: null,
  815. children: [
  816. {
  817. id: 102,
  818. parentId: 26,
  819. name: "平台文档(内嵌)",
  820. type: "EXTLINK",
  821. path: "internal-doc",
  822. component: "demo/internal-doc",
  823. sort: 1,
  824. visible: 1,
  825. icon: "document",
  826. redirect: "",
  827. perm: null,
  828. children: [],
  829. },
  830. {
  831. id: 30,
  832. parentId: 26,
  833. name: "平台文档(外链)",
  834. type: "EXTLINK",
  835. path: "https://juejin.cn/post/7228990409909108793",
  836. component: "",
  837. sort: 2,
  838. visible: 1,
  839. icon: "link",
  840. redirect: "",
  841. perm: null,
  842. children: [],
  843. },
  844. ],
  845. },
  846. {
  847. id: 20,
  848. parentId: 0,
  849. name: "多级菜单",
  850. type: "CATALOG",
  851. path: "/multi-level",
  852. component: "Layout",
  853. sort: 9,
  854. visible: 1,
  855. icon: "cascader",
  856. redirect: "/multi-level/multi-level1",
  857. perm: null,
  858. children: [
  859. {
  860. id: 21,
  861. parentId: 20,
  862. name: "菜单一级",
  863. type: "MENU",
  864. path: "multi-level1",
  865. component: "demo/multi-level/level1",
  866. sort: 1,
  867. visible: 1,
  868. icon: "",
  869. redirect: "/multi-level/multi-level2",
  870. perm: null,
  871. children: [
  872. {
  873. id: 22,
  874. parentId: 21,
  875. name: "菜单二级",
  876. type: "MENU",
  877. path: "multi-level2",
  878. component: "demo/multi-level/children/level2",
  879. sort: 1,
  880. visible: 1,
  881. icon: "",
  882. redirect: "/multi-level/multi-level2/multi-level3-1",
  883. perm: null,
  884. children: [
  885. {
  886. id: 23,
  887. parentId: 22,
  888. name: "菜单三级-1",
  889. type: "MENU",
  890. path: "multi-level3-1",
  891. component: "demo/multi-level/children/children/level3-1",
  892. sort: 1,
  893. visible: 1,
  894. icon: "",
  895. redirect: "",
  896. perm: null,
  897. children: [],
  898. },
  899. {
  900. id: 24,
  901. parentId: 22,
  902. name: "菜单三级-2",
  903. type: "MENU",
  904. path: "multi-level3-2",
  905. component: "demo/multi-level/children/children/level3-2",
  906. sort: 2,
  907. visible: 1,
  908. icon: "",
  909. redirect: "",
  910. perm: null,
  911. children: [],
  912. },
  913. ],
  914. },
  915. ],
  916. },
  917. ],
  918. },
  919. {
  920. id: 36,
  921. parentId: 0,
  922. name: "组件封装",
  923. type: "CATALOG",
  924. path: "/component",
  925. component: "Layout",
  926. sort: 10,
  927. visible: 1,
  928. icon: "menu",
  929. redirect: "",
  930. perm: null,
  931. children: [
  932. {
  933. id: 37,
  934. parentId: 36,
  935. name: "富文本编辑器",
  936. type: "MENU",
  937. path: "wang-editor",
  938. component: "demo/wang-editor",
  939. sort: 1,
  940. visible: 1,
  941. icon: "",
  942. redirect: "",
  943. perm: null,
  944. children: [],
  945. },
  946. {
  947. id: 38,
  948. parentId: 36,
  949. name: "图片上传",
  950. type: "MENU",
  951. path: "upload",
  952. component: "demo/upload",
  953. sort: 2,
  954. visible: 1,
  955. icon: "",
  956. redirect: "",
  957. perm: null,
  958. children: [],
  959. },
  960. {
  961. id: 39,
  962. parentId: 36,
  963. name: "图标选择器",
  964. type: "MENU",
  965. path: "icon-selector",
  966. component: "demo/icon-selector",
  967. sort: 3,
  968. visible: 1,
  969. icon: "",
  970. redirect: "",
  971. perm: null,
  972. children: [],
  973. },
  974. {
  975. id: 95,
  976. parentId: 36,
  977. name: "字典组件",
  978. type: "MENU",
  979. path: "dict-demo",
  980. component: "demo/dict",
  981. sort: 4,
  982. visible: 1,
  983. icon: "",
  984. redirect: "",
  985. perm: null,
  986. children: [],
  987. },
  988. {
  989. id: 93,
  990. parentId: 36,
  991. name: "签名",
  992. type: "MENU",
  993. path: "signature",
  994. component: "demo/signature",
  995. sort: 6,
  996. visible: 1,
  997. icon: "",
  998. redirect: "",
  999. perm: null,
  1000. children: [],
  1001. },
  1002. {
  1003. id: 94,
  1004. parentId: 36,
  1005. name: "表格",
  1006. type: "MENU",
  1007. path: "table",
  1008. component: "demo/table",
  1009. sort: 7,
  1010. visible: 1,
  1011. icon: "",
  1012. redirect: "",
  1013. perm: null,
  1014. children: [],
  1015. },
  1016. {
  1017. id: 95,
  1018. parentId: 36,
  1019. name: "用例",
  1020. type: "MENU",
  1021. path: "examples",
  1022. component: "demo/examples/index",
  1023. sort: 8,
  1024. visible: 1,
  1025. icon: "",
  1026. redirect: "",
  1027. perm: null,
  1028. children: [],
  1029. },
  1030. ],
  1031. },
  1032. {
  1033. id: 89,
  1034. parentId: 0,
  1035. name: "功能演示",
  1036. type: "CATALOG",
  1037. path: "/function",
  1038. component: "Layout",
  1039. sort: 11,
  1040. visible: 1,
  1041. icon: "menu",
  1042. redirect: "",
  1043. perm: null,
  1044. children: [
  1045. {
  1046. id: 97,
  1047. parentId: 89,
  1048. name: "Icons",
  1049. type: "MENU",
  1050. path: "icon-demo",
  1051. component: "demo/icons",
  1052. sort: 2,
  1053. visible: 1,
  1054. icon: "el-icon-edit",
  1055. redirect: "",
  1056. perm: null,
  1057. children: [],
  1058. },
  1059. {
  1060. id: 90,
  1061. parentId: 89,
  1062. name: "Websocket",
  1063. type: "MENU",
  1064. path: "/function/websocket",
  1065. component: "demo/websocket",
  1066. sort: 3,
  1067. visible: 1,
  1068. icon: "",
  1069. redirect: "",
  1070. perm: null,
  1071. children: [],
  1072. },
  1073. {
  1074. id: 91,
  1075. parentId: 89,
  1076. name: "敬请期待...",
  1077. type: "CATALOG",
  1078. path: "other",
  1079. component: "demo/other",
  1080. sort: 4,
  1081. visible: 1,
  1082. icon: "",
  1083. redirect: "",
  1084. perm: null,
  1085. children: [],
  1086. },
  1087. ],
  1088. },
  1089. ],
  1090. msg: "一切ok",
  1091. },
  1092. },
  1093. {
  1094. url: "menus/options",
  1095. method: ["GET"],
  1096. body: {
  1097. code: "00000",
  1098. data: [
  1099. {
  1100. value: 1,
  1101. label: "系统管理",
  1102. children: [
  1103. {
  1104. value: 2,
  1105. label: "用户管理",
  1106. children: [
  1107. {
  1108. value: 31,
  1109. label: "用户新增",
  1110. },
  1111. {
  1112. value: 32,
  1113. label: "用户编辑",
  1114. },
  1115. {
  1116. value: 33,
  1117. label: "用户删除",
  1118. },
  1119. {
  1120. value: 88,
  1121. label: "重置密码",
  1122. },
  1123. ],
  1124. },
  1125. {
  1126. value: 3,
  1127. label: "角色管理",
  1128. children: [
  1129. {
  1130. value: 70,
  1131. label: "角色新增",
  1132. },
  1133. {
  1134. value: 71,
  1135. label: "角色编辑",
  1136. },
  1137. {
  1138. value: 72,
  1139. label: "角色删除",
  1140. },
  1141. ],
  1142. },
  1143. {
  1144. value: 4,
  1145. label: "菜单管理",
  1146. children: [
  1147. {
  1148. value: 73,
  1149. label: "菜单新增",
  1150. },
  1151. {
  1152. value: 74,
  1153. label: "菜单编辑",
  1154. },
  1155. {
  1156. value: 75,
  1157. label: "菜单删除",
  1158. },
  1159. ],
  1160. },
  1161. {
  1162. value: 5,
  1163. label: "部门管理",
  1164. children: [
  1165. {
  1166. value: 76,
  1167. label: "部门新增",
  1168. },
  1169. {
  1170. value: 77,
  1171. label: "部门编辑",
  1172. },
  1173. {
  1174. value: 78,
  1175. label: "部门删除",
  1176. },
  1177. ],
  1178. },
  1179. {
  1180. value: 6,
  1181. label: "字典管理",
  1182. children: [
  1183. {
  1184. value: 79,
  1185. label: "字典类型新增",
  1186. },
  1187. {
  1188. value: 81,
  1189. label: "字典类型编辑",
  1190. },
  1191. {
  1192. value: 84,
  1193. label: "字典类型删除",
  1194. },
  1195. {
  1196. value: 85,
  1197. label: "字典数据新增",
  1198. },
  1199. {
  1200. value: 86,
  1201. label: "字典数据编辑",
  1202. },
  1203. {
  1204. value: 87,
  1205. label: "字典数据删除",
  1206. },
  1207. ],
  1208. },
  1209. ],
  1210. },
  1211. {
  1212. value: 40,
  1213. label: "接口文档",
  1214. children: [
  1215. {
  1216. value: 41,
  1217. label: "Apifox",
  1218. },
  1219. {
  1220. value: 103,
  1221. label: "Swagger",
  1222. },
  1223. {
  1224. value: 104,
  1225. label: "Knife4j",
  1226. },
  1227. ],
  1228. },
  1229. {
  1230. value: 26,
  1231. label: "平台文档",
  1232. children: [
  1233. {
  1234. value: 102,
  1235. label: "平台文档(内嵌)",
  1236. },
  1237. {
  1238. value: 30,
  1239. label: "平台文档(外链)",
  1240. },
  1241. ],
  1242. },
  1243. {
  1244. value: 20,
  1245. label: "多级菜单",
  1246. children: [
  1247. {
  1248. value: 21,
  1249. label: "菜单一级",
  1250. children: [
  1251. {
  1252. value: 22,
  1253. label: "菜单二级",
  1254. children: [
  1255. {
  1256. value: 23,
  1257. label: "菜单三级-1",
  1258. },
  1259. {
  1260. value: 24,
  1261. label: "菜单三级-2",
  1262. },
  1263. ],
  1264. },
  1265. ],
  1266. },
  1267. ],
  1268. },
  1269. {
  1270. value: 36,
  1271. label: "组件封装",
  1272. children: [
  1273. {
  1274. value: 37,
  1275. label: "富文本编辑器",
  1276. },
  1277. {
  1278. value: 38,
  1279. label: "图片上传",
  1280. },
  1281. {
  1282. value: 39,
  1283. label: "图标选择器",
  1284. },
  1285. {
  1286. value: 95,
  1287. label: "字典组件",
  1288. },
  1289. {
  1290. value: 93,
  1291. label: "签名",
  1292. },
  1293. {
  1294. value: 94,
  1295. label: "表格",
  1296. },
  1297. ],
  1298. },
  1299. {
  1300. value: 89,
  1301. label: "功能演示",
  1302. children: [
  1303. {
  1304. value: 97,
  1305. label: "Icons",
  1306. },
  1307. {
  1308. value: 90,
  1309. label: "Websocket",
  1310. },
  1311. {
  1312. value: 91,
  1313. label: "敬请期待...",
  1314. },
  1315. ],
  1316. },
  1317. ],
  1318. msg: "一切ok",
  1319. },
  1320. },
  1321. // 新增菜单
  1322. {
  1323. url: "menus",
  1324. method: ["POST"],
  1325. body({ body }) {
  1326. return {
  1327. code: "00000",
  1328. data: null,
  1329. msg: "新增菜单" + body.name + "成功",
  1330. };
  1331. },
  1332. },
  1333. // 获取菜单表单数据
  1334. {
  1335. url: "menus/:id/form",
  1336. method: ["GET"],
  1337. body: ({ params }) => {
  1338. return {
  1339. code: "00000",
  1340. data: menuMap[params.id],
  1341. msg: "一切ok",
  1342. };
  1343. },
  1344. },
  1345. // 修改菜单
  1346. {
  1347. url: "menus/:id",
  1348. method: ["PUT"],
  1349. body({ body }) {
  1350. return {
  1351. code: "00000",
  1352. data: null,
  1353. msg: "修改菜单" + body.name + "成功",
  1354. };
  1355. },
  1356. },
  1357. // 删除菜单
  1358. {
  1359. url: "menus/:id",
  1360. method: ["DELETE"],
  1361. body({ params }) {
  1362. return {
  1363. code: "00000",
  1364. data: null,
  1365. msg: "删除菜单" + params.id + "成功",
  1366. };
  1367. },
  1368. },
  1369. ]);
  1370. // 菜单映射表数据
  1371. const menuMap: Record<string, any> = {
  1372. 1: {
  1373. id: 1,
  1374. parentId: 0,
  1375. name: "系统管理",
  1376. type: "CATALOG",
  1377. path: "/system",
  1378. component: "Layout",
  1379. perm: null,
  1380. visible: 1,
  1381. sort: 1,
  1382. icon: "system",
  1383. redirect: "/system/user",
  1384. keepAlive: null,
  1385. alwaysShow: null,
  1386. },
  1387. 2: {
  1388. id: 2,
  1389. parentId: 1,
  1390. name: "用户管理",
  1391. type: "MENU",
  1392. path: "user",
  1393. component: "system/user/index",
  1394. perm: null,
  1395. visible: 1,
  1396. sort: 1,
  1397. icon: "user",
  1398. redirect: null,
  1399. keepAlive: 1,
  1400. alwaysShow: null,
  1401. },
  1402. 3: {
  1403. id: 3,
  1404. parentId: 1,
  1405. name: "角色管理",
  1406. type: "MENU",
  1407. path: "role",
  1408. component: "system/role/index",
  1409. perm: null,
  1410. visible: 1,
  1411. sort: 2,
  1412. icon: "role",
  1413. redirect: null,
  1414. keepAlive: 1,
  1415. alwaysShow: null,
  1416. },
  1417. 4: {
  1418. id: 4,
  1419. parentId: 1,
  1420. name: "菜单管理",
  1421. type: "MENU",
  1422. path: "menu",
  1423. component: "system/menu/index",
  1424. perm: null,
  1425. visible: 1,
  1426. sort: 3,
  1427. icon: "menu",
  1428. redirect: null,
  1429. keepAlive: 1,
  1430. alwaysShow: null,
  1431. },
  1432. 5: {
  1433. id: 5,
  1434. parentId: 1,
  1435. name: "部门管理",
  1436. type: "MENU",
  1437. path: "dept",
  1438. component: "system/dept/index",
  1439. perm: null,
  1440. visible: 1,
  1441. sort: 4,
  1442. icon: "tree",
  1443. redirect: null,
  1444. keepAlive: 1,
  1445. alwaysShow: null,
  1446. },
  1447. 6: {
  1448. id: 6,
  1449. parentId: 1,
  1450. name: "字典管理",
  1451. type: "MENU",
  1452. path: "dict",
  1453. component: "system/dict/index",
  1454. perm: null,
  1455. visible: 1,
  1456. sort: 5,
  1457. icon: "dict",
  1458. redirect: null,
  1459. keepAlive: 1,
  1460. alwaysShow: null,
  1461. },
  1462. };