2023-03-18 00:42:25 +08:00
|
|
|
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import { TableColumn } from '@/types/table'
|
|
|
|
|
import * as MailAccountApi from '@/api/system/mail/account'
|
|
|
|
|
|
|
|
|
|
const accounts = await MailAccountApi.getSimpleMailAccountList()
|
2023-02-11 00:44:00 +08:00
|
|
|
|
|
|
|
|
|
// 表单校验
|
|
|
|
|
export const rules = reactive({
|
|
|
|
|
name: [required],
|
|
|
|
|
code: [required],
|
|
|
|
|
accountId: [required],
|
2023-03-18 00:42:25 +08:00
|
|
|
|
label: [required],
|
2023-02-11 00:44:00 +08:00
|
|
|
|
content: [required],
|
|
|
|
|
params: [required],
|
|
|
|
|
status: [required]
|
|
|
|
|
})
|
|
|
|
|
|
2023-03-18 00:42:25 +08:00
|
|
|
|
// CrudSchema:https://kailong110120130.gitee.io/vue-element-plus-admin-doc/hooks/useCrudSchemas.html
|
|
|
|
|
const crudSchemas = reactive<CrudSchema[]>([
|
|
|
|
|
{
|
|
|
|
|
label: '模板编码',
|
|
|
|
|
field: 'code',
|
|
|
|
|
isSearch: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '模板名称',
|
|
|
|
|
field: 'name',
|
|
|
|
|
isSearch: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '模板标题',
|
|
|
|
|
field: 'title'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '模板内容',
|
|
|
|
|
field: 'content',
|
|
|
|
|
form: {
|
|
|
|
|
component: 'Editor',
|
|
|
|
|
componentProps: {
|
2023-03-18 10:39:19 +08:00
|
|
|
|
valueHtml: '',
|
|
|
|
|
height: 200
|
2023-02-11 00:44:00 +08:00
|
|
|
|
}
|
2023-03-18 00:42:25 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '邮箱账号',
|
|
|
|
|
field: 'accountId',
|
|
|
|
|
width: '200px',
|
|
|
|
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
|
|
|
|
|
return accounts.find((account) => account.id === cellValue)?.mail
|
2023-02-11 00:44:00 +08:00
|
|
|
|
},
|
2023-03-18 00:42:25 +08:00
|
|
|
|
search: {
|
|
|
|
|
show: true,
|
|
|
|
|
component: 'Select',
|
2023-03-18 10:39:19 +08:00
|
|
|
|
api: () => accounts,
|
|
|
|
|
componentProps: {
|
|
|
|
|
optionsAlias: {
|
|
|
|
|
labelField: 'mail',
|
|
|
|
|
valueField: 'id'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
form: {
|
|
|
|
|
component: 'Select',
|
|
|
|
|
api: () => accounts,
|
2023-03-18 00:42:25 +08:00
|
|
|
|
componentProps: {
|
|
|
|
|
optionsAlias: {
|
|
|
|
|
labelField: 'mail',
|
|
|
|
|
valueField: 'id'
|
2023-02-11 00:44:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-18 00:42:25 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '发送人名称',
|
|
|
|
|
field: 'nickname'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '开启状态',
|
|
|
|
|
field: 'status',
|
|
|
|
|
isSearch: true,
|
|
|
|
|
dictType: DICT_TYPE.COMMON_STATUS,
|
|
|
|
|
dictClass: 'number'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '备注',
|
|
|
|
|
field: 'remark',
|
|
|
|
|
isTable: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '创建时间',
|
|
|
|
|
field: 'createTime',
|
|
|
|
|
isForm: false,
|
|
|
|
|
formatter: dateFormatter,
|
|
|
|
|
search: {
|
|
|
|
|
show: true,
|
2023-03-18 01:23:07 +08:00
|
|
|
|
component: 'DatePicker',
|
|
|
|
|
componentProps: {
|
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
|
type: 'daterange',
|
|
|
|
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
|
2023-02-11 00:44:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-18 10:39:19 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '操作',
|
|
|
|
|
field: 'action',
|
|
|
|
|
isForm: false
|
2023-03-18 00:42:25 +08:00
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
export const { allSchemas } = useCrudSchemas(crudSchemas)
|