1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096 |
- 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: "/menu",
- method: "post",
- response: () => {
- return {
- success: true,
- data: [
- // 外部页面
- {
- parentId: 0,
- id: 100,
- menuType: 0, // 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
- title: "menus.hsExternalPage",
- 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.hsExternalDoc",
- 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.externalLink",
- 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.hsEmbeddedDoc",
- 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.hsEpDocument",
- 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.hsTailwindcssDocument",
- 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.hsVueDocument",
- 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.hsViteDocument",
- 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.hsPiniaDocument",
- 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.hsRouterDocument",
- 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.permission",
- 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.permissionPage",
- 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.permissionButton",
- 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.hssysManagement",
- 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.hsUser",
- 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.hsRole",
- 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.hsSystemMenu",
- 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.hsDept",
- 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.hssysMonitor",
- 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.hsOnlineUser",
- 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.hsLoginLog",
- 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.hsOperationLog",
- name: "OperationLog",
- path: "/monitor/operation-logs",
- component: "monitor/logs/operation",
- 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.hsSystemLog",
- name: "SystemLog",
- path: "/monitor/system-logs",
- component: "monitor/logs/system",
- 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.hstabs",
- 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.hstabs",
- 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 // 当前页数
- }
- };
- }
- }
- ]);
|