Files
vue3-element-admin/mock/tenant-plan.mock.ts
Ray.Hao ff6f68c0ce feat: 更新mock数据和用户store逻辑
重构用户模块的异步函数,添加租户和租户计划的mock接口,优化字典表单和请求拦截器的实现。
2026-03-06 22:47:09 +08:00

126 lines
2.3 KiB
TypeScript

import { defineMock } from "./base";
export default defineMock([
{
url: "tenant-plans",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 1,
name: "基础版",
code: "BASIC",
status: 1,
sort: 1,
remark: "",
createTime: "2026-03-01 10:00:00",
updateTime: "2026-03-01 10:00:00",
},
{
id: 2,
name: "专业版",
code: "PRO",
status: 1,
sort: 2,
remark: "",
createTime: "2026-03-02 10:00:00",
updateTime: "2026-03-02 10:00:00",
},
],
total: 2,
},
msg: "一切ok",
},
},
{
url: "tenant-plans/options",
method: ["GET"],
body: {
code: "00000",
data: [
{ value: 1, label: "基础版" },
{ value: 2, label: "专业版" },
],
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId/form",
method: ["GET"],
body: ({ params }) => {
const planId = Number(params.planId);
const form =
planId === 2
? {
id: 2,
name: "专业版",
code: "PRO",
status: 1,
sort: 2,
remark: "",
}
: {
id: 1,
name: "基础版",
code: "BASIC",
status: 1,
sort: 1,
remark: "",
};
return {
code: "00000",
data: form,
msg: "一切ok",
};
},
},
{
url: "tenant-plans",
method: ["POST"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId",
method: ["PUT"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
{
url: "tenant-plans/:ids",
method: ["DELETE"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId/menuIds",
method: ["GET"],
body: {
code: "00000",
data: [1, 2, 3, 4, 5, 6],
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId/menus",
method: ["PUT"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
]);