提交 | 用户 | 时间
|
820397
|
1 |
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
H |
2 |
import { dateFormatter } from '@/utils/formatTime' |
|
3 |
import { TableColumn } from '@/types/table' |
|
4 |
import * as MailAccountApi from '@/api/system/mail/account' |
|
5 |
|
|
6 |
// 邮箱账号的列表 |
|
7 |
const accountList = await MailAccountApi.getSimpleMailAccountList() |
|
8 |
|
|
9 |
// 表单校验 |
|
10 |
export const rules = reactive({ |
|
11 |
name: [required], |
|
12 |
code: [required], |
|
13 |
accountId: [required], |
|
14 |
label: [required], |
|
15 |
content: [required], |
|
16 |
params: [required], |
|
17 |
status: [required] |
|
18 |
}) |
|
19 |
|
|
20 |
const crudSchemas = reactive<CrudSchema[]>([ |
|
21 |
{ |
|
22 |
label: '模板编码', |
|
23 |
field: 'code', |
|
24 |
isSearch: true |
|
25 |
}, |
|
26 |
{ |
|
27 |
label: '模板名称', |
|
28 |
field: 'name', |
|
29 |
isSearch: true |
|
30 |
}, |
|
31 |
{ |
|
32 |
label: '模板标题', |
|
33 |
field: 'title' |
|
34 |
}, |
|
35 |
{ |
|
36 |
label: '模板内容', |
|
37 |
field: 'content', |
|
38 |
form: { |
|
39 |
component: 'Editor', |
|
40 |
componentProps: { |
|
41 |
valueHtml: '', |
|
42 |
height: 200 |
|
43 |
} |
|
44 |
} |
|
45 |
}, |
|
46 |
{ |
|
47 |
label: '邮箱账号', |
|
48 |
field: 'accountId', |
|
49 |
width: '200px', |
|
50 |
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
|
51 |
return accountList.find((account) => account.id === cellValue)?.mail |
|
52 |
}, |
|
53 |
search: { |
|
54 |
show: true, |
|
55 |
component: 'Select', |
|
56 |
api: () => accountList, |
|
57 |
componentProps: { |
|
58 |
optionsAlias: { |
|
59 |
labelField: 'mail', |
|
60 |
valueField: 'id' |
|
61 |
} |
|
62 |
} |
|
63 |
}, |
|
64 |
form: { |
|
65 |
component: 'Select', |
|
66 |
api: () => accountList, |
|
67 |
componentProps: { |
|
68 |
optionsAlias: { |
|
69 |
labelField: 'mail', |
|
70 |
valueField: 'id' |
|
71 |
} |
|
72 |
} |
|
73 |
} |
|
74 |
}, |
|
75 |
{ |
|
76 |
label: '发送人名称', |
|
77 |
field: 'nickname' |
|
78 |
}, |
|
79 |
{ |
|
80 |
label: '开启状态', |
|
81 |
field: 'status', |
|
82 |
isSearch: true, |
|
83 |
dictType: DICT_TYPE.COMMON_STATUS, |
|
84 |
dictClass: 'number' |
|
85 |
}, |
|
86 |
{ |
|
87 |
label: '备注', |
|
88 |
field: 'remark', |
|
89 |
isTable: false |
|
90 |
}, |
|
91 |
{ |
|
92 |
label: '创建时间', |
|
93 |
field: 'createTime', |
|
94 |
isForm: false, |
|
95 |
formatter: dateFormatter, |
|
96 |
search: { |
|
97 |
show: true, |
|
98 |
component: 'DatePicker', |
|
99 |
componentProps: { |
|
100 |
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|
101 |
type: 'daterange', |
|
102 |
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|
103 |
} |
|
104 |
} |
|
105 |
}, |
|
106 |
{ |
|
107 |
label: '操作', |
|
108 |
field: 'action', |
|
109 |
isForm: false |
|
110 |
} |
|
111 |
]) |
|
112 |
export const { allSchemas } = useCrudSchemas(crudSchemas) |