account.data.tsx
5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
63
64
65
66
67
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import { getRoleList, getDeptList, getCompanyList } from '/@/api/project/account';
import { Tag } from 'ant-design-vue';
import { BasicColumn, FormSchema } from '/@/components/Table';
// 重新包装getRoleList API,强制过滤生产科角色
const getFilteredRoleList = async (params?: any) => {
const roles = await getRoleList(params);
console.log('==== 原始角色列表 ====', roles);
// 确保返回的是数组,并过滤掉ID为6的生产科角色
if (Array.isArray(roles)) {
const filtered = roles.filter(item => item.id !== 6);
console.log('==== 过滤后角色列表 ====', filtered);
return filtered;
}
return roles;
};
export const columns: BasicColumn[] = [
{
title: '姓名',
dataIndex: 'chineseName',
width: 120,
},
{
title: '昵称',
dataIndex: 'nickName',
width: 120,
},
{
title: '性别',
dataIndex: 'gender',
width: 80,
},
{
title: '手机号',
dataIndex: 'phone',
width: 150,
},
{
title: '邮箱',
dataIndex: 'email',
width: 300,
},
// {
// title: '创建时间',
// dataIndex: 'createTime',
// width: 180,
// },
{
title: '公司',
dataIndex: 'companyName',
width: 150,
},
{
title: '部门',
dataIndex: 'deptName',
width: 150,
},
{
title: '角色岗位',
dataIndex: 'roleName',
width: 150,
},
{
title: '状态',
dataIndex: 'status',
width: 200,
customRender: (column) => {
const { record } = column || {};
return record.status === 10 ? <Tag color="green">正常</Tag> : <Tag color="red">离职</Tag>;
},
},
{
title: '备注',
dataIndex: 'remark',
width: 400,
},
];
export const searchFormSchema: FormSchema[] = [
{
field: 'chineseName',
label: '姓名',
component: 'Input',
colProps: { span: 3},
},
{
field: 'nickName',
label: '昵称(英文名)',
component: 'Input',
colProps: { span: 4 },
},
{
field:'companyId',
label:'公司',
component:'ApiSelect',
componentProps: {
api: getCompanyList,
labelField: 'name',
valueField: 'id',
immediate: true,
showSearch: true,
optionFilterProp: 'label',
filterOption: (input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
},
colProps: { span: 5 },
},
{
field: 'roleId',
label: '角色岗位',
component: 'ApiSelect',
componentProps: {
api: getFilteredRoleList,
labelField: 'description',
valueField: 'id',
},
colProps: { span: 4 },
},
{
field: 'deptId',
label: '部门',
component: 'ApiSelect',
componentProps: {
api: getDeptList,
labelField: 'name',
valueField: 'id',
},
colProps: { span: 4 },
},
{
field: 'phone',
label: '手机号',
component: 'Input',
colProps: { span: 4 },
},
{
field: 'optType',
label: '状态',
component: 'Select',
componentProps: {
options: [
{ label: '正常', value: 10 },
{ label: '离职', value: 20 },
],
},
colProps: { span: 4 },
},
];
// 员工账号的完整表单
export const accountFormSchema: FormSchema[] = [
{
field: 'chineseName',
label: '姓名',
component: 'Input',
required: true,
},
{
field: 'nickName',
label: '昵称(英文名)',
component: 'Input',
required: true,
componentProps: {
disabled: true, // 设置为不可修改
},
},
{
field: 'gender',
label: '性别',
component: 'Select',
componentProps: {
options: [
{ label: '男', value: '男' },
{ label: '女', value: '女' },
],
},
required: true,
},
{
field: 'phone',
label: '手机号',
component: 'Input',
// helpMessage: ['本字段演示异步验证', '不能输入带有admin的用户名'],
rules: [
{
required: true,
message: '请输入用户名',
},
],
},
{
field:'companyId',
label:'公司',
component:'ApiSelect',
componentProps: {
api: getCompanyList,
labelField: 'name',
valueField: 'id',
immediate: true,
showSearch: true,
optionFilterProp: 'label',
filterOption: (input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
},
required: true,
},
{
label: '角色岗位',
field: 'roleId',
component: 'ApiSelect',
componentProps: {
api: getFilteredRoleList,
labelField: 'description',
valueField: 'id',
},
required: true,
},
{
label: '角色部门',
field: 'deptId',
component: 'ApiSelect',
componentProps: {
api: getDeptList,
labelField: 'name',
valueField: 'id',
},
required: true,
},
{
label: '邮箱',
field: 'email',
component: 'InputTextArea',
required: true,
},
{
label: '备注',
field: 'remark',
component: 'InputTextArea',
},
];
// 生产科账号的简化表单(只包含姓名、手机号、邮箱、备注)
export const productionAccountFormSchema: FormSchema[] = [
{
field: 'chineseName',
label: '姓名',
component: 'Input',
required: true,
},
{
field: 'phone',
label: '手机号',
component: 'Input',
required: true,
rules: [
{
required: true,
message: '请输入手机号',
},
],
},
{
label: '邮箱',
field: 'email',
component: 'InputTextArea',
required: true,
},
{
label: '备注',
field: 'remark',
component: 'InputTextArea',
},
];