system.ts 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863
  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: "/fetchMessageType",
  7. method: "get",
  8. response: () => {
  9. return {
  10. success: true,
  11. data: {
  12. records: [
  13. {
  14. id: 1,
  15. applicationId: 1,
  16. sceneCode: "MT1212121212",
  17. sceneName: "网关vip消息类型",
  18. sceneMessageType: "其他",
  19. sendTypeDescribe: "钉钉,微信",
  20. status: 1,
  21. remark: "",
  22. createTime: "2023-12-12"
  23. }
  24. ],
  25. total: 10,
  26. pageSize: 10,
  27. pageName: 1
  28. }
  29. };
  30. }
  31. },
  32. // 用户管理-获取所有角色列表
  33. {
  34. url: "/fetchDynamicData",
  35. method: "get",
  36. response: () => {
  37. return {
  38. success: true,
  39. data: {
  40. records: [
  41. {
  42. id: 1,
  43. name: "微信小程序网关",
  44. parameterDefine:
  45. '[{"name":"key","desc":"密钥","type":"radio","required":true,"encrypt":true,"values":"","titles":"","dataList":[{"label":"1"},{"label":"2"},{"label":"3"}]},{"name":"name","desc":"名字","type":"checkbox","required":true,"encrypt":true,"values":"","titles":"","dataList":[{"label":"1"},{"label":"2"},{"label":"3"},{"label":"4"}]},{"name":"备注","desc":"remark","type":"input","required":true,"encrypt":true,"values":"","titles":"","dataList":[{"label":"选项一"}]}]',
  46. status: 1,
  47. createTime: "",
  48. remark: "",
  49. createBy: ""
  50. },
  51. {
  52. id: 2,
  53. name: "微信公众号网关",
  54. parameterDefine: "",
  55. status: 1,
  56. createTime: "",
  57. remark: "",
  58. createBy: ""
  59. }
  60. ],
  61. total: 10,
  62. pageSize: 10,
  63. pageName: 1
  64. }
  65. };
  66. }
  67. },
  68. // 用户管理
  69. {
  70. url: "/user",
  71. method: "post",
  72. response: ({ body }) => {
  73. let list = [
  74. {
  75. avatar: "https://avatars.githubusercontent.com/u/44761321",
  76. username: "admin",
  77. gatewayName: "微信健康平台小程序推送网关",
  78. phone: "15888886789",
  79. email: faker.internet.email(),
  80. sex: 0,
  81. id: 1,
  82. status: 1,
  83. dept: {
  84. // 部门id
  85. id: 103,
  86. // 部门名称
  87. name: "研发部门"
  88. },
  89. remark: "管理员",
  90. createTime: 1605456000000
  91. },
  92. {
  93. avatar: "https://avatars.githubusercontent.com/u/52823142",
  94. username: "common",
  95. gatewayName: "微信公众号推送网关",
  96. phone: "18288882345",
  97. email: faker.internet.email(),
  98. sex: 1,
  99. id: 2,
  100. status: 1,
  101. dept: {
  102. id: 105,
  103. name: "测试部门"
  104. },
  105. remark: "普通用户",
  106. createTime: 1605456000000
  107. }
  108. ];
  109. list = list.filter(item => item.username.includes(body?.username));
  110. list = list.filter(item =>
  111. String(item.status).includes(String(body?.status))
  112. );
  113. if (body.phone) list = list.filter(item => item.phone === body.phone);
  114. if (body.deptId) list = list.filter(item => item.dept.id === body.deptId);
  115. return {
  116. success: true,
  117. data: {
  118. list,
  119. total: list.length, // 总条目数
  120. pageSize: 10, // 每页显示条目个数
  121. currentPage: 1 // 当前页数
  122. }
  123. };
  124. }
  125. },
  126. // 用户管理-获取所有角色列表
  127. {
  128. url: "/list-all-role",
  129. method: "get",
  130. response: () => {
  131. return {
  132. success: true,
  133. data: [
  134. { id: 1, name: "超级管理员" },
  135. { id: 2, name: "普通角色" }
  136. ]
  137. };
  138. }
  139. },
  140. // 用户管理-根据 userId 获取对应角色 id 列表(userId:用户id)
  141. {
  142. url: "/list-role-ids",
  143. method: "post",
  144. response: ({ body }) => {
  145. if (body.userId) {
  146. if (body.userId == 1) {
  147. return {
  148. success: true,
  149. data: [1]
  150. };
  151. } else if (body.userId == 2) {
  152. return {
  153. success: true,
  154. data: [2]
  155. };
  156. }
  157. } else {
  158. return {
  159. success: false,
  160. data: []
  161. };
  162. }
  163. }
  164. },
  165. // 角色管理
  166. {
  167. url: "/role",
  168. method: "post",
  169. response: ({ body }) => {
  170. let list = [
  171. {
  172. createTime: 1605456000000, // 时间戳(毫秒ms)
  173. updateTime: 1684512000000,
  174. id: 1,
  175. gatewayName: "微信健康平台小程序推送网关",
  176. code: "admin",
  177. status: 1, // 状态 1 启用 0 停用
  178. remark: "超级管理员拥有最高权限"
  179. },
  180. {
  181. createTime: 1605456000000,
  182. updateTime: 1684512000000,
  183. id: 2,
  184. gatewayName: "微信公众号推送网关",
  185. code: "common",
  186. status: 1,
  187. remark: "普通角色拥有部分权限"
  188. }
  189. ];
  190. list = list.filter(item => item.gatewayName.includes(body?.name));
  191. list = list.filter(item =>
  192. String(item.status).includes(String(body?.status))
  193. );
  194. if (body.code) list = list.filter(item => item.code === body.code);
  195. return {
  196. success: true,
  197. data: {
  198. list,
  199. total: list.length, // 总条目数
  200. pageSize: 10, // 每页显示条目个数
  201. currentPage: 1 // 当前页数
  202. }
  203. };
  204. }
  205. },
  206. // 角色管理-权限-菜单权限
  207. {
  208. url: "/role-menu",
  209. method: "post",
  210. response: () => {
  211. return {
  212. success: true,
  213. data: [
  214. // 外部页面
  215. {
  216. parentId: 0,
  217. id: 100,
  218. menuType: 0, // 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
  219. title: "menus.pureExternalPage"
  220. },
  221. {
  222. parentId: 100,
  223. id: 101,
  224. menuType: 0,
  225. title: "menus.pureExternalDoc"
  226. },
  227. {
  228. parentId: 101,
  229. id: 102,
  230. menuType: 2,
  231. title: "menus.pureExternalLink"
  232. },
  233. {
  234. parentId: 101,
  235. id: 103,
  236. menuType: 2,
  237. title: "menus.pureUtilsLink"
  238. },
  239. {
  240. parentId: 100,
  241. id: 104,
  242. menuType: 1,
  243. title: "menus.pureEmbeddedDoc"
  244. },
  245. {
  246. parentId: 104,
  247. id: 105,
  248. menuType: 1,
  249. title: "menus.pureEpDoc"
  250. },
  251. {
  252. parentId: 104,
  253. id: 106,
  254. menuType: 1,
  255. title: "menus.pureTailwindcssDoc"
  256. },
  257. {
  258. parentId: 104,
  259. id: 107,
  260. menuType: 1,
  261. title: "menus.pureVueDoc"
  262. },
  263. {
  264. parentId: 104,
  265. id: 108,
  266. menuType: 1,
  267. title: "menus.pureViteDoc"
  268. },
  269. {
  270. parentId: 104,
  271. id: 109,
  272. menuType: 1,
  273. title: "menus.purePiniaDoc"
  274. },
  275. {
  276. parentId: 104,
  277. id: 110,
  278. menuType: 1,
  279. title: "menus.pureRouterDoc"
  280. },
  281. // 权限管理
  282. {
  283. parentId: 0,
  284. id: 200,
  285. menuType: 0,
  286. title: "menus.purePermission"
  287. },
  288. {
  289. parentId: 200,
  290. id: 201,
  291. menuType: 0,
  292. title: "menus.purePermissionPage"
  293. },
  294. {
  295. parentId: 200,
  296. id: 202,
  297. menuType: 0,
  298. title: "menus.purePermissionButton"
  299. },
  300. {
  301. parentId: 202,
  302. id: 203,
  303. menuType: 3,
  304. title: "添加"
  305. },
  306. {
  307. parentId: 202,
  308. id: 204,
  309. menuType: 3,
  310. title: "修改"
  311. },
  312. {
  313. parentId: 202,
  314. id: 205,
  315. menuType: 3,
  316. title: "删除"
  317. },
  318. // 系统管理
  319. {
  320. parentId: 0,
  321. id: 300,
  322. menuType: 0,
  323. title: "menus.pureSysManagement"
  324. },
  325. {
  326. parentId: 300,
  327. id: 301,
  328. menuType: 0,
  329. title: "menus.pureUser"
  330. },
  331. {
  332. parentId: 300,
  333. id: 302,
  334. menuType: 0,
  335. title: "menus.pureRole"
  336. },
  337. {
  338. parentId: 300,
  339. id: 303,
  340. menuType: 0,
  341. title: "menus.pureSystemMenu"
  342. },
  343. {
  344. parentId: 300,
  345. id: 304,
  346. menuType: 0,
  347. title: "menus.pureDept"
  348. },
  349. // 系统监控
  350. {
  351. parentId: 0,
  352. id: 400,
  353. menuType: 0,
  354. title: "menus.pureSysMonitor"
  355. },
  356. {
  357. parentId: 400,
  358. id: 401,
  359. menuType: 0,
  360. title: "menus.pureOnlineUser"
  361. },
  362. {
  363. parentId: 400,
  364. id: 402,
  365. menuType: 0,
  366. title: "menus.pureLoginLog"
  367. },
  368. {
  369. parentId: 400,
  370. id: 403,
  371. menuType: 0,
  372. title: "menus.pureOperationLog"
  373. },
  374. {
  375. parentId: 400,
  376. id: 404,
  377. menuType: 0,
  378. title: "menus.pureSystemLog"
  379. },
  380. // 标签页操作
  381. {
  382. parentId: 0,
  383. id: 500,
  384. menuType: 0,
  385. title: "menus.pureTabs"
  386. },
  387. {
  388. parentId: 500,
  389. id: 501,
  390. menuType: 0,
  391. title: "menus.pureTabs"
  392. },
  393. {
  394. parentId: 500,
  395. id: 502,
  396. menuType: 0,
  397. title: "query传参模式"
  398. },
  399. {
  400. parentId: 500,
  401. id: 503,
  402. menuType: 0,
  403. title: "params传参模式"
  404. }
  405. ]
  406. };
  407. }
  408. },
  409. // 角色管理-权限-菜单权限-根据角色 id 查对应菜单
  410. {
  411. url: "/role-menu-ids",
  412. method: "post",
  413. response: ({ body }) => {
  414. if (body.id == 1) {
  415. return {
  416. success: true,
  417. data: [
  418. 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 200, 201,
  419. 202, 203, 204, 205, 300, 301, 302, 303, 304, 400, 401, 402, 403,
  420. 404, 500, 501, 502, 503
  421. ]
  422. };
  423. } else if (body.id == 2) {
  424. return {
  425. success: true,
  426. data: [
  427. 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 404, 500,
  428. 501, 502, 503
  429. ]
  430. };
  431. }
  432. }
  433. },
  434. // 菜单管理
  435. {
  436. url: "/menu",
  437. method: "post",
  438. response: () => {
  439. return {
  440. success: true,
  441. data: [
  442. // 外部页面
  443. {
  444. parentId: 0,
  445. id: 100,
  446. menuType: 0, // 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
  447. title: "menus.pureExternalPage",
  448. name: "PureIframe",
  449. path: "/iframe",
  450. component: "",
  451. rank: 7,
  452. redirect: "",
  453. icon: "ri:links-fill",
  454. extraIcon: "",
  455. enterTransition: "",
  456. leaveTransition: "",
  457. activePath: "",
  458. auths: "",
  459. frameSrc: "",
  460. frameLoading: true,
  461. keepAlive: false,
  462. hiddenTag: false,
  463. fixedTag: false,
  464. showLink: true,
  465. showParent: false
  466. },
  467. {
  468. parentId: 100,
  469. id: 101,
  470. menuType: 0,
  471. title: "menus.pureExternalDoc",
  472. name: "PureIframeExternal",
  473. path: "/iframe/external",
  474. component: "",
  475. rank: null,
  476. redirect: "",
  477. icon: "",
  478. extraIcon: "",
  479. enterTransition: "",
  480. leaveTransition: "",
  481. activePath: "",
  482. auths: "",
  483. frameSrc: "",
  484. frameLoading: true,
  485. keepAlive: false,
  486. hiddenTag: false,
  487. fixedTag: false,
  488. showLink: true,
  489. showParent: false
  490. },
  491. {
  492. parentId: 101,
  493. id: 102,
  494. menuType: 2,
  495. title: "menus.pureExternalLink",
  496. name: "https://pure-admin.cn/",
  497. path: "/external",
  498. component: "",
  499. rank: null,
  500. redirect: "",
  501. icon: "",
  502. extraIcon: "",
  503. enterTransition: "",
  504. leaveTransition: "",
  505. activePath: "",
  506. auths: "",
  507. frameSrc: "",
  508. frameLoading: true,
  509. keepAlive: false,
  510. hiddenTag: false,
  511. fixedTag: false,
  512. showLink: true,
  513. showParent: false
  514. },
  515. {
  516. parentId: 101,
  517. id: 103,
  518. menuType: 2,
  519. title: "menus.pureUtilsLink",
  520. name: "https://pure-admin-utils.netlify.app/",
  521. path: "/pureUtilsLink",
  522. component: "",
  523. rank: null,
  524. redirect: "",
  525. icon: "",
  526. extraIcon: "",
  527. enterTransition: "",
  528. leaveTransition: "",
  529. activePath: "",
  530. auths: "",
  531. frameSrc: "",
  532. frameLoading: true,
  533. keepAlive: false,
  534. hiddenTag: false,
  535. fixedTag: false,
  536. showLink: true,
  537. showParent: false
  538. },
  539. {
  540. parentId: 100,
  541. id: 104,
  542. menuType: 1,
  543. title: "menus.pureEmbeddedDoc",
  544. name: "PureIframeEmbedded",
  545. path: "/iframe/embedded",
  546. component: "",
  547. rank: null,
  548. redirect: "",
  549. icon: "",
  550. extraIcon: "",
  551. enterTransition: "",
  552. leaveTransition: "",
  553. activePath: "",
  554. auths: "",
  555. frameSrc: "",
  556. frameLoading: true,
  557. keepAlive: false,
  558. hiddenTag: false,
  559. fixedTag: false,
  560. showLink: true,
  561. showParent: false
  562. },
  563. {
  564. parentId: 104,
  565. id: 105,
  566. menuType: 1,
  567. title: "menus.pureEpDoc",
  568. name: "FrameEp",
  569. path: "/iframe/ep",
  570. component: "",
  571. rank: null,
  572. redirect: "",
  573. icon: "",
  574. extraIcon: "",
  575. enterTransition: "",
  576. leaveTransition: "",
  577. activePath: "",
  578. auths: "",
  579. frameSrc: "https://element-plus.org/zh-CN/",
  580. frameLoading: true,
  581. keepAlive: true,
  582. hiddenTag: false,
  583. fixedTag: false,
  584. showLink: true,
  585. showParent: false
  586. },
  587. {
  588. parentId: 104,
  589. id: 106,
  590. menuType: 1,
  591. title: "menus.pureTailwindcssDoc",
  592. name: "FrameTailwindcss",
  593. path: "/iframe/tailwindcss",
  594. component: "",
  595. rank: null,
  596. redirect: "",
  597. icon: "",
  598. extraIcon: "",
  599. enterTransition: "",
  600. leaveTransition: "",
  601. activePath: "",
  602. auths: "",
  603. frameSrc: "https://tailwindcss.com/docs/installation",
  604. frameLoading: true,
  605. keepAlive: true,
  606. hiddenTag: false,
  607. fixedTag: false,
  608. showLink: true,
  609. showParent: false
  610. },
  611. {
  612. parentId: 104,
  613. id: 107,
  614. menuType: 1,
  615. title: "menus.pureVueDoc",
  616. name: "FrameVue",
  617. path: "/iframe/vue3",
  618. component: "",
  619. rank: null,
  620. redirect: "",
  621. icon: "",
  622. extraIcon: "",
  623. enterTransition: "",
  624. leaveTransition: "",
  625. activePath: "",
  626. auths: "",
  627. frameSrc: "https://cn.vuejs.org/",
  628. frameLoading: true,
  629. keepAlive: true,
  630. hiddenTag: false,
  631. fixedTag: false,
  632. showLink: true,
  633. showParent: false
  634. },
  635. {
  636. parentId: 104,
  637. id: 108,
  638. menuType: 1,
  639. title: "menus.pureViteDoc",
  640. name: "FrameVite",
  641. path: "/iframe/vite",
  642. component: "",
  643. rank: null,
  644. redirect: "",
  645. icon: "",
  646. extraIcon: "",
  647. enterTransition: "",
  648. leaveTransition: "",
  649. activePath: "",
  650. auths: "",
  651. frameSrc: "https://cn.vitejs.dev/",
  652. frameLoading: true,
  653. keepAlive: true,
  654. hiddenTag: false,
  655. fixedTag: false,
  656. showLink: true,
  657. showParent: false
  658. },
  659. {
  660. parentId: 104,
  661. id: 109,
  662. menuType: 1,
  663. title: "menus.purePiniaDoc",
  664. name: "FramePinia",
  665. path: "/iframe/pinia",
  666. component: "",
  667. rank: null,
  668. redirect: "",
  669. icon: "",
  670. extraIcon: "",
  671. enterTransition: "",
  672. leaveTransition: "",
  673. activePath: "",
  674. auths: "",
  675. frameSrc: "https://pinia.vuejs.org/zh/index.html",
  676. frameLoading: true,
  677. keepAlive: true,
  678. hiddenTag: false,
  679. fixedTag: false,
  680. showLink: true,
  681. showParent: false
  682. },
  683. {
  684. parentId: 104,
  685. id: 110,
  686. menuType: 1,
  687. title: "menus.pureRouterDoc",
  688. name: "FrameRouter",
  689. path: "/iframe/vue-router",
  690. component: "",
  691. rank: null,
  692. redirect: "",
  693. icon: "",
  694. extraIcon: "",
  695. enterTransition: "",
  696. leaveTransition: "",
  697. activePath: "",
  698. auths: "",
  699. frameSrc: "https://router.vuejs.org/zh/",
  700. frameLoading: true,
  701. keepAlive: true,
  702. hiddenTag: false,
  703. fixedTag: false,
  704. showLink: true,
  705. showParent: false
  706. },
  707. // 权限管理
  708. {
  709. parentId: 0,
  710. id: 200,
  711. menuType: 0,
  712. title: "menus.purePermission",
  713. name: "PurePermission",
  714. path: "/permission",
  715. component: "",
  716. rank: 9,
  717. redirect: "",
  718. icon: "ep:lollipop",
  719. extraIcon: "",
  720. enterTransition: "",
  721. leaveTransition: "",
  722. activePath: "",
  723. auths: "",
  724. frameSrc: "",
  725. frameLoading: true,
  726. keepAlive: false,
  727. hiddenTag: false,
  728. fixedTag: false,
  729. showLink: true,
  730. showParent: false
  731. },
  732. {
  733. parentId: 200,
  734. id: 201,
  735. menuType: 0,
  736. title: "menus.purePermissionPage",
  737. name: "PermissionPage",
  738. path: "/permission/page/index",
  739. component: "",
  740. rank: null,
  741. redirect: "",
  742. icon: "",
  743. extraIcon: "",
  744. enterTransition: "",
  745. leaveTransition: "",
  746. activePath: "",
  747. auths: "",
  748. frameSrc: "",
  749. frameLoading: true,
  750. keepAlive: false,
  751. hiddenTag: false,
  752. fixedTag: false,
  753. showLink: true,
  754. showParent: false
  755. },
  756. {
  757. parentId: 200,
  758. id: 202,
  759. menuType: 0,
  760. title: "menus.purePermissionButton",
  761. name: "PermissionButton",
  762. path: "/permission/button",
  763. component: "",
  764. rank: null,
  765. redirect: "",
  766. icon: "",
  767. extraIcon: "",
  768. enterTransition: "",
  769. leaveTransition: "",
  770. activePath: "",
  771. auths: "",
  772. frameSrc: "",
  773. frameLoading: true,
  774. keepAlive: false,
  775. hiddenTag: false,
  776. fixedTag: false,
  777. showLink: true,
  778. showParent: false
  779. },
  780. {
  781. parentId: 202,
  782. id: 203,
  783. menuType: 0,
  784. title: "menus.purePermissionButtonRouter",
  785. name: "PermissionButtonRouter",
  786. path: "/permission/button/router",
  787. component: "permission/button/index",
  788. rank: null,
  789. redirect: "",
  790. icon: "",
  791. extraIcon: "",
  792. enterTransition: "",
  793. leaveTransition: "",
  794. activePath: "",
  795. auths: "",
  796. frameSrc: "",
  797. frameLoading: true,
  798. keepAlive: false,
  799. hiddenTag: false,
  800. fixedTag: false,
  801. showLink: true,
  802. showParent: false
  803. },
  804. {
  805. parentId: 203,
  806. id: 210,
  807. menuType: 3,
  808. title: "添加",
  809. name: "",
  810. path: "",
  811. component: "",
  812. rank: null,
  813. redirect: "",
  814. icon: "",
  815. extraIcon: "",
  816. enterTransition: "",
  817. leaveTransition: "",
  818. activePath: "",
  819. auths: "permission:btn:add",
  820. frameSrc: "",
  821. frameLoading: true,
  822. keepAlive: false,
  823. hiddenTag: false,
  824. fixedTag: false,
  825. showLink: true,
  826. showParent: false
  827. },
  828. {
  829. parentId: 203,
  830. id: 211,
  831. menuType: 3,
  832. title: "修改",
  833. name: "",
  834. path: "",
  835. component: "",
  836. rank: null,
  837. redirect: "",
  838. icon: "",
  839. extraIcon: "",
  840. enterTransition: "",
  841. leaveTransition: "",
  842. activePath: "",
  843. auths: "permission:btn:edit",
  844. frameSrc: "",
  845. frameLoading: true,
  846. keepAlive: false,
  847. hiddenTag: false,
  848. fixedTag: false,
  849. showLink: true,
  850. showParent: false
  851. },
  852. {
  853. parentId: 203,
  854. id: 212,
  855. menuType: 3,
  856. title: "删除",
  857. name: "",
  858. path: "",
  859. component: "",
  860. rank: null,
  861. redirect: "",
  862. icon: "",
  863. extraIcon: "",
  864. enterTransition: "",
  865. leaveTransition: "",
  866. activePath: "",
  867. auths: "permission:btn:delete",
  868. frameSrc: "",
  869. frameLoading: true,
  870. keepAlive: false,
  871. hiddenTag: false,
  872. fixedTag: false,
  873. showLink: true,
  874. showParent: false
  875. },
  876. {
  877. parentId: 202,
  878. id: 204,
  879. menuType: 0,
  880. title: "menus.purePermissionButtonLogin",
  881. name: "PermissionButtonLogin",
  882. path: "/permission/button/login",
  883. component: "permission/button/perms",
  884. rank: null,
  885. redirect: "",
  886. icon: "",
  887. extraIcon: "",
  888. enterTransition: "",
  889. leaveTransition: "",
  890. activePath: "",
  891. auths: "",
  892. frameSrc: "",
  893. frameLoading: true,
  894. keepAlive: false,
  895. hiddenTag: false,
  896. fixedTag: false,
  897. showLink: true,
  898. showParent: false
  899. },
  900. {
  901. parentId: 204,
  902. id: 220,
  903. menuType: 3,
  904. title: "添加",
  905. name: "",
  906. path: "",
  907. component: "",
  908. rank: null,
  909. redirect: "",
  910. icon: "",
  911. extraIcon: "",
  912. enterTransition: "",
  913. leaveTransition: "",
  914. activePath: "",
  915. auths: "permission:btn:add",
  916. frameSrc: "",
  917. frameLoading: true,
  918. keepAlive: false,
  919. hiddenTag: false,
  920. fixedTag: false,
  921. showLink: true,
  922. showParent: false
  923. },
  924. {
  925. parentId: 204,
  926. id: 221,
  927. menuType: 3,
  928. title: "修改",
  929. name: "",
  930. path: "",
  931. component: "",
  932. rank: null,
  933. redirect: "",
  934. icon: "",
  935. extraIcon: "",
  936. enterTransition: "",
  937. leaveTransition: "",
  938. activePath: "",
  939. auths: "permission:btn:edit",
  940. frameSrc: "",
  941. frameLoading: true,
  942. keepAlive: false,
  943. hiddenTag: false,
  944. fixedTag: false,
  945. showLink: true,
  946. showParent: false
  947. },
  948. {
  949. parentId: 204,
  950. id: 222,
  951. menuType: 3,
  952. title: "删除",
  953. name: "",
  954. path: "",
  955. component: "",
  956. rank: null,
  957. redirect: "",
  958. icon: "",
  959. extraIcon: "",
  960. enterTransition: "",
  961. leaveTransition: "",
  962. activePath: "",
  963. auths: "permission:btn:delete",
  964. frameSrc: "",
  965. frameLoading: true,
  966. keepAlive: false,
  967. hiddenTag: false,
  968. fixedTag: false,
  969. showLink: true,
  970. showParent: false
  971. },
  972. // 系统管理
  973. {
  974. parentId: 0,
  975. id: 300,
  976. menuType: 0,
  977. title: "menus.pureSysManagement",
  978. name: "PureSystem",
  979. path: "/system",
  980. component: "",
  981. rank: 10,
  982. redirect: "",
  983. icon: "ri:settings-3-line",
  984. extraIcon: "",
  985. enterTransition: "",
  986. leaveTransition: "",
  987. activePath: "",
  988. auths: "",
  989. frameSrc: "",
  990. frameLoading: true,
  991. keepAlive: false,
  992. hiddenTag: false,
  993. fixedTag: false,
  994. showLink: true,
  995. showParent: false
  996. },
  997. {
  998. parentId: 300,
  999. id: 301,
  1000. menuType: 0,
  1001. title: "menus.pureUser",
  1002. name: "SystemUser",
  1003. path: "/system/user/index",
  1004. component: "",
  1005. rank: null,
  1006. redirect: "",
  1007. icon: "ri:admin-line",
  1008. extraIcon: "",
  1009. enterTransition: "",
  1010. leaveTransition: "",
  1011. activePath: "",
  1012. auths: "",
  1013. frameSrc: "",
  1014. frameLoading: true,
  1015. keepAlive: false,
  1016. hiddenTag: false,
  1017. fixedTag: false,
  1018. showLink: true,
  1019. showParent: false
  1020. },
  1021. {
  1022. parentId: 300,
  1023. id: 302,
  1024. menuType: 0,
  1025. title: "menus.pureRole",
  1026. name: "SystemRole",
  1027. path: "/system/role/index",
  1028. component: "",
  1029. rank: null,
  1030. redirect: "",
  1031. icon: "ri:admin-fill",
  1032. extraIcon: "",
  1033. enterTransition: "",
  1034. leaveTransition: "",
  1035. activePath: "",
  1036. auths: "",
  1037. frameSrc: "",
  1038. frameLoading: true,
  1039. keepAlive: false,
  1040. hiddenTag: false,
  1041. fixedTag: false,
  1042. showLink: true,
  1043. showParent: false
  1044. },
  1045. {
  1046. parentId: 300,
  1047. id: 303,
  1048. menuType: 0,
  1049. title: "menus.pureSystemMenu",
  1050. name: "SystemMenu",
  1051. path: "/system/menu/index",
  1052. component: "",
  1053. rank: null,
  1054. redirect: "",
  1055. icon: "ep:menu",
  1056. extraIcon: "",
  1057. enterTransition: "",
  1058. leaveTransition: "",
  1059. activePath: "",
  1060. auths: "",
  1061. frameSrc: "",
  1062. frameLoading: true,
  1063. keepAlive: false,
  1064. hiddenTag: false,
  1065. fixedTag: false,
  1066. showLink: true,
  1067. showParent: false
  1068. },
  1069. {
  1070. parentId: 300,
  1071. id: 304,
  1072. menuType: 0,
  1073. title: "menus.pureDept",
  1074. name: "SystemDept",
  1075. path: "/system/dept/index",
  1076. component: "",
  1077. rank: null,
  1078. redirect: "",
  1079. icon: "ri:git-branch-line",
  1080. extraIcon: "",
  1081. enterTransition: "",
  1082. leaveTransition: "",
  1083. activePath: "",
  1084. auths: "",
  1085. frameSrc: "",
  1086. frameLoading: true,
  1087. keepAlive: false,
  1088. hiddenTag: false,
  1089. fixedTag: false,
  1090. showLink: true,
  1091. showParent: false
  1092. },
  1093. // 系统监控
  1094. {
  1095. parentId: 0,
  1096. id: 400,
  1097. menuType: 0,
  1098. title: "menus.pureSysMonitor",
  1099. name: "PureMonitor",
  1100. path: "/monitor",
  1101. component: "",
  1102. rank: 11,
  1103. redirect: "",
  1104. icon: "ep:monitor",
  1105. extraIcon: "",
  1106. enterTransition: "",
  1107. leaveTransition: "",
  1108. activePath: "",
  1109. auths: "",
  1110. frameSrc: "",
  1111. frameLoading: true,
  1112. keepAlive: false,
  1113. hiddenTag: false,
  1114. fixedTag: false,
  1115. showLink: true,
  1116. showParent: false
  1117. },
  1118. {
  1119. parentId: 400,
  1120. id: 401,
  1121. menuType: 0,
  1122. title: "menus.pureOnlineUser",
  1123. name: "OnlineUser",
  1124. path: "/monitor/online-user",
  1125. component: "monitor/online/index",
  1126. rank: null,
  1127. redirect: "",
  1128. icon: "ri:user-voice-line",
  1129. extraIcon: "",
  1130. enterTransition: "",
  1131. leaveTransition: "",
  1132. activePath: "",
  1133. auths: "",
  1134. frameSrc: "",
  1135. frameLoading: true,
  1136. keepAlive: false,
  1137. hiddenTag: false,
  1138. fixedTag: false,
  1139. showLink: true,
  1140. showParent: false
  1141. },
  1142. {
  1143. parentId: 400,
  1144. id: 402,
  1145. menuType: 0,
  1146. title: "menus.pureLoginLog",
  1147. name: "LoginLog",
  1148. path: "/monitor/login-logs",
  1149. component: "monitor/logs/login/index",
  1150. rank: null,
  1151. redirect: "",
  1152. icon: "ri:window-line",
  1153. extraIcon: "",
  1154. enterTransition: "",
  1155. leaveTransition: "",
  1156. activePath: "",
  1157. auths: "",
  1158. frameSrc: "",
  1159. frameLoading: true,
  1160. keepAlive: false,
  1161. hiddenTag: false,
  1162. fixedTag: false,
  1163. showLink: true,
  1164. showParent: false
  1165. },
  1166. {
  1167. parentId: 400,
  1168. id: 403,
  1169. menuType: 0,
  1170. title: "menus.pureOperationLog",
  1171. name: "OperationLog",
  1172. path: "/monitor/operation-logs",
  1173. component: "monitor/logs/operation/index",
  1174. rank: null,
  1175. redirect: "",
  1176. icon: "ri:history-fill",
  1177. extraIcon: "",
  1178. enterTransition: "",
  1179. leaveTransition: "",
  1180. activePath: "",
  1181. auths: "",
  1182. frameSrc: "",
  1183. frameLoading: true,
  1184. keepAlive: false,
  1185. hiddenTag: false,
  1186. fixedTag: false,
  1187. showLink: true,
  1188. showParent: false
  1189. },
  1190. {
  1191. parentId: 400,
  1192. id: 404,
  1193. menuType: 0,
  1194. title: "menus.pureSystemLog",
  1195. name: "SystemLog",
  1196. path: "/monitor/system-logs",
  1197. component: "monitor/logs/system/index",
  1198. rank: null,
  1199. redirect: "",
  1200. icon: "ri:file-search-line",
  1201. extraIcon: "",
  1202. enterTransition: "",
  1203. leaveTransition: "",
  1204. activePath: "",
  1205. auths: "",
  1206. frameSrc: "",
  1207. frameLoading: true,
  1208. keepAlive: false,
  1209. hiddenTag: false,
  1210. fixedTag: false,
  1211. showLink: true,
  1212. showParent: false
  1213. },
  1214. // 标签页操作
  1215. {
  1216. parentId: 0,
  1217. id: 500,
  1218. menuType: 0,
  1219. title: "menus.pureTabs",
  1220. name: "PureTabs",
  1221. path: "/tabs",
  1222. component: "",
  1223. rank: 12,
  1224. redirect: "",
  1225. icon: "ri:bookmark-2-line",
  1226. extraIcon: "",
  1227. enterTransition: "",
  1228. leaveTransition: "",
  1229. activePath: "",
  1230. auths: "",
  1231. frameSrc: "",
  1232. frameLoading: true,
  1233. keepAlive: false,
  1234. hiddenTag: false,
  1235. fixedTag: false,
  1236. showLink: true,
  1237. showParent: false
  1238. },
  1239. {
  1240. parentId: 500,
  1241. id: 501,
  1242. menuType: 0,
  1243. title: "menus.pureTabs",
  1244. name: "Tabs",
  1245. path: "/tabs/index",
  1246. component: "",
  1247. rank: null,
  1248. redirect: "",
  1249. icon: "",
  1250. extraIcon: "",
  1251. enterTransition: "",
  1252. leaveTransition: "",
  1253. activePath: "",
  1254. auths: "",
  1255. frameSrc: "",
  1256. frameLoading: true,
  1257. keepAlive: false,
  1258. hiddenTag: false,
  1259. fixedTag: false,
  1260. showLink: true,
  1261. showParent: false
  1262. },
  1263. {
  1264. parentId: 500,
  1265. id: 502,
  1266. menuType: 0,
  1267. title: "query传参模式",
  1268. name: "TabQueryDetail",
  1269. path: "/tabs/query-detail",
  1270. component: "",
  1271. rank: null,
  1272. redirect: "",
  1273. icon: "",
  1274. extraIcon: "",
  1275. enterTransition: "",
  1276. leaveTransition: "",
  1277. activePath: "/tabs/index",
  1278. auths: "",
  1279. frameSrc: "",
  1280. frameLoading: true,
  1281. keepAlive: false,
  1282. hiddenTag: false,
  1283. fixedTag: false,
  1284. showLink: false,
  1285. showParent: false
  1286. },
  1287. {
  1288. parentId: 500,
  1289. id: 503,
  1290. menuType: 0,
  1291. title: "params传参模式",
  1292. name: "TabParamsDetail",
  1293. path: "/tabs/params-detail/:id",
  1294. component: "params-detail",
  1295. rank: null,
  1296. redirect: "",
  1297. icon: "",
  1298. extraIcon: "",
  1299. enterTransition: "",
  1300. leaveTransition: "",
  1301. activePath: "/tabs/index",
  1302. auths: "",
  1303. frameSrc: "",
  1304. frameLoading: true,
  1305. keepAlive: false,
  1306. hiddenTag: false,
  1307. fixedTag: false,
  1308. showLink: false,
  1309. showParent: false
  1310. }
  1311. ]
  1312. };
  1313. }
  1314. },
  1315. // 部门管理
  1316. {
  1317. url: "/dept",
  1318. method: "post",
  1319. response: () => {
  1320. return {
  1321. success: true,
  1322. data: [
  1323. {
  1324. name: "杭州总公司",
  1325. parentId: 0,
  1326. id: 100,
  1327. sort: 0,
  1328. phone: "15888888888",
  1329. principal: faker.person.firstName(),
  1330. email: faker.internet.email(),
  1331. status: 1, // 状态 1 启用 0 停用
  1332. type: 1, // 1 公司 2 分公司 3 部门
  1333. createTime: 1605456000000,
  1334. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1335. },
  1336. {
  1337. name: "郑州分公司",
  1338. parentId: 100,
  1339. id: 101,
  1340. sort: 1,
  1341. phone: "15888888888",
  1342. principal: faker.person.firstName(),
  1343. email: faker.internet.email(),
  1344. status: 1,
  1345. type: 2,
  1346. createTime: 1605456000000,
  1347. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1348. },
  1349. {
  1350. name: "研发部门",
  1351. parentId: 101,
  1352. id: 103,
  1353. sort: 1,
  1354. phone: "15888888888",
  1355. principal: faker.person.firstName(),
  1356. email: faker.internet.email(),
  1357. status: 1,
  1358. type: 3,
  1359. createTime: 1605456000000,
  1360. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1361. },
  1362. {
  1363. name: "市场部门",
  1364. parentId: 102,
  1365. id: 108,
  1366. sort: 1,
  1367. phone: "15888888888",
  1368. principal: faker.person.firstName(),
  1369. email: faker.internet.email(),
  1370. status: 1,
  1371. type: 3,
  1372. createTime: 1605456000000,
  1373. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1374. },
  1375. {
  1376. name: "深圳分公司",
  1377. parentId: 100,
  1378. id: 102,
  1379. sort: 2,
  1380. phone: "15888888888",
  1381. principal: faker.person.firstName(),
  1382. email: faker.internet.email(),
  1383. status: 1,
  1384. type: 2,
  1385. createTime: 1605456000000,
  1386. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1387. },
  1388. {
  1389. name: "市场部门",
  1390. parentId: 101,
  1391. id: 104,
  1392. sort: 2,
  1393. phone: "15888888888",
  1394. principal: faker.person.firstName(),
  1395. email: faker.internet.email(),
  1396. status: 1,
  1397. type: 3,
  1398. createTime: 1605456000000,
  1399. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1400. },
  1401. {
  1402. name: "财务部门",
  1403. parentId: 102,
  1404. id: 109,
  1405. sort: 2,
  1406. phone: "15888888888",
  1407. principal: faker.person.firstName(),
  1408. email: faker.internet.email(),
  1409. status: 1,
  1410. type: 3,
  1411. createTime: 1605456000000,
  1412. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1413. },
  1414. {
  1415. name: "测试部门",
  1416. parentId: 101,
  1417. id: 105,
  1418. sort: 3,
  1419. phone: "15888888888",
  1420. principal: faker.person.firstName(),
  1421. email: faker.internet.email(),
  1422. status: 0,
  1423. type: 3,
  1424. createTime: 1605456000000,
  1425. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1426. },
  1427. {
  1428. name: "财务部门",
  1429. parentId: 101,
  1430. id: 106,
  1431. sort: 4,
  1432. phone: "15888888888",
  1433. principal: faker.person.firstName(),
  1434. email: faker.internet.email(),
  1435. status: 1,
  1436. type: 3,
  1437. createTime: 1605456000000,
  1438. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1439. },
  1440. {
  1441. name: "运维部门",
  1442. parentId: 101,
  1443. id: 107,
  1444. sort: 5,
  1445. phone: "15888888888",
  1446. principal: faker.person.firstName(),
  1447. email: faker.internet.email(),
  1448. status: 0,
  1449. type: 3,
  1450. createTime: 1605456000000,
  1451. remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
  1452. }
  1453. ]
  1454. };
  1455. }
  1456. },
  1457. // 在线用户
  1458. {
  1459. url: "/online-logs",
  1460. method: "post",
  1461. response: ({ body }) => {
  1462. let list = [
  1463. {
  1464. id: 1,
  1465. username: "admin",
  1466. ip: faker.internet.ipv4(),
  1467. address: "中国河南省信阳市",
  1468. system: "macOS",
  1469. browser: "Chrome",
  1470. loginTime: new Date()
  1471. },
  1472. {
  1473. id: 2,
  1474. username: "common",
  1475. ip: faker.internet.ipv4(),
  1476. address: "中国广东省深圳市",
  1477. system: "Windows",
  1478. browser: "Firefox",
  1479. loginTime: new Date()
  1480. }
  1481. ];
  1482. list = list.filter(item => item.username.includes(body?.username));
  1483. return {
  1484. success: true,
  1485. data: {
  1486. list,
  1487. total: list.length, // 总条目数
  1488. pageSize: 10, // 每页显示条目个数
  1489. currentPage: 1 // 当前页数
  1490. }
  1491. };
  1492. }
  1493. },
  1494. // 登录日志
  1495. {
  1496. url: "/login-logs",
  1497. method: "post",
  1498. response: ({ body }) => {
  1499. let list = [
  1500. {
  1501. id: 1,
  1502. username: "admin",
  1503. ip: faker.internet.ipv4(),
  1504. address: "中国河南省信阳市",
  1505. system: "macOS",
  1506. browser: "Chrome",
  1507. status: 1, // 登录状态 1 成功 0 失败
  1508. behavior: "账号登录",
  1509. loginTime: new Date()
  1510. },
  1511. {
  1512. id: 2,
  1513. username: "common",
  1514. ip: faker.internet.ipv4(),
  1515. address: "中国广东省深圳市",
  1516. system: "Windows",
  1517. browser: "Firefox",
  1518. status: 0,
  1519. behavior: "第三方登录",
  1520. loginTime: new Date()
  1521. }
  1522. ];
  1523. list = list.filter(item => item.username.includes(body?.username));
  1524. list = list.filter(item =>
  1525. String(item.status).includes(String(body?.status))
  1526. );
  1527. return {
  1528. success: true,
  1529. data: {
  1530. list,
  1531. total: list.length, // 总条目数
  1532. pageSize: 10, // 每页显示条目个数
  1533. currentPage: 1 // 当前页数
  1534. }
  1535. };
  1536. }
  1537. },
  1538. // 操作日志
  1539. {
  1540. url: "/operation-logs",
  1541. method: "post",
  1542. response: ({ body }) => {
  1543. let list = [
  1544. {
  1545. id: 1,
  1546. username: "admin",
  1547. ip: faker.internet.ipv4(),
  1548. address: "中国河南省信阳市",
  1549. system: "macOS",
  1550. browser: "Chrome",
  1551. status: 1, // 操作状态 1 成功 0 失败
  1552. summary: "菜单管理-添加菜单", // 操作概要
  1553. module: "系统管理", // 所属模块
  1554. operatingTime: new Date() // 操作时间
  1555. },
  1556. {
  1557. id: 2,
  1558. username: "common",
  1559. ip: faker.internet.ipv4(),
  1560. address: "中国广东省深圳市",
  1561. system: "Windows",
  1562. browser: "Firefox",
  1563. status: 0,
  1564. summary: "列表分页查询",
  1565. module: "在线用户",
  1566. operatingTime: new Date()
  1567. }
  1568. ];
  1569. list = list.filter(item => item.module.includes(body?.module));
  1570. list = list.filter(item =>
  1571. String(item.status).includes(String(body?.status))
  1572. );
  1573. return {
  1574. success: true,
  1575. data: {
  1576. list,
  1577. total: list.length, // 总条目数
  1578. pageSize: 10, // 每页显示条目个数
  1579. currentPage: 1 // 当前页数
  1580. }
  1581. };
  1582. }
  1583. },
  1584. // 系统日志
  1585. {
  1586. url: "/system-logs",
  1587. method: "post",
  1588. response: ({ body }) => {
  1589. let list = [
  1590. {
  1591. id: 1, // 日志ID
  1592. /**
  1593. * 日志级别
  1594. * 0 debug调试(最低级别的日志,用于调试和开发阶段)
  1595. * 1 info信息(默认级别,用于记录一般的信息)
  1596. * 2 warn警告(表示可能出现的问题或潜在的错误,但不会影响系统的正常运行)
  1597. * 3 error错误(表示发生了错误,但不会导致系统崩溃)
  1598. * 4 fatal致命(最高级别的日志,表示发生了严重错误,导致系统无法继续运行)
  1599. */
  1600. level: 1,
  1601. module: "菜单管理", // 所属模块
  1602. url: "/menu", // 请求接口
  1603. method: "post", // 请求方法
  1604. ip: faker.internet.ipv4(),
  1605. address: "中国河南省信阳市",
  1606. system: "macOS",
  1607. browser: "Chrome",
  1608. /**
  1609. * 请求耗时(单位:ms 毫秒)
  1610. * 正常耗时:一般认为在几百毫秒(0.1-0.5秒)范围内的请求耗时较为正常
  1611. * 较慢耗时:在1秒以上的耗时可以被认为是较慢的请求,但具体是否较慢还需要根据具体业务场景和性能要求来判断
  1612. */
  1613. takesTime: 10,
  1614. requestTime: new Date() // 请求时间
  1615. },
  1616. {
  1617. id: 2,
  1618. level: 0,
  1619. module: "地图",
  1620. url: "/get-map-info",
  1621. method: "get",
  1622. ip: faker.internet.ipv4(),
  1623. address: "中国广东省深圳市",
  1624. system: "Windows",
  1625. browser: "Firefox",
  1626. takesTime: 1200,
  1627. requestTime: new Date()
  1628. }
  1629. ];
  1630. list = list.filter(item => item.module.includes(body?.module));
  1631. return {
  1632. success: true,
  1633. data: {
  1634. list,
  1635. total: list.length, // 总条目数
  1636. pageSize: 10, // 每页显示条目个数
  1637. currentPage: 1 // 当前页数
  1638. }
  1639. };
  1640. }
  1641. },
  1642. // 系统日志-根据 id 查日志详情
  1643. {
  1644. url: "/system-logs-detail",
  1645. method: "post",
  1646. response: ({ body }) => {
  1647. if (body.id == 1) {
  1648. return {
  1649. id: 1,
  1650. level: 1,
  1651. module: "菜单管理",
  1652. url: "/menu",
  1653. method: "post",
  1654. ip: faker.internet.ipv4(),
  1655. address: "中国河南省信阳市",
  1656. system: "macOS",
  1657. browser: "Chrome",
  1658. takesTime: 10,
  1659. responseHeaders: {
  1660. traceId: "1495502411171032",
  1661. "Content-Type": "application/json",
  1662. Connection: "keep-alive",
  1663. "Keep-Alive": "timeout=5",
  1664. "Content-Length": 17019
  1665. },
  1666. responseBody: {
  1667. success: true,
  1668. data: [
  1669. {
  1670. parentId: 0,
  1671. id: 400,
  1672. menuType: 0,
  1673. title: "menus.pureSysMonitor",
  1674. name: "PureMonitor",
  1675. path: "/monitor",
  1676. component: "",
  1677. rank: 11,
  1678. redirect: "",
  1679. icon: "ep:monitor",
  1680. extraIcon: "",
  1681. enterTransition: "",
  1682. leaveTransition: "",
  1683. activePath: "",
  1684. auths: "",
  1685. frameSrc: "",
  1686. frameLoading: true,
  1687. keepAlive: false,
  1688. hiddenTag: false,
  1689. fixedTag: false,
  1690. showLink: true,
  1691. showParent: false
  1692. },
  1693. {
  1694. parentId: 400,
  1695. id: 401,
  1696. menuType: 0,
  1697. title: "menus.pureOnlineUser",
  1698. name: "OnlineUser",
  1699. path: "/monitor/online-user",
  1700. component: "monitor/online/index",
  1701. rank: null,
  1702. redirect: "",
  1703. icon: "ri:user-voice-line",
  1704. extraIcon: "",
  1705. enterTransition: "",
  1706. leaveTransition: "",
  1707. activePath: "",
  1708. auths: "",
  1709. frameSrc: "",
  1710. frameLoading: true,
  1711. keepAlive: false,
  1712. hiddenTag: false,
  1713. fixedTag: false,
  1714. showLink: true,
  1715. showParent: false
  1716. },
  1717. {
  1718. parentId: 400,
  1719. id: 402,
  1720. menuType: 0,
  1721. title: "menus.pureLoginLog",
  1722. name: "LoginLog",
  1723. path: "/monitor/login-logs",
  1724. component: "monitor/logs/login/index",
  1725. rank: null,
  1726. redirect: "",
  1727. icon: "ri:window-line",
  1728. extraIcon: "",
  1729. enterTransition: "",
  1730. leaveTransition: "",
  1731. activePath: "",
  1732. auths: "",
  1733. frameSrc: "",
  1734. frameLoading: true,
  1735. keepAlive: false,
  1736. hiddenTag: false,
  1737. fixedTag: false,
  1738. showLink: true,
  1739. showParent: false
  1740. },
  1741. {
  1742. parentId: 400,
  1743. id: 403,
  1744. menuType: 0,
  1745. title: "menus.pureOperationLog",
  1746. name: "OperationLog",
  1747. path: "/monitor/operation-logs",
  1748. component: "monitor/logs/operation/index",
  1749. rank: null,
  1750. redirect: "",
  1751. icon: "ri:history-fill",
  1752. extraIcon: "",
  1753. enterTransition: "",
  1754. leaveTransition: "",
  1755. activePath: "",
  1756. auths: "",
  1757. frameSrc: "",
  1758. frameLoading: true,
  1759. keepAlive: false,
  1760. hiddenTag: false,
  1761. fixedTag: false,
  1762. showLink: true,
  1763. showParent: false
  1764. },
  1765. {
  1766. parentId: 400,
  1767. id: 404,
  1768. menuType: 0,
  1769. title: "menus.pureSystemLog",
  1770. name: "SystemLog",
  1771. path: "/monitor/system-logs",
  1772. component: "monitor/logs/system/index",
  1773. rank: null,
  1774. redirect: "",
  1775. icon: "ri:file-search-line",
  1776. extraIcon: "",
  1777. enterTransition: "",
  1778. leaveTransition: "",
  1779. activePath: "",
  1780. auths: "",
  1781. frameSrc: "",
  1782. frameLoading: true,
  1783. keepAlive: false,
  1784. hiddenTag: false,
  1785. fixedTag: false,
  1786. showLink: true,
  1787. showParent: false
  1788. }
  1789. ]
  1790. },
  1791. requestHeaders: {
  1792. Accept: "application/json, text/plain, */*",
  1793. "Accept-Encoding": "gzip, deflate",
  1794. "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,eo;q=0.7",
  1795. Authorization: "Bearer eyJhbGciOiJIUzUxMiJ9.admin",
  1796. Connection: "keep-alive",
  1797. "Content-Length": 0,
  1798. Cookie:
  1799. "_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",
  1800. Host: "192.168.2.121:8848",
  1801. Origin: "http://192.168.2.121:8848",
  1802. Referer: "http://192.168.2.121:8848/",
  1803. "User-Agent":
  1804. "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",
  1805. "X-Requested-With": "XMLHttpRequest"
  1806. },
  1807. requestBody: {
  1808. title: "系统监控"
  1809. },
  1810. traceId: "1495502411171032",
  1811. requestTime: new Date()
  1812. };
  1813. } else if (body.id == 2) {
  1814. return {
  1815. id: 2,
  1816. level: 0,
  1817. module: "地图",
  1818. url: "/get-map-info?plateNumber=豫A59778U",
  1819. method: "get",
  1820. ip: faker.internet.ipv4(),
  1821. address: "中国广东省深圳市",
  1822. system: "Windows",
  1823. browser: "Firefox",
  1824. takesTime: 1200,
  1825. responseHeaders: {
  1826. traceId: "2280443117103208",
  1827. "Content-Type": "application/json",
  1828. Connection: "keep-alive",
  1829. "Keep-Alive": "timeout=5",
  1830. "Content-Length": 28693
  1831. },
  1832. responseBody: {
  1833. plateNumber: "豫A59778U",
  1834. driver: "子骞",
  1835. orientation: 289,
  1836. lng: 113.8564,
  1837. lat: 34.373
  1838. },
  1839. requestHeaders: {
  1840. Accept: "application/json, text/plain, */*",
  1841. "Accept-Encoding": "gzip, deflate",
  1842. "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,eo;q=0.7",
  1843. Authorization: "Bearer eyJhbGciOiJIUzUxMiJ9.admin",
  1844. Connection: "keep-alive",
  1845. "Content-Length": 0,
  1846. Cookie:
  1847. "_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",
  1848. Host: "192.168.2.121:8848",
  1849. Origin: "http://192.168.2.121:8848",
  1850. Referer: "http://192.168.2.121:8848/",
  1851. "User-Agent":
  1852. "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",
  1853. "X-Requested-With": "XMLHttpRequest"
  1854. },
  1855. requestBody: null,
  1856. traceId: "2280443117103208",
  1857. requestTime: new Date()
  1858. };
  1859. }
  1860. }
  1861. }
  1862. ]);