feat: 完善基础增删改查Mock接口

This commit is contained in:
郝先瑞
2024-03-05 18:32:37 +08:00
parent e87d9f7da0
commit bc0fad3146
5 changed files with 858 additions and 75 deletions

View File

@@ -67,4 +67,81 @@ export default defineMock([
msg: "一切ok",
},
},
// 新增部门
{
url: "dept",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增部门" + body.name + "成功",
};
},
},
// 获取部门表单数据
{
url: "dept/:id/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: deptMap[params.id],
msg: "一切ok",
};
},
},
// 修改部门
{
url: "dept/:id",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改部门" + body.name + "成功",
};
},
},
// 删除部门
{
url: "dept/:id",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除部门" + params.id + "成功",
};
},
},
]);
// 部门映射表数据
const deptMap: Record<string, any> = {
1: {
id: 1,
name: "有来技术",
parentId: 0,
status: 1,
sort: 1,
},
2: {
id: 2,
name: "研发部门",
parentId: 1,
status: 1,
sort: 1,
},
3: {
id: 3,
name: "测试部门",
parentId: 1,
status: 1,
sort: 1,
},
};