user.data.ts
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { reactive } from 'vue'
import { required } from '@/utils/formRules'
import { useI18n } from '@/hooks/web/useI18n'
import { DICT_TYPE } from '@/utils/dict'
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
// 国际化
const { t } = useI18n()
// 表单校验
export const rules = reactive({
username: [required],
nickname: [required],
email: [required],
status: [required],
mobile: [
{
len: 11,
trigger: 'blur',
message: '请输入正确的手机号码'
}
]
})
// crudSchemas
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryTitle: '用户编号',
action: true,
actionWidth: '200px',
columns: [
{
title: '用户账号',
field: 'username',
isSearch: true
},
{
title: '用户密码',
field: 'password',
isDetail: false,
isTable: false,
form: {
component: 'InputPassword'
}
},
{
title: '用户昵称',
field: 'nickname'
},
{
title: '用户邮箱',
field: 'email'
},
{
title: '手机号码',
field: 'mobile',
isSearch: true
},
{
title: '部门',
field: 'deptId',
isTable: false
},
{
title: '岗位',
field: 'postIds',
isTable: false
},
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
dictClass: 'number',
isSearch: true,
table: {
slots: {
default: 'status_default'
}
}
},
{
title: '最后登录时间',
field: 'loginDate',
formatter: 'formatDate',
isForm: false
},
{
title: '最后登录IP',
field: 'loginIp',
isTable: false,
isForm: false
},
{
title: t('form.remark'),
field: 'remark',
isTable: false
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isTable: false,
isForm: false,
search: {
show: true,
itemRender: {
name: 'XDataTimePicker'
}
}
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)