2022-06-10 10:44:44 +08:00
|
|
|
import { BasicColumn } from '/@/components/Table';
|
|
|
|
import { FormSchema } from '/@/components/Table';
|
|
|
|
import { getAllRolesList, getAllTenantList } from './user.api';
|
|
|
|
import { rules } from '/@/utils/helper/validator';
|
2022-03-10 09:47:29 +08:00
|
|
|
import { render } from '/@/utils/common/renderUtils';
|
2021-10-20 14:32:09 +08:00
|
|
|
export const columns: BasicColumn[] = [
|
|
|
|
{
|
|
|
|
title: '用户账号',
|
|
|
|
dataIndex: 'username',
|
2022-03-10 09:47:29 +08:00
|
|
|
width: 120,
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '用户姓名',
|
|
|
|
dataIndex: 'realname',
|
2022-03-10 09:47:29 +08:00
|
|
|
width: 100,
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '头像',
|
|
|
|
dataIndex: 'avatar',
|
2022-03-10 09:47:29 +08:00
|
|
|
width: 120,
|
2022-06-10 10:44:44 +08:00
|
|
|
customRender: render.renderAvatar,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '性别',
|
|
|
|
dataIndex: 'sex',
|
|
|
|
width: 80,
|
|
|
|
sorter: true,
|
2022-06-10 10:44:44 +08:00
|
|
|
customRender: ({ text }) => {
|
|
|
|
return render.renderDict(text, 'sex');
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '生日',
|
|
|
|
dataIndex: 'birthday',
|
|
|
|
width: 100,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '手机号',
|
|
|
|
dataIndex: 'phone',
|
|
|
|
width: 100,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '部门',
|
|
|
|
width: 150,
|
2022-06-10 10:44:44 +08:00
|
|
|
dataIndex: 'orgCodeTxt',
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '负责部门',
|
|
|
|
width: 150,
|
2022-06-10 10:44:44 +08:00
|
|
|
dataIndex: 'departIds_dictText',
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '状态',
|
|
|
|
dataIndex: 'status_dictText',
|
|
|
|
width: 80,
|
2022-06-10 10:44:44 +08:00
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
export const recycleColumns: BasicColumn[] = [
|
|
|
|
{
|
|
|
|
title: '用户账号',
|
|
|
|
dataIndex: 'username',
|
|
|
|
width: 100,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '用户姓名',
|
|
|
|
dataIndex: 'realname',
|
|
|
|
width: 100,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '头像',
|
|
|
|
dataIndex: 'avatar',
|
|
|
|
width: 80,
|
2022-06-10 10:44:44 +08:00
|
|
|
customRender: render.renderAvatar,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '性别',
|
|
|
|
dataIndex: 'sex',
|
|
|
|
width: 80,
|
|
|
|
sorter: true,
|
2022-06-10 10:44:44 +08:00
|
|
|
customRender: ({ text }) => {
|
|
|
|
return render.renderDict(text, 'sex');
|
|
|
|
},
|
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
export const searchFormSchema: FormSchema[] = [
|
|
|
|
{
|
2022-03-10 09:47:29 +08:00
|
|
|
label: '账号',
|
2021-10-20 14:32:09 +08:00
|
|
|
field: 'username',
|
2022-03-10 09:47:29 +08:00
|
|
|
component: 'JInput',
|
2022-06-10 10:44:44 +08:00
|
|
|
colProps: { span: 6 },
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2022-11-07 17:33:46 +08:00
|
|
|
{
|
|
|
|
label: '名字',
|
|
|
|
field: 'realname',
|
|
|
|
component: 'JInput',
|
|
|
|
colProps: { span: 6 },
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
{
|
|
|
|
label: '性别',
|
|
|
|
field: 'sex',
|
|
|
|
component: 'JDictSelectTag',
|
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
dictCode: 'sex',
|
|
|
|
placeholder: '请选择性别',
|
|
|
|
stringToNumber: true,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2022-06-10 10:44:44 +08:00
|
|
|
colProps: { span: 6 },
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '手机号码',
|
|
|
|
field: 'phone',
|
2021-10-20 14:32:09 +08:00
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
colProps: { span: 6 },
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户状态',
|
|
|
|
field: 'status',
|
|
|
|
component: 'JDictSelectTag',
|
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
dictCode: 'user_status',
|
|
|
|
placeholder: '请选择状态',
|
|
|
|
stringToNumber: true,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2022-06-10 10:44:44 +08:00
|
|
|
colProps: { span: 6 },
|
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
export const formSchema: FormSchema[] = [
|
|
|
|
{
|
|
|
|
label: '',
|
|
|
|
field: 'id',
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
show: false,
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户账号',
|
|
|
|
field: 'username',
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
dynamicDisabled: ({ values }) => {
|
2021-10-20 14:32:09 +08:00
|
|
|
return !!values.id;
|
|
|
|
},
|
2022-06-10 10:44:44 +08:00
|
|
|
dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'username', model, schema, true),
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '登录密码',
|
|
|
|
field: 'password',
|
|
|
|
component: 'StrengthMeter',
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: '请输入登录密码',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '确认密码',
|
|
|
|
field: 'confirmPassword',
|
|
|
|
component: 'InputPassword',
|
2022-06-10 10:44:44 +08:00
|
|
|
dynamicRules: ({ values }) => rules.confirmPassword(values, true),
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户姓名',
|
|
|
|
field: 'realname',
|
|
|
|
required: true,
|
|
|
|
component: 'Input',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '工号',
|
|
|
|
field: 'workNo',
|
|
|
|
required: true,
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'work_no', model, schema, true),
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '职务',
|
|
|
|
field: 'post',
|
2022-04-27 19:19:39 +08:00
|
|
|
required: false,
|
2022-03-10 09:47:29 +08:00
|
|
|
component: 'JSelectPosition',
|
2021-10-20 14:32:09 +08:00
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
rowKey: 'code',
|
|
|
|
labelKey: 'name',
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '角色',
|
|
|
|
field: 'selectedroles',
|
|
|
|
component: 'ApiSelect',
|
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
mode: 'multiple',
|
2021-10-20 14:32:09 +08:00
|
|
|
api: getAllRolesList,
|
|
|
|
labelField: 'roleName',
|
|
|
|
valueField: 'id',
|
|
|
|
},
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
{
|
|
|
|
label: '所属部门',
|
|
|
|
field: 'selecteddeparts',
|
|
|
|
component: 'JSelectDept',
|
2022-06-10 10:44:44 +08:00
|
|
|
componentProps: ({ formActionType, formModel }) => {
|
|
|
|
return {
|
|
|
|
sync: false,
|
|
|
|
checkStrictly: true,
|
|
|
|
defaultExpandLevel: 2,
|
2022-03-10 09:47:29 +08:00
|
|
|
|
2022-06-10 10:44:44 +08:00
|
|
|
onSelect: (options, values) => {
|
|
|
|
const { updateSchema } = formActionType;
|
|
|
|
//所属部门修改后更新负责部门下拉框数据
|
|
|
|
updateSchema([
|
|
|
|
{
|
|
|
|
field: 'departIds',
|
|
|
|
componentProps: { options },
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
//所属部门修改后更新负责部门数据
|
|
|
|
formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
2021-10-20 14:32:09 +08:00
|
|
|
label: '租户',
|
|
|
|
field: 'relTenantIds',
|
|
|
|
component: 'ApiSelect',
|
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
mode: 'multiple',
|
2021-10-20 14:32:09 +08:00
|
|
|
api: getAllTenantList,
|
2022-06-10 10:44:44 +08:00
|
|
|
numberToString: true,
|
2021-10-20 14:32:09 +08:00
|
|
|
labelField: 'name',
|
|
|
|
valueField: 'id',
|
2022-06-10 10:44:44 +08:00
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '身份',
|
|
|
|
field: 'userIdentity',
|
|
|
|
component: 'RadioGroup',
|
|
|
|
defaultValue: 1,
|
2022-06-10 10:44:44 +08:00
|
|
|
componentProps: ({ formModel }) => {
|
2022-03-10 09:47:29 +08:00
|
|
|
return {
|
2022-06-10 10:44:44 +08:00
|
|
|
options: [
|
|
|
|
{ label: '普通用户', value: 1, key: '1' },
|
|
|
|
{ label: '上级', value: 2, key: '2' },
|
|
|
|
],
|
|
|
|
onChange: () => {
|
|
|
|
formModel.userIdentity == 1 && (formModel.departIds = []);
|
|
|
|
},
|
|
|
|
};
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '负责部门',
|
|
|
|
field: 'departIds',
|
|
|
|
component: 'Select',
|
2021-10-20 14:32:09 +08:00
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
mode: 'multiple',
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
2022-06-10 10:44:44 +08:00
|
|
|
ifShow: ({ values }) => values.userIdentity == 2,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
{
|
|
|
|
label: '头像',
|
|
|
|
field: 'avatar',
|
2022-03-10 09:47:29 +08:00
|
|
|
component: 'JImageUpload',
|
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
fileMax: 1,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '生日',
|
|
|
|
field: 'birthday',
|
|
|
|
component: 'DatePicker',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '性别',
|
|
|
|
field: 'sex',
|
2022-03-10 09:47:29 +08:00
|
|
|
component: 'JDictSelectTag',
|
2021-10-20 14:32:09 +08:00
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
dictCode: 'sex',
|
|
|
|
placeholder: '请选择性别',
|
|
|
|
stringToNumber: true,
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '邮箱',
|
|
|
|
field: 'email',
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
rules: rules.rule('email', false),
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '手机号码',
|
|
|
|
field: 'phone',
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
dynamicRules: ({ model, schema }) => {
|
2022-09-22 14:06:18 +08:00
|
|
|
return [
|
|
|
|
{ ...rules.duplicateCheckRule('sys_user', 'phone', model, schema, true)[0] },
|
|
|
|
{ pattern: /^1[3|4|5|7|8|9][0-9]\d{8}$/, message: '手机号码格式有误' },
|
|
|
|
];
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
{
|
|
|
|
label: '座机',
|
|
|
|
field: 'telephone',
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
rules: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' }],
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
{
|
|
|
|
label: '工作流引擎',
|
|
|
|
field: 'activitiSync',
|
2022-03-10 09:47:29 +08:00
|
|
|
defaultValue: 1,
|
|
|
|
component: 'JDictSelectTag',
|
2021-10-20 14:32:09 +08:00
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
dictCode: 'activiti_sync',
|
|
|
|
type: 'radio',
|
|
|
|
stringToNumber: true,
|
2021-10-20 14:32:09 +08:00
|
|
|
},
|
2022-06-10 10:44:44 +08:00
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
];
|
2022-03-10 09:47:29 +08:00
|
|
|
|
|
|
|
export const formPasswordSchema: FormSchema[] = [
|
|
|
|
{
|
|
|
|
label: '用户账号',
|
|
|
|
field: 'username',
|
|
|
|
component: 'Input',
|
2022-06-10 10:44:44 +08:00
|
|
|
componentProps: { readOnly: true },
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '登录密码',
|
|
|
|
field: 'password',
|
|
|
|
component: 'StrengthMeter',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入登录密码',
|
|
|
|
},
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: '请输入登录密码',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '确认密码',
|
|
|
|
field: 'confirmPassword',
|
|
|
|
component: 'InputPassword',
|
2022-06-10 10:44:44 +08:00
|
|
|
dynamicRules: ({ values }) => rules.confirmPassword(values, true),
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
];
|
|
|
|
|
2022-06-10 10:44:44 +08:00
|
|
|
export const formAgentSchema: FormSchema[] = [
|
|
|
|
{
|
|
|
|
label: '',
|
|
|
|
field: 'id',
|
|
|
|
component: 'Input',
|
|
|
|
show: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'userName',
|
|
|
|
label: '用户名',
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
readOnly: true,
|
|
|
|
allowClear: false,
|
|
|
|
},
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
{
|
|
|
|
field: 'agentUserName',
|
|
|
|
label: '代理人用户名',
|
|
|
|
required: true,
|
|
|
|
component: 'JSelectUser',
|
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
rowKey: 'username',
|
|
|
|
labelKey: 'realname',
|
|
|
|
maxSelectCount: 10,
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'startTime',
|
|
|
|
label: '代理开始时间',
|
|
|
|
component: 'DatePicker',
|
|
|
|
required: true,
|
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
placeholder: '请选择代理开始时间',
|
2022-06-10 10:44:44 +08:00
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'endTime',
|
|
|
|
label: '代理结束时间',
|
|
|
|
component: 'DatePicker',
|
|
|
|
required: true,
|
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
placeholder: '请选择代理结束时间',
|
2022-06-10 10:44:44 +08:00
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'status',
|
|
|
|
label: '状态',
|
|
|
|
component: 'JDictSelectTag',
|
2022-06-10 10:44:44 +08:00
|
|
|
defaultValue: '1',
|
2022-03-10 09:47:29 +08:00
|
|
|
componentProps: {
|
2022-06-10 10:44:44 +08:00
|
|
|
dictCode: 'valid_status',
|
|
|
|
type: 'radioButton',
|
2022-03-10 09:47:29 +08:00
|
|
|
},
|
2022-06-10 10:44:44 +08:00
|
|
|
},
|
|
|
|
];
|