12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643 |
- import { defineFakeRoute } from "vite-plugin-fake-server/client";
- import { faker } from "@faker-js/faker/locale/zh_CN";
- export default defineFakeRoute([
- // 用户管理
- {
- url: "/user",
- method: "post",
- response: ({ body }) => {
- let list = [
- {
- username: "admin",
- nickname: "admin",
- avatar: "https://avatars.githubusercontent.com/u/44761321",
- phone: "15888886789",
- email: faker.internet.email(),
- sex: 0,
- id: 1,
- status: 1,
- dept: {
- // 部门id
- id: 103,
- // 部门名称
- name: "研发部门"
- },
- remark: "管理员",
- createTime: 1605456000000
- },
- {
- username: "common",
- nickname: "common",
- avatar: "https://avatars.githubusercontent.com/u/52823142",
- phone: "18288882345",
- email: faker.internet.email(),
- sex: 1,
- id: 2,
- status: 1,
- dept: {
- id: 105,
- name: "测试部门"
- },
- remark: "普通用户",
- createTime: 1605456000000
- }
- ];
- list = list.filter(item => item.username.includes(body?.username));
- list = list.filter(item =>
- String(item.status).includes(String(body?.status))
- );
- if (body.phone) list = list.filter(item => item.phone === body.phone);
- if (body.deptId) list = list.filter(item => item.dept.id === body.deptId);
- return {
- success: true,
- data: {
- list,
- total: list.length, // 总条目数
- pageSize: 10, // 每页显示条目个数
- currentPage: 1 // 当前页数
- }
- };
- }
- },
- // 用户管理-获取所有角色列表
- {
- url: "/list-all-role",
- method: "get",
- response: () => {
- return {
- success: true,
- data: [
- { id: 1, name: "超级管理员" },
- { id: 2, name: "普通角色" }
- ]
- };
- }
- },
- // 用户管理-根据 userId 获取对应角色 id 列表(userId:用户id)
- {
- url: "/list-role-ids",
- method: "post",
- response: ({ body }) => {
- if (body.userId) {
- if (body.userId == 1) {
- return {
- success: true,
- data: [1]
- };
- } else if (body.userId == 2) {
- return {
- success: true,
- data: [2]
- };
- }
- } else {
- return {
- success: false,
- data: []
- };
- }
- }
- },
- // 角色管理
- {
- url: "/role",
- method: "post",
- response: ({ body }) => {
- let list = [
- {
- createTime: 1605456000000, // 时间戳(毫秒ms)
- updateTime: 1684512000000,
- id: 1,
- name: "超级管理员",
- code: "admin",
- status: 1, // 状态 1 启用 0 停用
- remark: "超级管理员拥有最高权限"
- },
- {
- createTime: 1605456000000,
- updateTime: 1684512000000,
- id: 2,
- name: "普通角色",
- code: "common",
- status: 1,
- remark: "普通角色拥有部分权限"
- }
- ];
- list = list.filter(item => item.name.includes(body?.name));
- list = list.filter(item =>
- String(item.status).includes(String(body?.status))
- );
- if (body.code) list = list.filter(item => item.code === body.code);
- return {
- success: true,
- data: {
- list,
- total: list.length, // 总条目数
- pageSize: 10, // 每页显示条目个数
- currentPage: 1 // 当前页数
- }
- };
- }
- },
- // 角色管理-权限-菜单权限
- {
- url: "/role-menu",
- method: "post",
- response: () => {
- return {
- success: true,
- data: [
- // 外部页面
- {
- parentId: 0,
- id: 100,
- menuType: 0, // 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
- title: "menus.pureExternalPage"
- },
- {
- parentId: 100,
- id: 101,
- menuType: 0,
- title: "menus.pureExternalDoc"
- },
- {
- parentId: 101,
- id: 102,
- menuType: 2,
- title: "menus.pureExternalLink"
- },
- {
- parentId: 101,
- id: 103,
- menuType: 2,
- title: "menus.pureUtilsLink"
- },
- {
- parentId: 100,
- id: 104,
- menuType: 1,
- title: "menus.pureEmbeddedDoc"
- },
- {
- parentId: 104,
- id: 105,
- menuType: 1,
- title: "menus.pureEpDoc"
- },
- {
- parentId: 104,
- id: 106,
- menuType: 1,
- title: "menus.pureTailwindcssDoc"
- },
- {
- parentId: 104,
- id: 107,
- menuType: 1,
- title: "menus.pureVueDoc"
- },
- {
- parentId: 104,
- id: 108,
- menuType: 1,
- title: "menus.pureViteDoc"
- },
- {
- parentId: 104,
- id: 109,
- menuType: 1,
- title: "menus.purePiniaDoc"
- },
- {
- parentId: 104,
- id: 110,
- menuType: 1,
- title: "menus.pureRouterDoc"
- },
- // 权限管理
- {
- parentId: 0,
- id: 200,
- menuType: 0,
- title: "menus.purePermission"
- },
- {
- parentId: 200,
- id: 201,
- menuType: 0,
- title: "menus.purePermissionPage"
- },
- {
- parentId: 200,
- id: 202,
- menuType: 0,
- title: "menus.purePermissionButton"
- },
- {
- parentId: 202,
- id: 203,
- menuType: 3,
- title: "添加"
- },
- {
- parentId: 202,
- id: 204,
- menuType: 3,
- title: "修改"
- },
- {
- parentId: 202,
- id: 205,
- menuType: 3,
- title: "删除"
- },
- // 系统管理
- {
- parentId: 0,
- id: 300,
- menuType: 0,
- title: "menus.pureSysManagement"
- },
- {
- parentId: 300,
- id: 301,
- menuType: 0,
- title: "menus.pureUser"
- },
- {
- parentId: 300,
- id: 302,
- menuType: 0,
- title: "menus.pureRole"
- },
- {
- parentId: 300,
- id: 303,
- menuType: 0,
- title: "menus.pureSystemMenu"
- },
- {
- parentId: 300,
- id: 304,
- menuType: 0,
- title: "menus.pureDept"
- },
- // 系统监控
- {
- parentId: 0,
- id: 400,
- menuType: 0,
- title: "menus.pureSysMonitor"
- },
- {
- parentId: 400,
- id: 401,
- menuType: 0,
- title: "menus.pureOnlineUser"
- },
- {
- parentId: 400,
- id: 402,
- menuType: 0,
- title: "menus.pureLoginLog"
- },
- {
- parentId: 400,
- id: 403,
- menuType: 0,
- title: "menus.pureOperationLog"
- },
- {
- parentId: 400,
- id: 404,
- menuType: 0,
- title: "menus.pureSystemLog"
- },
- // 标签页操作
- {
- parentId: 0,
- id: 500,
- menuType: 0,
- title: "menus.pureTabs"
- },
- {
- parentId: 500,
- id: 501,
- menuType: 0,
- title: "menus.pureTabs"
- },
- {
- parentId: 500,
- id: 502,
- menuType: 0,
- title: "query传参模式"
- },
- {
- parentId: 500,
- id: 503,
- menuType: 0,
- title: "params传参模式"
- }
- ]
- };
- }
- },
- // 角色管理-权限-菜单权限-根据角色 id 查对应菜单
- {
- url: "/role-menu-ids",
- method: "post",
- response: ({ body }) => {
- if (body.id == 1) {
- return {
- success: true,
- data: [
- 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 200, 201,
- 202, 203, 204, 205, 300, 301, 302, 303, 304, 400, 401, 402, 403,
- 404, 500, 501, 502, 503
- ]
- };
- } else if (body.id == 2) {
- return {
- success: true,
- data: [
- 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 404, 500,
- 501, 502, 503
- ]
- };
- }
- }
- },
- // 菜单管理
- {
- url: "/menu",
- method: "post",
- response: () => {
- return {
- success: true,
- data: [
- // 外部页面
- {
- parentId: 0,
- id: 100,
- menuType: 0, // 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
- title: "menus.pureExternalPage",
- name: "PureIframe",
- path: "/iframe",
- component: "",
- rank: 7,
- redirect: "",
- icon: "ri:links-fill",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 100,
- id: 101,
- menuType: 0,
- title: "menus.pureExternalDoc",
- name: "PureIframeExternal",
- path: "/iframe/external",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 101,
- id: 102,
- menuType: 2,
- title: "menus.pureExternalLink",
- name: "https://yiming_chang.gitee.io/pure-admin-doc",
- path: "/external",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 101,
- id: 103,
- menuType: 2,
- title: "menus.pureUtilsLink",
- name: "https://pure-admin-utils.netlify.app/",
- path: "/pureUtilsLink",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 100,
- id: 104,
- menuType: 1,
- title: "menus.pureEmbeddedDoc",
- name: "PureIframeEmbedded",
- path: "/iframe/embedded",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 104,
- id: 105,
- menuType: 1,
- title: "menus.pureEpDoc",
- name: "FrameEp",
- path: "/iframe/ep",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "https://element-plus.org/zh-CN/",
- frameLoading: true,
- keepAlive: true,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 104,
- id: 106,
- menuType: 1,
- title: "menus.pureTailwindcssDoc",
- name: "FrameTailwindcss",
- path: "/iframe/tailwindcss",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "https://tailwindcss.com/docs/installation",
- frameLoading: true,
- keepAlive: true,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 104,
- id: 107,
- menuType: 1,
- title: "menus.pureVueDoc",
- name: "FrameVue",
- path: "/iframe/vue3",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "https://cn.vuejs.org/",
- frameLoading: true,
- keepAlive: true,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 104,
- id: 108,
- menuType: 1,
- title: "menus.pureViteDoc",
- name: "FrameVite",
- path: "/iframe/vite",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "https://cn.vitejs.dev/",
- frameLoading: true,
- keepAlive: true,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 104,
- id: 109,
- menuType: 1,
- title: "menus.purePiniaDoc",
- name: "FramePinia",
- path: "/iframe/pinia",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "https://pinia.vuejs.org/zh/index.html",
- frameLoading: true,
- keepAlive: true,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 104,
- id: 110,
- menuType: 1,
- title: "menus.pureRouterDoc",
- name: "FrameRouter",
- path: "/iframe/vue-router",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "https://router.vuejs.org/zh/",
- frameLoading: true,
- keepAlive: true,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- // 权限管理
- {
- parentId: 0,
- id: 200,
- menuType: 0,
- title: "menus.purePermission",
- name: "PurePermission",
- path: "/permission",
- component: "",
- rank: 9,
- redirect: "",
- icon: "ep:lollipop",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 200,
- id: 201,
- menuType: 0,
- title: "menus.purePermissionPage",
- name: "PermissionPage",
- path: "/permission/page/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 200,
- id: 202,
- menuType: 0,
- title: "menus.purePermissionButton",
- name: "PermissionButton",
- path: "/permission/button/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 202,
- id: 203,
- menuType: 3,
- title: "添加",
- name: "",
- path: "",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "permission:btn:add",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 202,
- id: 204,
- menuType: 3,
- title: "修改",
- name: "",
- path: "",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "permission:btn:edit",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 202,
- id: 205,
- menuType: 3,
- title: "删除",
- name: "",
- path: "",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "permission:btn:delete",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- // 系统管理
- {
- parentId: 0,
- id: 300,
- menuType: 0,
- title: "menus.pureSysManagement",
- name: "PureSystem",
- path: "/system",
- component: "",
- rank: 10,
- redirect: "",
- icon: "ri:settings-3-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 300,
- id: 301,
- menuType: 0,
- title: "menus.pureUser",
- name: "SystemUser",
- path: "/system/user/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "ri:admin-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 300,
- id: 302,
- menuType: 0,
- title: "menus.pureRole",
- name: "SystemRole",
- path: "/system/role/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "ri:admin-fill",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 300,
- id: 303,
- menuType: 0,
- title: "menus.pureSystemMenu",
- name: "SystemMenu",
- path: "/system/menu/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "ep:menu",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 300,
- id: 304,
- menuType: 0,
- title: "menus.pureDept",
- name: "SystemDept",
- path: "/system/dept/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "ri:git-branch-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- // 系统监控
- {
- parentId: 0,
- id: 400,
- menuType: 0,
- title: "menus.pureSysMonitor",
- name: "PureMonitor",
- path: "/monitor",
- component: "",
- rank: 11,
- redirect: "",
- icon: "ep:monitor",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 401,
- menuType: 0,
- title: "menus.pureOnlineUser",
- name: "OnlineUser",
- path: "/monitor/online-user",
- component: "monitor/online/index",
- rank: null,
- redirect: "",
- icon: "ri:user-voice-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 402,
- menuType: 0,
- title: "menus.pureLoginLog",
- name: "LoginLog",
- path: "/monitor/login-logs",
- component: "monitor/logs/login/index",
- rank: null,
- redirect: "",
- icon: "ri:window-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 403,
- menuType: 0,
- title: "menus.pureOperationLog",
- name: "OperationLog",
- path: "/monitor/operation-logs",
- component: "monitor/logs/operation/index",
- rank: null,
- redirect: "",
- icon: "ri:history-fill",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 404,
- menuType: 0,
- title: "menus.pureSystemLog",
- name: "SystemLog",
- path: "/monitor/system-logs",
- component: "monitor/logs/system/index",
- rank: null,
- redirect: "",
- icon: "ri:file-search-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- // 标签页操作
- {
- parentId: 0,
- id: 500,
- menuType: 0,
- title: "menus.pureTabs",
- name: "PureTabs",
- path: "/tabs",
- component: "",
- rank: 12,
- redirect: "",
- icon: "ri:bookmark-2-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 500,
- id: 501,
- menuType: 0,
- title: "menus.pureTabs",
- name: "Tabs",
- path: "/tabs/index",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 500,
- id: 502,
- menuType: 0,
- title: "query传参模式",
- name: "TabQueryDetail",
- path: "/tabs/query-detail",
- component: "",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "/tabs/index",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: false,
- showParent: false
- },
- {
- parentId: 500,
- id: 503,
- menuType: 0,
- title: "params传参模式",
- name: "TabParamsDetail",
- path: "/tabs/params-detail/:id",
- component: "params-detail",
- rank: null,
- redirect: "",
- icon: "",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "/tabs/index",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: false,
- showParent: false
- }
- ]
- };
- }
- },
- // 部门管理
- {
- url: "/dept",
- method: "post",
- response: () => {
- return {
- success: true,
- data: [
- {
- name: "杭州总公司",
- parentId: 0,
- id: 100,
- sort: 0,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1, // 状态 1 启用 0 停用
- type: 1, // 1 公司 2 分公司 3 部门
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "郑州分公司",
- parentId: 100,
- id: 101,
- sort: 1,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 2,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "研发部门",
- parentId: 101,
- id: 103,
- sort: 1,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "市场部门",
- parentId: 102,
- id: 108,
- sort: 1,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "深圳分公司",
- parentId: 100,
- id: 102,
- sort: 2,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 2,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "市场部门",
- parentId: 101,
- id: 104,
- sort: 2,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "财务部门",
- parentId: 102,
- id: 109,
- sort: 2,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "测试部门",
- parentId: 101,
- id: 105,
- sort: 3,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 0,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "财务部门",
- parentId: 101,
- id: 106,
- sort: 4,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 1,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- },
- {
- name: "运维部门",
- parentId: 101,
- id: 107,
- sort: 5,
- phone: "15888888888",
- principal: faker.person.firstName(),
- email: faker.internet.email(),
- status: 0,
- type: 3,
- createTime: 1605456000000,
- remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
- }
- ]
- };
- }
- },
- // 在线用户
- {
- url: "/online-logs",
- method: "post",
- response: ({ body }) => {
- let list = [
- {
- id: 1,
- username: "admin",
- ip: faker.internet.ipv4(),
- address: "中国河南省信阳市",
- system: "macOS",
- browser: "Chrome",
- loginTime: new Date()
- },
- {
- id: 2,
- username: "common",
- ip: faker.internet.ipv4(),
- address: "中国广东省深圳市",
- system: "Windows",
- browser: "Firefox",
- loginTime: new Date()
- }
- ];
- list = list.filter(item => item.username.includes(body?.username));
- return {
- success: true,
- data: {
- list,
- total: list.length, // 总条目数
- pageSize: 10, // 每页显示条目个数
- currentPage: 1 // 当前页数
- }
- };
- }
- },
- // 登录日志
- {
- url: "/login-logs",
- method: "post",
- response: ({ body }) => {
- let list = [
- {
- id: 1,
- username: "admin",
- ip: faker.internet.ipv4(),
- address: "中国河南省信阳市",
- system: "macOS",
- browser: "Chrome",
- status: 1, // 登录状态 1 成功 0 失败
- behavior: "账号登录",
- loginTime: new Date()
- },
- {
- id: 2,
- username: "common",
- ip: faker.internet.ipv4(),
- address: "中国广东省深圳市",
- system: "Windows",
- browser: "Firefox",
- status: 0,
- behavior: "第三方登录",
- loginTime: new Date()
- }
- ];
- list = list.filter(item => item.username.includes(body?.username));
- list = list.filter(item =>
- String(item.status).includes(String(body?.status))
- );
- return {
- success: true,
- data: {
- list,
- total: list.length, // 总条目数
- pageSize: 10, // 每页显示条目个数
- currentPage: 1 // 当前页数
- }
- };
- }
- },
- // 操作日志
- {
- url: "/operation-logs",
- method: "post",
- response: ({ body }) => {
- let list = [
- {
- id: 1,
- username: "admin",
- ip: faker.internet.ipv4(),
- address: "中国河南省信阳市",
- system: "macOS",
- browser: "Chrome",
- status: 1, // 操作状态 1 成功 0 失败
- summary: "菜单管理-添加菜单", // 操作概要
- module: "系统管理", // 所属模块
- operatingTime: new Date() // 操作时间
- },
- {
- id: 2,
- username: "common",
- ip: faker.internet.ipv4(),
- address: "中国广东省深圳市",
- system: "Windows",
- browser: "Firefox",
- status: 0,
- summary: "列表分页查询",
- module: "在线用户",
- operatingTime: new Date()
- }
- ];
- list = list.filter(item => item.module.includes(body?.module));
- list = list.filter(item =>
- String(item.status).includes(String(body?.status))
- );
- return {
- success: true,
- data: {
- list,
- total: list.length, // 总条目数
- pageSize: 10, // 每页显示条目个数
- currentPage: 1 // 当前页数
- }
- };
- }
- },
- // 系统日志
- {
- url: "/system-logs",
- method: "post",
- response: ({ body }) => {
- let list = [
- {
- id: 1, // 日志ID
- /**
- * 日志级别
- * 0 debug调试(最低级别的日志,用于调试和开发阶段)
- * 1 info信息(默认级别,用于记录一般的信息)
- * 2 warn警告(表示可能出现的问题或潜在的错误,但不会影响系统的正常运行)
- * 3 error错误(表示发生了错误,但不会导致系统崩溃)
- * 4 fatal致命(最高级别的日志,表示发生了严重错误,导致系统无法继续运行)
- */
- level: 1,
- module: "菜单管理", // 所属模块
- url: "/menu", // 请求接口
- method: "post", // 请求方法
- ip: faker.internet.ipv4(),
- address: "中国河南省信阳市",
- system: "macOS",
- browser: "Chrome",
- /**
- * 请求耗时(单位:ms 毫秒)
- * 正常耗时:一般认为在几百毫秒(0.1-0.5秒)范围内的请求耗时较为正常
- * 较慢耗时:在1秒以上的耗时可以被认为是较慢的请求,但具体是否较慢还需要根据具体业务场景和性能要求来判断
- */
- takesTime: 10,
- requestTime: new Date() // 请求时间
- },
- {
- id: 2,
- level: 0,
- module: "地图",
- url: "/get-map-info",
- method: "get",
- ip: faker.internet.ipv4(),
- address: "中国广东省深圳市",
- system: "Windows",
- browser: "Firefox",
- takesTime: 1200,
- requestTime: new Date()
- }
- ];
- list = list.filter(item => item.module.includes(body?.module));
- return {
- success: true,
- data: {
- list,
- total: list.length, // 总条目数
- pageSize: 10, // 每页显示条目个数
- currentPage: 1 // 当前页数
- }
- };
- }
- },
- // 系统日志-根据 id 查日志详情
- {
- url: "/system-logs-detail",
- method: "post",
- response: ({ body }) => {
- if (body.id == 1) {
- return {
- id: 1,
- level: 1,
- module: "菜单管理",
- url: "/menu",
- method: "post",
- ip: faker.internet.ipv4(),
- address: "中国河南省信阳市",
- system: "macOS",
- browser: "Chrome",
- takesTime: 10,
- responseHeaders: {
- traceId: "1495502411171032",
- "Content-Type": "application/json",
- Connection: "keep-alive",
- "Keep-Alive": "timeout=5",
- "Content-Length": 17019
- },
- responseBody: {
- success: true,
- data: [
- {
- parentId: 0,
- id: 400,
- menuType: 0,
- title: "menus.pureSysMonitor",
- name: "PureMonitor",
- path: "/monitor",
- component: "",
- rank: 11,
- redirect: "",
- icon: "ep:monitor",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 401,
- menuType: 0,
- title: "menus.pureOnlineUser",
- name: "OnlineUser",
- path: "/monitor/online-user",
- component: "monitor/online/index",
- rank: null,
- redirect: "",
- icon: "ri:user-voice-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 402,
- menuType: 0,
- title: "menus.pureLoginLog",
- name: "LoginLog",
- path: "/monitor/login-logs",
- component: "monitor/logs/login/index",
- rank: null,
- redirect: "",
- icon: "ri:window-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 403,
- menuType: 0,
- title: "menus.pureOperationLog",
- name: "OperationLog",
- path: "/monitor/operation-logs",
- component: "monitor/logs/operation/index",
- rank: null,
- redirect: "",
- icon: "ri:history-fill",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- },
- {
- parentId: 400,
- id: 404,
- menuType: 0,
- title: "menus.pureSystemLog",
- name: "SystemLog",
- path: "/monitor/system-logs",
- component: "monitor/logs/system/index",
- rank: null,
- redirect: "",
- icon: "ri:file-search-line",
- extraIcon: "",
- enterTransition: "",
- leaveTransition: "",
- activePath: "",
- auths: "",
- frameSrc: "",
- frameLoading: true,
- keepAlive: false,
- hiddenTag: false,
- showLink: true,
- showParent: false
- }
- ]
- },
- requestHeaders: {
- Accept: "application/json, text/plain, */*",
- "Accept-Encoding": "gzip, deflate",
- "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,eo;q=0.7",
- Authorization: "Bearer eyJhbGciOiJIUzUxMiJ9.admin",
- Connection: "keep-alive",
- "Content-Length": 0,
- Cookie:
- "_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",
- Host: "192.168.2.121:8848",
- Origin: "http://192.168.2.121:8848",
- Referer: "http://192.168.2.121:8848/",
- "User-Agent":
- "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",
- "X-Requested-With": "XMLHttpRequest"
- },
- requestBody: {
- title: "系统监控"
- },
- traceId: "1495502411171032",
- requestTime: new Date()
- };
- } else if (body.id == 2) {
- return {
- id: 2,
- level: 0,
- module: "地图",
- url: "/get-map-info?plateNumber=豫A59778U",
- method: "get",
- ip: faker.internet.ipv4(),
- address: "中国广东省深圳市",
- system: "Windows",
- browser: "Firefox",
- takesTime: 1200,
- responseHeaders: {
- traceId: "2280443117103208",
- "Content-Type": "application/json",
- Connection: "keep-alive",
- "Keep-Alive": "timeout=5",
- "Content-Length": 28693
- },
- responseBody: {
- plateNumber: "豫A59778U",
- driver: "子骞",
- orientation: 289,
- lng: 113.8564,
- lat: 34.373
- },
- requestHeaders: {
- Accept: "application/json, text/plain, */*",
- "Accept-Encoding": "gzip, deflate",
- "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,eo;q=0.7",
- Authorization: "Bearer eyJhbGciOiJIUzUxMiJ9.admin",
- Connection: "keep-alive",
- "Content-Length": 0,
- Cookie:
- "_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",
- Host: "192.168.2.121:8848",
- Origin: "http://192.168.2.121:8848",
- Referer: "http://192.168.2.121:8848/",
- "User-Agent":
- "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",
- "X-Requested-With": "XMLHttpRequest"
- },
- requestBody: null,
- traceId: "2280443117103208",
- requestTime: new Date()
- };
- }
- }
- }
- ]);
|