system.ts 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415
  1. import { defineFakeRoute } from "vite-plugin-fake-server/client";
  2. import { faker } from "@faker-js/faker/locale/zh_CN";
  3. export default defineFakeRoute([
  4. // 用户管理
  5. {
  6. url: "/user",
  7. method: "post",
  8. response: ({ body }) => {
  9. let list = [
  10. {
  11. username: "admin",
  12. nickname: "admin",
  13. avatar: "https://avatars.githubusercontent.com/u/44761321",
  14. phone: "15888886789",
  15. email: faker.internet.email(),
  16. sex: 0,
  17. id: 1,
  18. status: 1,
  19. dept: {
  20. // 部门id
  21. id: 103,
  22. // 部门名称
  23. name: "研发部门"
  24. },
  25. remark: "管理员",
  26. createTime: 1605456000000
  27. },
  28. {
  29. username: "common",
  30. nickname: "common",
  31. avatar: "https://avatars.githubusercontent.com/u/52823142",
  32. phone: "18288882345",
  33. email: faker.internet.email(),
  34. sex: 1,
  35. id: 2,
  36. status: 1,
  37. dept: {
  38. id: 105,
  39. name: "测试部门"
  40. },
  41. remark: "普通用户",
  42. createTime: 1605456000000
  43. }
  44. ];
  45. list = list.filter(item => item.username.includes(body?.username));
  46. list = list.filter(item =>
  47. String(item.status).includes(String(body?.status))
  48. );
  49. if (body.phone) list = list.filter(item => item.phone === body.phone);
  50. if (body.deptId) list = list.filter(item => item.dept.id === body.deptId);
  51. return {
  52. success: true,
  53. data: {
  54. list,
  55. total: list.length, // 总条目数
  56. pageSize: 10, // 每页显示条目个数
  57. currentPage: 1 // 当前页数
  58. }
  59. };
  60. }
  61. },
  62. // 用户管理-获取所有角色列表
  63. {
  64. url: "/list-all-role",
  65. method: "get",
  66. response: () => {
  67. return {
  68. success: true,
  69. data: [
  70. { id: 1, name: "超级管理员" },
  71. { id: 2, name: "普通角色" }
  72. ]
  73. };
  74. }
  75. },
  76. // 用户管理-根据 userId 获取对应角色 id 列表(userId:用户id)
  77. {
  78. url: "/list-role-ids",
  79. method: "post",
  80. response: ({ body }) => {
  81. if (body.userId) {
  82. if (body.userId == 1) {
  83. return {
  84. success: true,
  85. data: [1]
  86. };
  87. } else if (body.userId == 2) {
  88. return {
  89. success: true,
  90. data: [2]
  91. };
  92. }
  93. } else {
  94. return {
  95. success: false,
  96. data: []
  97. };
  98. }
  99. }
  100. },
  101. // 角色管理
  102. {
  103. url: "/role",
  104. method: "post",
  105. response: ({ body }) => {
  106. let list = [
  107. {
  108. createTime: 1605456000000, // 时间戳(毫秒ms)
  109. updateTime: 1684512000000,
  110. id: 1,
  111. name: "超级管理员",
  112. code: "admin",
  113. status: 1, // 状态 1 启用 0 停用
  114. remark: "超级管理员拥有最高权限"
  115. },
  116. {
  117. createTime: 1605456000000,
  118. updateTime: 1684512000000,
  119. id: 2,
  120. name: "普通角色",
  121. code: "common",
  122. status: 1,
  123. remark: "普通角色拥有部分权限"
  124. }
  125. ];
  126. list = list.filter(item => item.name.includes(body?.name));
  127. list = list.filter(item =>
  128. String(item.status).includes(String(body?.status))
  129. );
  130. if (body.code) list = list.filter(item => item.code === body.code);
  131. return {
  132. success: true,
  133. data: {
  134. list,
  135. total: list.length, // 总条目数
  136. pageSize: 10, // 每页显示条目个数
  137. currentPage: 1 // 当前页数
  138. }
  139. };
  140. }
  141. },
  142. // 菜单管理
  143. {
  144. url: "/menu",
  145. method: "post",
  146. response: () => {
  147. return {
  148. success: true,
  149. data: [
  150. // 外部页面
  151. {
  152. parentId: 0,
  153. id: 100,
  154. menuType: 0, // 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
  155. title: "menus.hsExternalPage",
  156. name: "PureIframe",
  157. path: "/iframe",
  158. component: "",
  159. rank: 7,
  160. redirect: "",
  161. icon: "ri:links-fill",
  162. extraIcon: "",
  163. enterTransition: "",
  164. leaveTransition: "",
  165. activePath: "",
  166. auths: "",
  167. frameSrc: "",
  168. frameLoading: true,
  169. keepAlive: false,
  170. hiddenTag: false,
  171. showLink: true,
  172. showParent: false
  173. },
  174. {
  175. parentId: 100,
  176. id: 101,
  177. menuType: 0,
  178. title: "menus.hsExternalDoc",
  179. name: "PureIframeExternal",
  180. path: "/iframe/external",
  181. component: "",
  182. rank: null,
  183. redirect: "",
  184. icon: "",
  185. extraIcon: "",
  186. enterTransition: "",
  187. leaveTransition: "",
  188. activePath: "",
  189. auths: "",
  190. frameSrc: "",
  191. frameLoading: true,
  192. keepAlive: false,
  193. hiddenTag: false,
  194. showLink: true,
  195. showParent: false
  196. },
  197. {
  198. parentId: 101,
  199. id: 102,
  200. menuType: 2,
  201. title: "menus.externalLink",
  202. name: "https://yiming_chang.gitee.io/pure-admin-doc",
  203. path: "/external",
  204. component: "",
  205. rank: null,
  206. redirect: "",
  207. icon: "",
  208. extraIcon: "",
  209. enterTransition: "",
  210. leaveTransition: "",
  211. activePath: "",
  212. auths: "",
  213. frameSrc: "",
  214. frameLoading: true,
  215. keepAlive: false,
  216. hiddenTag: false,
  217. showLink: true,
  218. showParent: false
  219. },
  220. {
  221. parentId: 101,
  222. id: 103,
  223. menuType: 2,
  224. title: "menus.pureutilsLink",
  225. name: "https://pure-admin-utils.netlify.app/",
  226. path: "/pureutilsLink",
  227. component: "",
  228. rank: null,
  229. redirect: "",
  230. icon: "",
  231. extraIcon: "",
  232. enterTransition: "",
  233. leaveTransition: "",
  234. activePath: "",
  235. auths: "",
  236. frameSrc: "",
  237. frameLoading: true,
  238. keepAlive: false,
  239. hiddenTag: false,
  240. showLink: true,
  241. showParent: false
  242. },
  243. {
  244. parentId: 100,
  245. id: 104,
  246. menuType: 1,
  247. title: "menus.hsEmbeddedDoc",
  248. name: "PureIframeEmbedded",
  249. path: "/iframe/embedded",
  250. component: "",
  251. rank: null,
  252. redirect: "",
  253. icon: "",
  254. extraIcon: "",
  255. enterTransition: "",
  256. leaveTransition: "",
  257. activePath: "",
  258. auths: "",
  259. frameSrc: "",
  260. frameLoading: true,
  261. keepAlive: false,
  262. hiddenTag: false,
  263. showLink: true,
  264. showParent: false
  265. },
  266. {
  267. parentId: 104,
  268. id: 105,
  269. menuType: 1,
  270. title: "menus.hsEpDocument",
  271. name: "FrameEp",
  272. path: "/iframe/ep",
  273. component: "",
  274. rank: null,
  275. redirect: "",
  276. icon: "",
  277. extraIcon: "",
  278. enterTransition: "",
  279. leaveTransition: "",
  280. activePath: "",
  281. auths: "",
  282. frameSrc: "https://element-plus.org/zh-CN/",
  283. frameLoading: true,
  284. keepAlive: true,
  285. hiddenTag: false,
  286. showLink: true,
  287. showParent: false
  288. },
  289. {
  290. parentId: 104,
  291. id: 106,
  292. menuType: 1,
  293. title: "menus.hsTailwindcssDocument",
  294. name: "FrameTailwindcss",
  295. path: "/iframe/tailwindcss",
  296. component: "",
  297. rank: null,
  298. redirect: "",
  299. icon: "",
  300. extraIcon: "",
  301. enterTransition: "",
  302. leaveTransition: "",
  303. activePath: "",
  304. auths: "",
  305. frameSrc: "https://tailwindcss.com/docs/installation",
  306. frameLoading: true,
  307. keepAlive: true,
  308. hiddenTag: false,
  309. showLink: true,
  310. showParent: false
  311. },
  312. {
  313. parentId: 104,
  314. id: 107,
  315. menuType: 1,
  316. title: "menus.hsVueDocument",
  317. name: "FrameVue",
  318. path: "/iframe/vue3",
  319. component: "",
  320. rank: null,
  321. redirect: "",
  322. icon: "",
  323. extraIcon: "",
  324. enterTransition: "",
  325. leaveTransition: "",
  326. activePath: "",
  327. auths: "",
  328. frameSrc: "https://cn.vuejs.org/",
  329. frameLoading: true,
  330. keepAlive: true,
  331. hiddenTag: false,
  332. showLink: true,
  333. showParent: false
  334. },
  335. {
  336. parentId: 104,
  337. id: 108,
  338. menuType: 1,
  339. title: "menus.hsViteDocument",
  340. name: "FrameVite",
  341. path: "/iframe/vite",
  342. component: "",
  343. rank: null,
  344. redirect: "",
  345. icon: "",
  346. extraIcon: "",
  347. enterTransition: "",
  348. leaveTransition: "",
  349. activePath: "",
  350. auths: "",
  351. frameSrc: "https://cn.vitejs.dev/",
  352. frameLoading: true,
  353. keepAlive: true,
  354. hiddenTag: false,
  355. showLink: true,
  356. showParent: false
  357. },
  358. {
  359. parentId: 104,
  360. id: 109,
  361. menuType: 1,
  362. title: "menus.hsPiniaDocument",
  363. name: "FramePinia",
  364. path: "/iframe/pinia",
  365. component: "",
  366. rank: null,
  367. redirect: "",
  368. icon: "",
  369. extraIcon: "",
  370. enterTransition: "",
  371. leaveTransition: "",
  372. activePath: "",
  373. auths: "",
  374. frameSrc: "https://pinia.vuejs.org/zh/index.html",
  375. frameLoading: true,
  376. keepAlive: true,
  377. hiddenTag: false,
  378. showLink: true,
  379. showParent: false
  380. },
  381. {
  382. parentId: 104,
  383. id: 110,
  384. menuType: 1,
  385. title: "menus.hsRouterDocument",
  386. name: "FrameRouter",
  387. path: "/iframe/vue-router",
  388. component: "",
  389. rank: null,
  390. redirect: "",
  391. icon: "",
  392. extraIcon: "",
  393. enterTransition: "",
  394. leaveTransition: "",
  395. activePath: "",
  396. auths: "",
  397. frameSrc: "https://router.vuejs.org/zh/",
  398. frameLoading: true,
  399. keepAlive: true,
  400. hiddenTag: false,
  401. showLink: true,
  402. showParent: false
  403. },
  404. // 权限管理
  405. {
  406. parentId: 0,
  407. id: 200,
  408. menuType: 0,
  409. title: "menus.permission",
  410. name: "PurePermission",
  411. path: "/permission",
  412. component: "",
  413. rank: 9,
  414. redirect: "",
  415. icon: "ep:lollipop",
  416. extraIcon: "",
  417. enterTransition: "",
  418. leaveTransition: "",
  419. activePath: "",
  420. auths: "",
  421. frameSrc: "",
  422. frameLoading: true,
  423. keepAlive: false,
  424. hiddenTag: false,
  425. showLink: true,
  426. showParent: false
  427. },
  428. {
  429. parentId: 200,
  430. id: 201,
  431. menuType: 0,
  432. title: "menus.permissionPage",
  433. name: "PermissionPage",
  434. path: "/permission/page/index",
  435. component: "",
  436. rank: null,
  437. redirect: "",
  438. icon: "",
  439. extraIcon: "",
  440. enterTransition: "",
  441. leaveTransition: "",
  442. activePath: "",
  443. auths: "",
  444. frameSrc: "",
  445. frameLoading: true,
  446. keepAlive: false,
  447. hiddenTag: false,
  448. showLink: true,
  449. showParent: false
  450. },
  451. {
  452. parentId: 200,
  453. id: 202,
  454. menuType: 0,
  455. title: "menus.permissionButton",
  456. name: "PermissionButton",
  457. path: "/permission/button/index",
  458. component: "",
  459. rank: null,
  460. redirect: "",
  461. icon: "",
  462. extraIcon: "",
  463. enterTransition: "",
  464. leaveTransition: "",
  465. activePath: "",
  466. auths: "",
  467. frameSrc: "",
  468. frameLoading: true,
  469. keepAlive: false,
  470. hiddenTag: false,
  471. showLink: true,
  472. showParent: false
  473. },
  474. {
  475. parentId: 202,
  476. id: 203,
  477. menuType: 3,
  478. title: "添加",
  479. name: "",
  480. path: "",
  481. component: "",
  482. rank: null,
  483. redirect: "",
  484. icon: "",
  485. extraIcon: "",
  486. enterTransition: "",
  487. leaveTransition: "",
  488. activePath: "",
  489. auths: "permission:btn:add",
  490. frameSrc: "",
  491. frameLoading: true,
  492. keepAlive: false,
  493. hiddenTag: false,
  494. showLink: true,
  495. showParent: false
  496. },
  497. {
  498. parentId: 202,
  499. id: 204,
  500. menuType: 3,
  501. title: "修改",
  502. name: "",
  503. path: "",
  504. component: "",
  505. rank: null,
  506. redirect: "",
  507. icon: "",
  508. extraIcon: "",
  509. enterTransition: "",
  510. leaveTransition: "",
  511. activePath: "",
  512. auths: "permission:btn:edit",
  513. frameSrc: "",
  514. frameLoading: true,
  515. keepAlive: false,
  516. hiddenTag: false,
  517. showLink: true,
  518. showParent: false
  519. },
  520. {
  521. parentId: 202,
  522. id: 205,
  523. menuType: 3,
  524. title: "删除",
  525. name: "",
  526. path: "",
  527. component: "",
  528. rank: null,
  529. redirect: "",
  530. icon: "",
  531. extraIcon: "",
  532. enterTransition: "",
  533. leaveTransition: "",
  534. activePath: "",
  535. auths: "permission:btn:delete",
  536. frameSrc: "",
  537. frameLoading: true,
  538. keepAlive: false,
  539. hiddenTag: false,
  540. showLink: true,
  541. showParent: false
  542. },
  543. // 系统管理
  544. {
  545. parentId: 0,
  546. id: 300,
  547. menuType: 0,
  548. title: "menus.hssysManagement",
  549. name: "PureSystem",
  550. path: "/system",
  551. component: "",
  552. rank: 10,
  553. redirect: "",
  554. icon: "ri:settings-3-line",
  555. extraIcon: "",
  556. enterTransition: "",
  557. leaveTransition: "",
  558. activePath: "",
  559. auths: "",
  560. frameSrc: "",
  561. frameLoading: true,
  562. keepAlive: false,
  563. hiddenTag: false,
  564. showLink: true,
  565. showParent: false
  566. },
  567. {
  568. parentId: 300,
  569. id: 301,
  570. menuType: 0,
  571. title: "menus.hsUser",
  572. name: "SystemUser",
  573. path: "/system/user/index",
  574. component: "",
  575. rank: null,
  576. redirect: "",
  577. icon: "ri:admin-line",
  578. extraIcon: "",
  579. enterTransition: "",
  580. leaveTransition: "",
  581. activePath: "",
  582. auths: "",
  583. frameSrc: "",
  584. frameLoading: true,
  585. keepAlive: false,
  586. hiddenTag: false,
  587. showLink: true,
  588. showParent: false
  589. },
  590. {
  591. parentId: 300,
  592. id: 302,
  593. menuType: 0,
  594. title: "menus.hsRole",
  595. name: "SystemRole",
  596. path: "/system/role/index",
  597. component: "",
  598. rank: null,
  599. redirect: "",
  600. icon: "ri:admin-fill",
  601. extraIcon: "",
  602. enterTransition: "",
  603. leaveTransition: "",
  604. activePath: "",
  605. auths: "",
  606. frameSrc: "",
  607. frameLoading: true,
  608. keepAlive: false,
  609. hiddenTag: false,
  610. showLink: true,
  611. showParent: false
  612. },
  613. {
  614. parentId: 300,
  615. id: 303,
  616. menuType: 0,
  617. title: "menus.hsSystemMenu",
  618. name: "SystemMenu",
  619. path: "/system/menu/index",
  620. component: "",
  621. rank: null,
  622. redirect: "",
  623. icon: "ep:menu",
  624. extraIcon: "",
  625. enterTransition: "",
  626. leaveTransition: "",
  627. activePath: "",
  628. auths: "",
  629. frameSrc: "",
  630. frameLoading: true,
  631. keepAlive: false,
  632. hiddenTag: false,
  633. showLink: true,
  634. showParent: false
  635. },
  636. {
  637. parentId: 300,
  638. id: 304,
  639. menuType: 0,
  640. title: "menus.hsDept",
  641. name: "SystemDept",
  642. path: "/system/dept/index",
  643. component: "",
  644. rank: null,
  645. redirect: "",
  646. icon: "ri:git-branch-line",
  647. extraIcon: "",
  648. enterTransition: "",
  649. leaveTransition: "",
  650. activePath: "",
  651. auths: "",
  652. frameSrc: "",
  653. frameLoading: true,
  654. keepAlive: false,
  655. hiddenTag: false,
  656. showLink: true,
  657. showParent: false
  658. },
  659. // 系统监控
  660. {
  661. parentId: 0,
  662. id: 400,
  663. menuType: 0,
  664. title: "menus.hssysMonitor",
  665. name: "PureMonitor",
  666. path: "/monitor",
  667. component: "",
  668. rank: 11,
  669. redirect: "",
  670. icon: "ep:monitor",
  671. extraIcon: "",
  672. enterTransition: "",
  673. leaveTransition: "",
  674. activePath: "",
  675. auths: "",
  676. frameSrc: "",
  677. frameLoading: true,
  678. keepAlive: false,
  679. hiddenTag: false,
  680. showLink: true,
  681. showParent: false
  682. },
  683. {
  684. parentId: 400,
  685. id: 401,
  686. menuType: 0,
  687. title: "menus.hsOnlineUser",
  688. name: "OnlineUser",
  689. path: "/monitor/online-user",
  690. component: "monitor/online/index",
  691. rank: null,
  692. redirect: "",
  693. icon: "ri:user-voice-line",
  694. extraIcon: "",
  695. enterTransition: "",
  696. leaveTransition: "",
  697. activePath: "",
  698. auths: "",
  699. frameSrc: "",
  700. frameLoading: true,
  701. keepAlive: false,
  702. hiddenTag: false,
  703. showLink: true,
  704. showParent: false
  705. },
  706. {
  707. parentId: 400,
  708. id: 402,
  709. menuType: 0,
  710. title: "menus.hsLoginLog",
  711. name: "LoginLog",
  712. path: "/monitor/login-logs",
  713. component: "monitor/logs/login/index",
  714. rank: null,
  715. redirect: "",
  716. icon: "ri:window-line",
  717. extraIcon: "",
  718. enterTransition: "",
  719. leaveTransition: "",
  720. activePath: "",
  721. auths: "",
  722. frameSrc: "",
  723. frameLoading: true,
  724. keepAlive: false,
  725. hiddenTag: false,
  726. showLink: true,
  727. showParent: false
  728. },
  729. {
  730. parentId: 400,
  731. id: 403,
  732. menuType: 0,
  733. title: "menus.hsOperationLog",
  734. name: "OperationLog",
  735. path: "/monitor/operation-logs",
  736. component: "monitor/logs/operation/index",
  737. rank: null,
  738. redirect: "",
  739. icon: "ri:history-fill",
  740. extraIcon: "",
  741. enterTransition: "",
  742. leaveTransition: "",
  743. activePath: "",
  744. auths: "",
  745. frameSrc: "",
  746. frameLoading: true,
  747. keepAlive: false,
  748. hiddenTag: false,
  749. showLink: true,
  750. showParent: false
  751. },
  752. {
  753. parentId: 400,
  754. id: 404,
  755. menuType: 0,
  756. title: "menus.hsSystemLog",
  757. name: "SystemLog",
  758. path: "/monitor/system-logs",
  759. component: "monitor/logs/system/index",
  760. rank: null,
  761. redirect: "",
  762. icon: "ri:file-search-line",
  763. extraIcon: "",
  764. enterTransition: "",
  765. leaveTransition: "",
  766. activePath: "",
  767. auths: "",
  768. frameSrc: "",
  769. frameLoading: true,
  770. keepAlive: false,
  771. hiddenTag: false,
  772. showLink: true,
  773. showParent: false
  774. },
  775. // 标签页操作
  776. {
  777. parentId: 0,
  778. id: 500,
  779. menuType: 0,
  780. title: "menus.hstabs",
  781. name: "PureTabs",
  782. path: "/tabs",
  783. component: "",
  784. rank: 12,
  785. redirect: "",
  786. icon: "ri:bookmark-2-line",
  787. extraIcon: "",
  788. enterTransition: "",
  789. leaveTransition: "",
  790. activePath: "",
  791. auths: "",
  792. frameSrc: "",
  793. frameLoading: true,
  794. keepAlive: false,
  795. hiddenTag: false,
  796. showLink: true,
  797. showParent: false
  798. },
  799. {
  800. parentId: 500,
  801. id: 501,
  802. menuType: 0,
  803. title: "menus.hstabs",
  804. name: "Tabs",
  805. path: "/tabs/index",
  806. component: "",
  807. rank: null,
  808. redirect: "",
  809. icon: "",
  810. extraIcon: "",
  811. enterTransition: "",
  812. leaveTransition: "",
  813. activePath: "",
  814. auths: "",
  815. frameSrc: "",
  816. frameLoading: true,
  817. keepAlive: false,
  818. hiddenTag: false,
  819. showLink: true,
  820. showParent: false
  821. },
  822. {
  823. parentId: 500,
  824. id: 502,
  825. menuType: 0,
  826. title: "query传参模式",
  827. name: "TabQueryDetail",
  828. path: "/tabs/query-detail",
  829. component: "",
  830. rank: null,
  831. redirect: "",
  832. icon: "",
  833. extraIcon: "",
  834. enterTransition: "",
  835. leaveTransition: "",
  836. activePath: "/tabs/index",
  837. auths: "",
  838. frameSrc: "",
  839. frameLoading: true,
  840. keepAlive: false,
  841. hiddenTag: false,
  842. showLink: false,
  843. showParent: false
  844. },
  845. {
  846. parentId: 500,
  847. id: 503,
  848. menuType: 0,
  849. title: "params传参模式",
  850. name: "TabParamsDetail",
  851. path: "/tabs/params-detail/:id",
  852. component: "params-detail",
  853. rank: null,
  854. redirect: "",
  855. icon: "",
  856. extraIcon: "",
  857. enterTransition: "",
  858. leaveTransition: "",
  859. activePath: "/tabs/index",
  860. auths: "",
  861. frameSrc: "",
  862. frameLoading: true,
  863. keepAlive: false,
  864. hiddenTag: false,
  865. showLink: false,
  866. showParent: false
  867. }
  868. ]
  869. };
  870. }
  871. },
  872. // 部门管理
  873. {
  874. url: "/dept",
  875. method: "post",
  876. response: () => {
  877. return {
  878. success: true,
  879. data: [
  880. {
  881. name: "杭州总公司",
  882. parentId: 0,
  883. id: 100,
  884. sort: 0,
  885. phone: "15888888888",
  886. principal: faker.person.firstName(),
  887. email: faker.internet.email(),
  888. status: 1, // 状态 1 启用 0 停用
  889. type: 1, // 1 公司 2 分公司 3 部门
  890. createTime: 1605456000000,
  891. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  892. },
  893. {
  894. name: "郑州分公司",
  895. parentId: 100,
  896. id: 101,
  897. sort: 1,
  898. phone: "15888888888",
  899. principal: faker.person.firstName(),
  900. email: faker.internet.email(),
  901. status: 1,
  902. type: 2,
  903. createTime: 1605456000000,
  904. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  905. },
  906. {
  907. name: "研发部门",
  908. parentId: 101,
  909. id: 103,
  910. sort: 1,
  911. phone: "15888888888",
  912. principal: faker.person.firstName(),
  913. email: faker.internet.email(),
  914. status: 1,
  915. type: 3,
  916. createTime: 1605456000000,
  917. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  918. },
  919. {
  920. name: "市场部门",
  921. parentId: 102,
  922. id: 108,
  923. sort: 1,
  924. phone: "15888888888",
  925. principal: faker.person.firstName(),
  926. email: faker.internet.email(),
  927. status: 1,
  928. type: 3,
  929. createTime: 1605456000000,
  930. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  931. },
  932. {
  933. name: "深圳分公司",
  934. parentId: 100,
  935. id: 102,
  936. sort: 2,
  937. phone: "15888888888",
  938. principal: faker.person.firstName(),
  939. email: faker.internet.email(),
  940. status: 1,
  941. type: 2,
  942. createTime: 1605456000000,
  943. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  944. },
  945. {
  946. name: "市场部门",
  947. parentId: 101,
  948. id: 104,
  949. sort: 2,
  950. phone: "15888888888",
  951. principal: faker.person.firstName(),
  952. email: faker.internet.email(),
  953. status: 1,
  954. type: 3,
  955. createTime: 1605456000000,
  956. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  957. },
  958. {
  959. name: "财务部门",
  960. parentId: 102,
  961. id: 109,
  962. sort: 2,
  963. phone: "15888888888",
  964. principal: faker.person.firstName(),
  965. email: faker.internet.email(),
  966. status: 1,
  967. type: 3,
  968. createTime: 1605456000000,
  969. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  970. },
  971. {
  972. name: "测试部门",
  973. parentId: 101,
  974. id: 105,
  975. sort: 3,
  976. phone: "15888888888",
  977. principal: faker.person.firstName(),
  978. email: faker.internet.email(),
  979. status: 0,
  980. type: 3,
  981. createTime: 1605456000000,
  982. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  983. },
  984. {
  985. name: "财务部门",
  986. parentId: 101,
  987. id: 106,
  988. sort: 4,
  989. phone: "15888888888",
  990. principal: faker.person.firstName(),
  991. email: faker.internet.email(),
  992. status: 1,
  993. type: 3,
  994. createTime: 1605456000000,
  995. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  996. },
  997. {
  998. name: "运维部门",
  999. parentId: 101,
  1000. id: 107,
  1001. sort: 5,
  1002. phone: "15888888888",
  1003. principal: faker.person.firstName(),
  1004. email: faker.internet.email(),
  1005. status: 0,
  1006. type: 3,
  1007. createTime: 1605456000000,
  1008. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1009. }
  1010. ]
  1011. };
  1012. }
  1013. },
  1014. // 在线用户
  1015. {
  1016. url: "/online-logs",
  1017. method: "post",
  1018. response: ({ body }) => {
  1019. let list = [
  1020. {
  1021. id: 1,
  1022. username: "admin",
  1023. ip: faker.internet.ipv4(),
  1024. address: "中国河南省信阳市",
  1025. system: "macOS",
  1026. browser: "Chrome",
  1027. loginTime: new Date()
  1028. },
  1029. {
  1030. id: 2,
  1031. username: "common",
  1032. ip: faker.internet.ipv4(),
  1033. address: "中国广东省深圳市",
  1034. system: "Windows",
  1035. browser: "Firefox",
  1036. loginTime: new Date()
  1037. }
  1038. ];
  1039. list = list.filter(item => item.username.includes(body?.username));
  1040. return {
  1041. success: true,
  1042. data: {
  1043. list,
  1044. total: list.length, // 总条目数
  1045. pageSize: 10, // 每页显示条目个数
  1046. currentPage: 1 // 当前页数
  1047. }
  1048. };
  1049. }
  1050. },
  1051. // 登录日志
  1052. {
  1053. url: "/login-logs",
  1054. method: "post",
  1055. response: ({ body }) => {
  1056. let list = [
  1057. {
  1058. id: 1,
  1059. username: "admin",
  1060. ip: faker.internet.ipv4(),
  1061. address: "中国河南省信阳市",
  1062. system: "macOS",
  1063. browser: "Chrome",
  1064. status: 1, // 登录状态 1 成功 0 失败
  1065. behavior: "账号登录",
  1066. loginTime: new Date()
  1067. },
  1068. {
  1069. id: 2,
  1070. username: "common",
  1071. ip: faker.internet.ipv4(),
  1072. address: "中国广东省深圳市",
  1073. system: "Windows",
  1074. browser: "Firefox",
  1075. status: 0,
  1076. behavior: "第三方登录",
  1077. loginTime: new Date()
  1078. }
  1079. ];
  1080. list = list.filter(item => item.username.includes(body?.username));
  1081. list = list.filter(item =>
  1082. String(item.status).includes(String(body?.status))
  1083. );
  1084. return {
  1085. success: true,
  1086. data: {
  1087. list,
  1088. total: list.length, // 总条目数
  1089. pageSize: 10, // 每页显示条目个数
  1090. currentPage: 1 // 当前页数
  1091. }
  1092. };
  1093. }
  1094. },
  1095. // 操作日志
  1096. {
  1097. url: "/operation-logs",
  1098. method: "post",
  1099. response: ({ body }) => {
  1100. let list = [
  1101. {
  1102. id: 1,
  1103. username: "admin",
  1104. ip: faker.internet.ipv4(),
  1105. address: "中国河南省信阳市",
  1106. system: "macOS",
  1107. browser: "Chrome",
  1108. status: 1, // 操作状态 1 成功 0 失败
  1109. summary: "菜单管理-添加菜单", // 操作概要
  1110. module: "系统管理", // 所属模块
  1111. operatingTime: new Date() // 操作时间
  1112. },
  1113. {
  1114. id: 2,
  1115. username: "common",
  1116. ip: faker.internet.ipv4(),
  1117. address: "中国广东省深圳市",
  1118. system: "Windows",
  1119. browser: "Firefox",
  1120. status: 0,
  1121. summary: "列表分页查询",
  1122. module: "在线用户",
  1123. operatingTime: new Date()
  1124. }
  1125. ];
  1126. list = list.filter(item => item.module.includes(body?.module));
  1127. list = list.filter(item =>
  1128. String(item.status).includes(String(body?.status))
  1129. );
  1130. return {
  1131. success: true,
  1132. data: {
  1133. list,
  1134. total: list.length, // 总条目数
  1135. pageSize: 10, // 每页显示条目个数
  1136. currentPage: 1 // 当前页数
  1137. }
  1138. };
  1139. }
  1140. },
  1141. // 系统日志
  1142. {
  1143. url: "/system-logs",
  1144. method: "post",
  1145. response: ({ body }) => {
  1146. let list = [
  1147. {
  1148. id: 1, // 日志ID
  1149. /**
  1150. * 日志级别
  1151. * 0 debug调试(最低级别的日志,用于调试和开发阶段)
  1152. * 1 info信息(默认级别,用于记录一般的信息)
  1153. * 2 warn警告(表示可能出现的问题或潜在的错误,但不会影响系统的正常运行)
  1154. * 3 error错误(表示发生了错误,但不会导致系统崩溃)
  1155. * 4 fatal致命(最高级别的日志,表示发生了严重错误,导致系统无法继续运行)
  1156. */
  1157. level: 1,
  1158. module: "菜单管理", // 所属模块
  1159. url: "/menu", // 请求接口
  1160. method: "post", // 请求方法
  1161. ip: faker.internet.ipv4(),
  1162. address: "中国河南省信阳市",
  1163. system: "macOS",
  1164. browser: "Chrome",
  1165. /**
  1166. * 请求耗时(单位:ms 毫秒)
  1167. * 正常耗时:一般认为在几百毫秒(0.1-0.5秒)范围内的请求耗时较为正常
  1168. * 较慢耗时:在1秒以上的耗时可以被认为是较慢的请求,但具体是否较慢还需要根据具体业务场景和性能要求来判断
  1169. */
  1170. takesTime: 10,
  1171. requestTime: new Date() // 请求时间
  1172. },
  1173. {
  1174. id: 2,
  1175. level: 0,
  1176. module: "地图",
  1177. url: "/get-map-info",
  1178. method: "get",
  1179. ip: faker.internet.ipv4(),
  1180. address: "中国广东省深圳市",
  1181. system: "Windows",
  1182. browser: "Firefox",
  1183. takesTime: 1200,
  1184. requestTime: new Date()
  1185. }
  1186. ];
  1187. list = list.filter(item => item.module.includes(body?.module));
  1188. return {
  1189. success: true,
  1190. data: {
  1191. list,
  1192. total: list.length, // 总条目数
  1193. pageSize: 10, // 每页显示条目个数
  1194. currentPage: 1 // 当前页数
  1195. }
  1196. };
  1197. }
  1198. },
  1199. // 系统日志-根据 id 查日志详情
  1200. {
  1201. url: "/system-logs-detail",
  1202. method: "post",
  1203. response: ({ body }) => {
  1204. if (body.id == 1) {
  1205. return {
  1206. id: 1,
  1207. level: 1,
  1208. module: "菜单管理",
  1209. url: "/menu",
  1210. method: "post",
  1211. ip: faker.internet.ipv4(),
  1212. address: "中国河南省信阳市",
  1213. system: "macOS",
  1214. browser: "Chrome",
  1215. takesTime: 10,
  1216. responseHeaders: {
  1217. traceId: "1495502411171032",
  1218. "Content-Type": "application/json",
  1219. Connection: "keep-alive",
  1220. "Keep-Alive": "timeout=5",
  1221. "Content-Length": 17019
  1222. },
  1223. responseBody: {
  1224. success: true,
  1225. data: [
  1226. {
  1227. parentId: 0,
  1228. id: 400,
  1229. menuType: 0,
  1230. title: "menus.hssysMonitor",
  1231. name: "PureMonitor",
  1232. path: "/monitor",
  1233. component: "",
  1234. rank: 11,
  1235. redirect: "",
  1236. icon: "ep:monitor",
  1237. extraIcon: "",
  1238. enterTransition: "",
  1239. leaveTransition: "",
  1240. activePath: "",
  1241. auths: "",
  1242. frameSrc: "",
  1243. frameLoading: true,
  1244. keepAlive: false,
  1245. hiddenTag: false,
  1246. showLink: true,
  1247. showParent: false
  1248. },
  1249. {
  1250. parentId: 400,
  1251. id: 401,
  1252. menuType: 0,
  1253. title: "menus.hsOnlineUser",
  1254. name: "OnlineUser",
  1255. path: "/monitor/online-user",
  1256. component: "monitor/online/index",
  1257. rank: null,
  1258. redirect: "",
  1259. icon: "ri:user-voice-line",
  1260. extraIcon: "",
  1261. enterTransition: "",
  1262. leaveTransition: "",
  1263. activePath: "",
  1264. auths: "",
  1265. frameSrc: "",
  1266. frameLoading: true,
  1267. keepAlive: false,
  1268. hiddenTag: false,
  1269. showLink: true,
  1270. showParent: false
  1271. },
  1272. {
  1273. parentId: 400,
  1274. id: 402,
  1275. menuType: 0,
  1276. title: "menus.hsLoginLog",
  1277. name: "LoginLog",
  1278. path: "/monitor/login-logs",
  1279. component: "monitor/logs/login/index",
  1280. rank: null,
  1281. redirect: "",
  1282. icon: "ri:window-line",
  1283. extraIcon: "",
  1284. enterTransition: "",
  1285. leaveTransition: "",
  1286. activePath: "",
  1287. auths: "",
  1288. frameSrc: "",
  1289. frameLoading: true,
  1290. keepAlive: false,
  1291. hiddenTag: false,
  1292. showLink: true,
  1293. showParent: false
  1294. },
  1295. {
  1296. parentId: 400,
  1297. id: 403,
  1298. menuType: 0,
  1299. title: "menus.hsOperationLog",
  1300. name: "OperationLog",
  1301. path: "/monitor/operation-logs",
  1302. component: "monitor/logs/operation/index",
  1303. rank: null,
  1304. redirect: "",
  1305. icon: "ri:history-fill",
  1306. extraIcon: "",
  1307. enterTransition: "",
  1308. leaveTransition: "",
  1309. activePath: "",
  1310. auths: "",
  1311. frameSrc: "",
  1312. frameLoading: true,
  1313. keepAlive: false,
  1314. hiddenTag: false,
  1315. showLink: true,
  1316. showParent: false
  1317. },
  1318. {
  1319. parentId: 400,
  1320. id: 404,
  1321. menuType: 0,
  1322. title: "menus.hsSystemLog",
  1323. name: "SystemLog",
  1324. path: "/monitor/system-logs",
  1325. component: "monitor/logs/system/index",
  1326. rank: null,
  1327. redirect: "",
  1328. icon: "ri:file-search-line",
  1329. extraIcon: "",
  1330. enterTransition: "",
  1331. leaveTransition: "",
  1332. activePath: "",
  1333. auths: "",
  1334. frameSrc: "",
  1335. frameLoading: true,
  1336. keepAlive: false,
  1337. hiddenTag: false,
  1338. showLink: true,
  1339. showParent: false
  1340. }
  1341. ]
  1342. },
  1343. requestHeaders: {
  1344. Accept: "application/json, text/plain, */*",
  1345. "Accept-Encoding": "gzip, deflate",
  1346. "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,eo;q=0.7",
  1347. Authorization: "Bearer eyJhbGciOiJIUzUxMiJ9.admin",
  1348. Connection: "keep-alive",
  1349. "Content-Length": 0,
  1350. Cookie:
  1351. "_ga=GA1.1.231800979.1704562367; _ga_M74ZHEQ1M1=GS1.1.1709299375.7.1.1709299476.0.0.0; Hm_lvt_6a7dac00248d3b6ad8479d7249bb29c5=1709032753,1709359575; Hm_lvt_23a157b7d0d9867f7a51e42628f052f5=1708960489,1709485849,1709879672; authorized-token={%22accessToken%22:%22eyJhbGciOiJIUzUxMiJ9.admin%22%2C%22expires%22:1919520000000}; multiple-tabs=true",
  1352. Host: "192.168.2.121:8848",
  1353. Origin: "http://192.168.2.121:8848",
  1354. Referer: "http://192.168.2.121:8848/",
  1355. "User-Agent":
  1356. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
  1357. "X-Requested-With": "XMLHttpRequest"
  1358. },
  1359. requestBody: {
  1360. title: "系统监控"
  1361. },
  1362. traceId: "1495502411171032",
  1363. requestTime: new Date()
  1364. };
  1365. } else if (body.id == 2) {
  1366. return {
  1367. id: 2,
  1368. level: 0,
  1369. module: "地图",
  1370. url: "/get-map-info?plateNumber=豫A59778U",
  1371. method: "get",
  1372. ip: faker.internet.ipv4(),
  1373. address: "中国广东省深圳市",
  1374. system: "Windows",
  1375. browser: "Firefox",
  1376. takesTime: 1200,
  1377. responseHeaders: {
  1378. traceId: "2280443117103208",
  1379. "Content-Type": "application/json",
  1380. Connection: "keep-alive",
  1381. "Keep-Alive": "timeout=5",
  1382. "Content-Length": 28693
  1383. },
  1384. responseBody: {
  1385. plateNumber: "豫A59778U",
  1386. driver: "子骞",
  1387. orientation: 289,
  1388. lng: 113.8564,
  1389. lat: 34.373
  1390. },
  1391. requestHeaders: {
  1392. Accept: "application/json, text/plain, */*",
  1393. "Accept-Encoding": "gzip, deflate",
  1394. "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,eo;q=0.7",
  1395. Authorization: "Bearer eyJhbGciOiJIUzUxMiJ9.admin",
  1396. Connection: "keep-alive",
  1397. "Content-Length": 0,
  1398. Cookie:
  1399. "_ga=GA1.1.231800979.1704562367; _ga_M74ZHEQ1M1=GS1.1.1709299375.7.1.1709299476.0.0.0; Hm_lvt_6a7dac00248d3b6ad8479d7249bb29c5=1709032753,1709359575; Hm_lvt_23a157b7d0d9867f7a51e42628f052f5=1708960489,1709485849,1709879672; authorized-token={%22accessToken%22:%22eyJhbGciOiJIUzUxMiJ9.admin%22%2C%22expires%22:1919520000000}; multiple-tabs=true",
  1400. Host: "192.168.2.121:8848",
  1401. Origin: "http://192.168.2.121:8848",
  1402. Referer: "http://192.168.2.121:8848/",
  1403. "User-Agent":
  1404. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
  1405. "X-Requested-With": "XMLHttpRequest"
  1406. },
  1407. requestBody: null,
  1408. traceId: "2280443117103208",
  1409. requestTime: new Date()
  1410. };
  1411. }
  1412. }
  1413. }
  1414. ]);