提交 | 用户 | age
|
8b4b76
|
1 |
import { getAllRoleList, isAccountExist } from '/@/api/demo/system'; |
8e5a6b
|
2 |
import { BasicColumn, FormSchema } from '/@/components/Table'; |
37669d
|
3 |
|
V |
4 |
export const columns: BasicColumn[] = [ |
|
5 |
{ |
|
6 |
title: '用户名', |
|
7 |
dataIndex: 'account', |
|
8 |
width: 120, |
|
9 |
}, |
|
10 |
{ |
|
11 |
title: '昵称', |
|
12 |
dataIndex: 'nickname', |
|
13 |
width: 120, |
|
14 |
}, |
|
15 |
{ |
|
16 |
title: '邮箱', |
|
17 |
dataIndex: 'email', |
a759e4
|
18 |
width: 120, |
37669d
|
19 |
}, |
V |
20 |
{ |
3b8ca4
|
21 |
title: '创建时间', |
V |
22 |
dataIndex: 'createTime', |
37669d
|
23 |
width: 180, |
V |
24 |
}, |
|
25 |
{ |
|
26 |
title: '角色', |
|
27 |
dataIndex: 'role', |
|
28 |
width: 200, |
|
29 |
}, |
|
30 |
{ |
|
31 |
title: '备注', |
|
32 |
dataIndex: 'remark', |
|
33 |
}, |
|
34 |
]; |
|
35 |
|
|
36 |
export const searchFormSchema: FormSchema[] = [ |
|
37 |
{ |
|
38 |
field: 'account', |
|
39 |
label: '用户名', |
|
40 |
component: 'Input', |
|
41 |
colProps: { span: 8 }, |
|
42 |
}, |
|
43 |
{ |
|
44 |
field: 'nickname', |
|
45 |
label: '昵称', |
|
46 |
component: 'Input', |
|
47 |
colProps: { span: 8 }, |
|
48 |
}, |
|
49 |
]; |
|
50 |
|
|
51 |
export const accountFormSchema: FormSchema[] = [ |
|
52 |
{ |
|
53 |
field: 'account', |
|
54 |
label: '用户名', |
|
55 |
component: 'Input', |
8b4b76
|
56 |
helpMessage: ['本字段演示异步验证', '不能输入带有admin的用户名'], |
无 |
57 |
rules: [ |
|
58 |
{ |
|
59 |
required: true, |
|
60 |
message: '请输入用户名', |
|
61 |
}, |
|
62 |
{ |
|
63 |
validator(_, value) { |
|
64 |
return new Promise((resolve, reject) => { |
|
65 |
isAccountExist(value) |
|
66 |
.then(() => resolve()) |
|
67 |
.catch((err) => { |
|
68 |
reject(err.message || '验证失败'); |
|
69 |
}); |
|
70 |
}); |
|
71 |
}, |
|
72 |
}, |
|
73 |
], |
37669d
|
74 |
}, |
V |
75 |
{ |
4628d9
|
76 |
field: 'pwd', |
V |
77 |
label: '密码', |
|
78 |
component: 'InputPassword', |
|
79 |
required: true, |
21f7a8
|
80 |
ifShow: false, |
4628d9
|
81 |
}, |
V |
82 |
{ |
|
83 |
label: '角色', |
|
84 |
field: 'role', |
|
85 |
component: 'ApiSelect', |
|
86 |
componentProps: { |
|
87 |
api: getAllRoleList, |
|
88 |
labelField: 'roleName', |
|
89 |
valueField: 'roleValue', |
|
90 |
}, |
|
91 |
required: true, |
|
92 |
}, |
|
93 |
{ |
|
94 |
field: 'dept', |
|
95 |
label: '所属部门', |
|
96 |
component: 'TreeSelect', |
|
97 |
componentProps: { |
170a4b
|
98 |
fieldNames: { |
V |
99 |
label: 'deptName', |
4628d9
|
100 |
key: 'id', |
V |
101 |
value: 'id', |
|
102 |
}, |
|
103 |
getPopupContainer: () => document.body, |
|
104 |
}, |
|
105 |
required: true, |
|
106 |
}, |
|
107 |
{ |
37669d
|
108 |
field: 'nickname', |
V |
109 |
label: '昵称', |
|
110 |
component: 'Input', |
|
111 |
required: true, |
|
112 |
}, |
4628d9
|
113 |
|
37669d
|
114 |
{ |
V |
115 |
label: '邮箱', |
|
116 |
field: 'email', |
|
117 |
component: 'Input', |
|
118 |
required: true, |
|
119 |
}, |
4628d9
|
120 |
|
37669d
|
121 |
{ |
V |
122 |
label: '备注', |
|
123 |
field: 'remark', |
|
124 |
component: 'InputTextArea', |
|
125 |
}, |
|
126 |
]; |