123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- 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: 120,
- },
- {
- title: '用户姓名',
- dataIndex: 'realname',
- width: 100,
- },
- {
- title: '头像',
- dataIndex: 'avatar',
- width: 120,
- customRender:render.renderAvatar,
- },
- {
- title: '性别',
- dataIndex: 'sex',
- width: 80,
- sorter: true,
- customRender: ({text}) => {
- return render.renderDict(text, 'sex')
- }
- },
- {
- title: '生日',
- dataIndex: 'birthday',
- width: 100,
- },
- {
- title: '手机号',
- dataIndex: 'phone',
- width: 100,
- },
- {
- title: '部门',
- width: 150,
- dataIndex: 'orgCodeTxt'
- },
- {
- title: '负责部门',
- width: 150,
- dataIndex: 'departIds_dictText'
- },
- {
- 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: 'sex',
- component: 'JDictSelectTag',
- componentProps: {
- dictCode:'sex',
- placeholder:'请选择性别',
- stringToNumber:true
- },
- colProps: {span: 6},
- },
- {
- label: '真实名称',
- field: 'realname',
- component: 'Input',
- 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: 'workNo',
- required: true,
- component: 'Input',
- dynamicRules: ({model,schema}) =>rules.duplicateCheckRule( "sys_user", "work_no",model,schema,true),
- },
- {
- label: '职务',
- field: 'post',
- required: false,
- component: 'JSelectPosition',
- componentProps: {
- rowKey:'code',
- labelKey:'name'
- },
- },
- {
- label: '角色',
- field: 'selectedroles',
- component: 'ApiSelect',
- componentProps: {
- mode: "multiple",
- api: getAllRolesList,
- labelField: 'roleName',
- valueField: 'id',
- },
- },
- {
- label: '所属部门',
- field: 'selecteddeparts',
- component: 'JSelectDept',
- componentProps:({formActionType,formModel}) => {
- return {
- sync:false,
- checkStrictly:true,
- defaultExpandLevel: 2,
- onSelect: (options,values) => {
- const {updateSchema} = formActionType;
- //所属部门修改后更新负责部门下拉框数据
- updateSchema([{
- field: 'departIds',
- componentProps: {options},
- }]);
- //所属部门修改后更新负责部门数据
- formModel.departIds&&(formModel.departIds = formModel.departIds.filter(item=>values.value.indexOf(item)>-1));
- }
- }
- }
- },
- {
- label: '租户',
- field: 'relTenantIds',
- component: 'ApiSelect',
- componentProps: {
- mode: "multiple",
- api: getAllTenantList,
- numberToString:true,
- labelField: 'name',
- valueField: 'id',
- }
- },
- {
- label: '身份',
- field: 'userIdentity',
- component: 'RadioGroup',
- defaultValue: 1,
- componentProps:({ formModel }) => {
- return {
- options: [{label: '普通用户',value: 1,key: '1'},{label: '上级',value: 2,key: '2'}],
- onChange: () => {
- formModel.userIdentity==1&&(formModel.departIds=[]);
- }
- }
- },
- },
- {
- label: '负责部门',
- field: 'departIds',
- component: 'Select',
- componentProps: {
- mode: "multiple",
- },
- ifShow: ({values}) => (values.userIdentity==2),
- },
- {
- label: '头像',
- field: 'avatar',
- component: 'JImageUpload',
- componentProps: {
- fileMax:1
- },
- },
- {
- label: '生日',
- field: 'birthday',
- component: 'DatePicker',
- },
- {
- label: '性别',
- field: 'sex',
- component: 'JDictSelectTag',
- componentProps: {
- dictCode:'sex',
- placeholder:'请选择性别',
- stringToNumber:true
- },
- },
- {
- label: '邮箱',
- field: 'email',
- component: 'Input',
- rules: rules.rule('email',false),
- },
- {
- label: '手机号码',
- field: 'phone',
- component: 'Input',
- dynamicRules: ({model,schema}) => {
- return [
- {...rules.duplicateCheckRule( "sys_user", "phone",model,schema,true)[0]},
- { pattern: /^1[3|4|5|7|8|9][0-9]\d{8}$/, message: '手机号码格式有误' }
- ];
- },
- },
- {
- label: '座机',
- field: 'telephone',
- component: 'Input',
- rules: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' }]
- },
- {
- label: '工作流引擎',
- field: 'activitiSync',
- defaultValue: 1,
- component: 'JDictSelectTag',
- componentProps: {
- dictCode:'activiti_sync',
- type:'radio',
- stringToNumber:true
- },
- }
- ];
- 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'
- },
- }]
|