Vben
authored
|
1
|
import { MockMethod } from 'vite-plugin-mock';
|
Vben
authored
|
2
|
import { resultPageSuccess, resultSuccess } from '../_util';
|
Vben
authored
|
3
|
|
Vben
authored
|
4
|
const accountList = (() => {
|
Vben
authored
|
5
6
7
8
9
10
11
12
|
const result: any[] = [];
for (let index = 0; index < 20; index++) {
result.push({
id: `${index}`,
account: '@first',
email: '@email',
nickname: '@cname()',
role: '@first',
|
Vben
authored
|
13
14
15
16
17
18
19
20
|
createTime: '@datetime',
remark: '@cword(10,20)',
'status|1': ['0', '1'],
});
}
return result;
})();
|
Vben
authored
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
const roleList = (() => {
const result: any[] = [];
for (let index = 0; index < 4; index++) {
result.push({
id: `${index}`,
orderNo: `${index + 1}`,
roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index],
roleValue: '@first',
createTime: '@datetime',
remark: '@cword(10,20)',
'status|1': ['0', '1'],
});
}
return result;
})();
|
Vben
authored
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
const deptList = (() => {
const result: any[] = [];
for (let index = 0; index < 3; index++) {
result.push({
id: `${index}`,
deptName: ['华东分部', '华南分部', '西北分部'][index],
orderNo: index + 1,
createTime: '@datetime',
remark: '@cword(10,20)',
'status|1': ['0', '0', '1'],
children: (() => {
const children: any[] = [];
for (let j = 0; j < 4; j++) {
children.push({
id: `${index}-${j}`,
deptName: ['研发部', '市场部', '商务部', '财务部'][j],
orderNo: j + 1,
createTime: '@datetime',
remark: '@cword(10,20)',
'status|1': ['0', '1'],
parentDept: `${index}`,
children: undefined,
});
}
return children;
})(),
|
Vben
authored
|
63
64
65
66
67
|
});
}
return result;
})();
|
Vben
authored
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
const menuList = (() => {
const result: any[] = [];
for (let index = 0; index < 3; index++) {
result.push({
id: `${index}`,
icon: ['ion:layers-outline', 'ion:git-compare-outline', 'ion:tv-outline'][index],
component: 'LAYOUT',
menuName: ['Dashboard', '权限管理', '功能'][index],
permission: '',
orderNo: index + 1,
createTime: '@datetime',
'status|1': ['0', '0', '1'],
children: (() => {
const children: any[] = [];
for (let j = 0; j < 4; j++) {
children.push({
id: `${index}-${j}`,
menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j],
icon: 'ion:document',
permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index],
component: [
'/dashboard/welcome/index',
'/dashboard/analysis/index',
'/dashboard/workbench/index',
'/dashboard/test/index',
][j],
orderNo: j + 1,
createTime: '@datetime',
'status|1': ['0', '1'],
parentMenu: `${index}`,
children: undefined,
});
}
return children;
})(),
});
}
return result;
})();
|
Vben
authored
|
108
109
|
export default [
{
|
Vben
authored
|
110
|
url: '/basic-api/system/getAccountList',
|
Vben
authored
|
111
112
113
114
|
timeout: 100,
method: 'get',
response: ({ query }) => {
const { page = 1, pageSize = 20 } = query;
|
Vben
authored
|
115
116
117
118
|
return resultPageSuccess(page, pageSize, accountList);
},
},
{
|
Vben
authored
|
119
|
url: '/basic-api/system/getRoleListByPage',
|
Vben
authored
|
120
121
122
123
124
125
126
127
|
timeout: 100,
method: 'get',
response: ({ query }) => {
const { page = 1, pageSize = 20 } = query;
return resultPageSuccess(page, pageSize, roleList);
},
},
{
|
Vben
authored
|
128
|
url: '/basic-api/system/getAllRoleList',
|
Vben
authored
|
129
130
131
132
133
134
135
|
timeout: 100,
method: 'get',
response: () => {
return resultSuccess(roleList);
},
},
{
|
Vben
authored
|
136
|
url: '/basic-api/system/getDeptList',
|
Vben
authored
|
137
138
139
140
|
timeout: 100,
method: 'get',
response: () => {
return resultSuccess(deptList);
|
Vben
authored
|
141
142
|
},
},
|
Vben
authored
|
143
|
{
|
Vben
authored
|
144
|
url: '/basic-api/system/getMenuList',
|
Vben
authored
|
145
146
147
148
149
150
|
timeout: 100,
method: 'get',
response: () => {
return resultSuccess(menuList);
},
},
|
Vben
authored
|
151
|
] as MockMethod[];
|