2021-07-21 15:43:25 +08:00
|
|
|
import { getAllRoleList, isAccountExist } from '/@/api/demo/system';
|
2023-04-05 22:47:14 +08:00
|
|
|
import { BasicColumn, FormSchema } from '/@/components/Table';
|
2021-03-01 00:56:25 +08:00
|
|
|
|
|
|
|
|
export const columns: BasicColumn[] = [
|
|
|
|
|
{
|
|
|
|
|
title: '用户名',
|
|
|
|
|
dataIndex: 'account',
|
|
|
|
|
width: 120,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '昵称',
|
|
|
|
|
dataIndex: 'nickname',
|
|
|
|
|
width: 120,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '邮箱',
|
|
|
|
|
dataIndex: 'email',
|
2021-03-10 23:39:42 +08:00
|
|
|
width: 120,
|
2021-03-01 00:56:25 +08:00
|
|
|
},
|
|
|
|
|
{
|
2021-03-01 22:54:21 +08:00
|
|
|
title: '创建时间',
|
|
|
|
|
dataIndex: 'createTime',
|
2021-03-01 00:56:25 +08:00
|
|
|
width: 180,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '角色',
|
|
|
|
|
dataIndex: 'role',
|
|
|
|
|
width: 200,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '备注',
|
|
|
|
|
dataIndex: 'remark',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const searchFormSchema: FormSchema[] = [
|
|
|
|
|
{
|
|
|
|
|
field: 'account',
|
|
|
|
|
label: '用户名',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
colProps: { span: 8 },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'nickname',
|
|
|
|
|
label: '昵称',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
colProps: { span: 8 },
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const accountFormSchema: FormSchema[] = [
|
|
|
|
|
{
|
|
|
|
|
field: 'account',
|
|
|
|
|
label: '用户名',
|
|
|
|
|
component: 'Input',
|
2021-07-21 15:43:25 +08:00
|
|
|
helpMessage: ['本字段演示异步验证', '不能输入带有admin的用户名'],
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入用户名',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
validator(_, value) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
isAccountExist(value)
|
|
|
|
|
.then(() => resolve())
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
reject(err.message || '验证失败');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2021-03-01 00:56:25 +08:00
|
|
|
},
|
2021-03-04 01:25:50 +08:00
|
|
|
{
|
|
|
|
|
field: 'pwd',
|
|
|
|
|
label: '密码',
|
|
|
|
|
component: 'InputPassword',
|
|
|
|
|
required: true,
|
2021-06-08 01:13:22 +08:00
|
|
|
ifShow: false,
|
2021-03-04 01:25:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '角色',
|
|
|
|
|
field: 'role',
|
|
|
|
|
component: 'ApiSelect',
|
|
|
|
|
componentProps: {
|
|
|
|
|
api: getAllRoleList,
|
|
|
|
|
labelField: 'roleName',
|
|
|
|
|
valueField: 'roleValue',
|
|
|
|
|
},
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'dept',
|
|
|
|
|
label: '所属部门',
|
|
|
|
|
component: 'TreeSelect',
|
|
|
|
|
componentProps: {
|
2021-12-01 22:20:58 +08:00
|
|
|
fieldNames: {
|
|
|
|
|
label: 'deptName',
|
2021-03-04 01:25:50 +08:00
|
|
|
key: 'id',
|
|
|
|
|
value: 'id',
|
|
|
|
|
},
|
|
|
|
|
getPopupContainer: () => document.body,
|
|
|
|
|
},
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
2021-03-01 00:56:25 +08:00
|
|
|
{
|
|
|
|
|
field: 'nickname',
|
|
|
|
|
label: '昵称',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
2021-03-04 01:25:50 +08:00
|
|
|
|
2021-03-01 00:56:25 +08:00
|
|
|
{
|
|
|
|
|
label: '邮箱',
|
|
|
|
|
field: 'email',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
2021-03-04 01:25:50 +08:00
|
|
|
|
2021-03-01 00:56:25 +08:00
|
|
|
{
|
|
|
|
|
label: '备注',
|
|
|
|
|
field: 'remark',
|
|
|
|
|
component: 'InputTextArea',
|
|
|
|
|
},
|
|
|
|
|
];
|