提交 | 用户 | 时间
|
820397
|
1 |
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
H |
2 |
import { dateFormatter } from '@/utils/formatTime' |
|
3 |
const { t } = useI18n() // 国际化 |
|
4 |
|
|
5 |
// 表单校验 |
|
6 |
export const rules = reactive({ |
|
7 |
mail: [ |
|
8 |
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' }, |
|
9 |
{ |
|
10 |
type: 'email', |
|
11 |
message: t('profile.rules.truemail'), |
|
12 |
trigger: ['blur', 'change'] |
|
13 |
} |
|
14 |
], |
|
15 |
username: [required], |
|
16 |
password: [required], |
|
17 |
host: [required], |
|
18 |
port: [required], |
|
19 |
sslEnable: [required], |
|
20 |
starttlsEnable: [required] |
|
21 |
}) |
|
22 |
|
|
23 |
// CrudSchema:https://xxxx/vue3/crud-schema/ |
|
24 |
const crudSchemas = reactive<CrudSchema[]>([ |
|
25 |
{ |
|
26 |
label: '邮箱', |
|
27 |
field: 'mail', |
|
28 |
isSearch: true |
|
29 |
}, |
|
30 |
{ |
|
31 |
label: '用户名', |
|
32 |
field: 'username', |
|
33 |
isSearch: true |
|
34 |
}, |
|
35 |
{ |
|
36 |
label: '密码', |
|
37 |
field: 'password', |
|
38 |
isTable: false |
|
39 |
}, |
|
40 |
{ |
|
41 |
label: 'SMTP 服务器域名', |
|
42 |
field: 'host' |
|
43 |
}, |
|
44 |
{ |
|
45 |
label: 'SMTP 服务器端口', |
|
46 |
field: 'port', |
|
47 |
form: { |
|
48 |
component: 'InputNumber', |
|
49 |
value: 465 |
|
50 |
} |
|
51 |
}, |
|
52 |
{ |
|
53 |
label: '是否开启 SSL', |
|
54 |
field: 'sslEnable', |
|
55 |
dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, |
|
56 |
dictClass: 'boolean', |
|
57 |
form: { |
|
58 |
component: 'Radio' |
|
59 |
} |
|
60 |
}, |
|
61 |
{ |
|
62 |
label: '是否开启 STARTTLS', |
|
63 |
field: 'starttlsEnable', |
|
64 |
dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, |
|
65 |
dictClass: 'boolean', |
|
66 |
form: { |
|
67 |
component: 'Radio' |
|
68 |
} |
|
69 |
}, |
|
70 |
{ |
|
71 |
label: '创建时间', |
|
72 |
field: 'createTime', |
|
73 |
isForm: false, |
|
74 |
formatter: dateFormatter, |
|
75 |
detail: { |
|
76 |
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|
77 |
} |
|
78 |
}, |
|
79 |
{ |
|
80 |
label: '操作', |
|
81 |
field: 'action', |
|
82 |
isForm: false, |
|
83 |
isDetail: false |
|
84 |
} |
|
85 |
]) |
|
86 |
export const { allSchemas } = useCrudSchemas(crudSchemas) |