feat: 完善系统管理-用户管理页面 (#688)

* feat: 完善系统管理-用户管理页面

* feat: 上传头像

* feat: 重置密码

* feat: 分配角色

* chore: update type

* chore: done
This commit is contained in:
xiaoming
2023-08-29 11:18:00 +08:00
committed by GitHub
parent fad5483491
commit bc1bd23e80
20 changed files with 1978 additions and 1214 deletions

View File

@@ -1,86 +1,104 @@
import { MockMethod } from "vite-plugin-mock";
export default [
// 用户
// 用户管理
{
url: "/user",
method: "post",
response: () => {
response: ({ body }) => {
let list = [
{
username: "admin",
nickname: "admin",
avatar: "https://avatars.githubusercontent.com/u/44761321",
phone: "15888886789",
email: "@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: "@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: [
{
username: "admin",
nickname: "admin",
remark: "管理员",
deptId: 103,
postIds: [1],
mobile: "15888888888",
sex: 0,
id: 1,
status: 0,
createTime: 1605456000000,
dept: {
id: 103,
name: "研发部门"
}
},
{
username: "pure",
nickname: "pure",
remark: "不要吓我",
deptId: 104,
postIds: [1],
mobile: "15888888888",
sex: 0,
id: 100,
status: 1,
createTime: 1605456000000,
dept: {
id: 104,
name: "市场部门"
}
},
{
username: "小姐姐",
nickname: "girl",
remark: null,
deptId: 106,
postIds: null,
mobile: "15888888888",
sex: 1,
id: 103,
status: 1,
createTime: 1605456000000,
dept: {
id: 106,
name: "财务部门"
}
},
{
username: "小哥哥",
nickname: "boy",
remark: null,
deptId: 107,
postIds: [],
mobile: "15888888888",
sex: 0,
id: 104,
status: 0,
createTime: 1605456000000,
dept: {
id: 107,
name: "运维部门"
}
}
],
total: 4
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",
@@ -89,7 +107,6 @@ export default [
{
createTime: 1605456000000, // 时间戳毫秒ms
updateTime: 1684512000000,
creator: "admin",
id: 1,
name: "超级管理员",
code: "admin",
@@ -99,7 +116,6 @@ export default [
{
createTime: 1605456000000,
updateTime: 1684512000000,
creator: "admin",
id: 2,
name: "普通角色",
code: "common",
@@ -123,7 +139,7 @@ export default [
};
}
},
// 部门
// 部门管理
{
url: "/dept",
method: "post",