import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { getAllRolesList, getAllTenantList } from './user.api'; import { rules } from '/@/utils/helper/validator'; import { render } from '/@/utils/common/renderUtils'; export const columns: BasicColumn[] = [ { title: '用户账号', dataIndex: 'username', width: 80, }, { title: '用户姓名', dataIndex: 'realname', width: 80, }, { title: '令牌', dataIndex: 'thirdId', width: 150, }, { title: '有效期', dataIndex: 'birthday', width: 80, }, { title: '状态', dataIndex: 'status_dictText', width: 80, }, ]; export const recycleColumns: BasicColumn[] = [ { title: '用户账号', dataIndex: 'username', width: 100, }, { title: '用户姓名', dataIndex: 'realname', width: 100, }, { title: '头像', dataIndex: 'avatar', width: 80, customRender: render.renderAvatar, }, { title: '性别', dataIndex: 'sex', width: 80, sorter: true, customRender: ({ text }) => { return render.renderDict(text, 'sex'); }, }, ]; export const searchFormSchema: FormSchema[] = [ { label: '账号', field: 'username', component: 'JInput', colProps: { span: 6 }, }, { label: '名字', field: 'realname', component: 'JInput', colProps: { span: 6 }, }, // { // label: '性别', // field: 'sex', // component: 'JDictSelectTag', // componentProps: { // dictCode: 'sex', // placeholder: '请选择性别', // stringToNumber: true, // }, // colProps: { span: 6 }, // }, // { // label: '手机号码', // field: 'phone', // component: 'Input', // colProps: { span: 6 }, // }, // { // label: '用户状态', // field: 'status', // component: 'JDictSelectTag', // componentProps: { // dictCode: 'user_status', // placeholder: '请选择状态', // stringToNumber: true, // }, // colProps: { span: 6 }, // }, ]; export const formSchema: FormSchema[] = [ { label: '', field: 'id', component: 'Input', show: false, }, { label: '用户账号', field: 'username', component: 'Input', dynamicDisabled: ({ values }) => { return !!values.id; }, dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'username', model, schema, true), }, { label: '登录密码', field: 'password', component: 'StrengthMeter', rules: [ { required: true, message: '请输入登录密码', }, ], }, { label: '确认密码', field: 'confirmPassword', component: 'InputPassword', dynamicRules: ({ values }) => rules.confirmPassword(values, true), }, { label: '用户姓名', field: 'realname', required: true, component: 'Input', }, { label: '有效期', field: 'birthday', component: 'DatePicker', }, { label: '第三方用户', field: 'thirdType', component: 'Input', defaultValue: '_thirdPartyUser', }, ]; export const formPasswordSchema: FormSchema[] = [ { label: '用户账号', field: 'username', component: 'Input', componentProps: { readOnly: true }, }, { label: '登录密码', field: 'password', component: 'StrengthMeter', componentProps: { placeholder: '请输入登录密码', }, rules: [ { required: true, message: '请输入登录密码', }, ], }, { label: '确认密码', field: 'confirmPassword', component: 'InputPassword', dynamicRules: ({ values }) => rules.confirmPassword(values, true), }, ]; export const formAgentSchema: FormSchema[] = [ { label: '', field: 'id', component: 'Input', show: false, }, { field: 'userName', label: '用户名', component: 'Input', componentProps: { readOnly: true, allowClear: false, }, }, { field: 'agentUserName', label: '代理人用户名', required: true, component: 'JSelectUser', componentProps: { rowKey: 'username', labelKey: 'realname', maxSelectCount: 10, }, }, { field: 'startTime', label: '代理开始时间', component: 'DatePicker', required: true, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss', placeholder: '请选择代理开始时间', }, }, { field: 'endTime', label: '代理结束时间', component: 'DatePicker', required: true, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss', placeholder: '请选择代理结束时间', }, }, { field: 'status', label: '状态', component: 'JDictSelectTag', defaultValue: '1', componentProps: { dictCode: 'valid_status', type: 'radioButton', }, }, ];