diff --git a/src/enums/appEnum.ts b/src/enums/appEnum.ts index b7c40e2..de2bbd6 100644 --- a/src/enums/appEnum.ts +++ b/src/enums/appEnum.ts @@ -69,5 +69,6 @@ export enum IconEnum { ADD_FOLD = 'ant-design:folder-add-outlined', LOG = 'ant-design:exception-outlined', PASSWORD = 'ant-design:key-outlined', - SETTING = 'ant-design:setting-outlined' + SETTING = 'ant-design:setting-outlined', + SEND = 'ant-design:send-outlined' } diff --git a/src/views/system/mail/account/account.data.ts b/src/views/system/mail/account/account.data.ts index 69364b5..e15919b 100644 --- a/src/views/system/mail/account/account.data.ts +++ b/src/views/system/mail/account/account.data.ts @@ -71,7 +71,16 @@ export const formSchema: FormSchema[] = [ label: '邮箱', field: 'mail', required: true, - component: 'Input' + component: 'Input', + helpMessage: '填写发件邮箱地址', + rules: [ + { + required: true, + message: '请输入正确的邮箱地址', + pattern: /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,5}){1,2}$/, + trigger: 'blur' + } + ] }, { label: '用户名', @@ -80,10 +89,11 @@ export const formSchema: FormSchema[] = [ component: 'Input' }, { - label: '密码', + label: '密码/授权码', field: 'password', required: true, - component: 'InputPassword' + component: 'InputPassword', + helpMessage: '填写邮件密码, 部分邮件商需要填写授权码' }, { label: 'SMTP 服务器域名', @@ -95,14 +105,14 @@ export const formSchema: FormSchema[] = [ label: 'SMTP 服务器端口', field: 'port', required: true, - component: 'Input' + component: 'InputNumber' }, { label: '是否开启 SSL', field: 'sslEnable', required: true, defaultValue: false, - component: 'Switch', + component: 'RadioButtonGroup', componentProps: { options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean') } diff --git a/src/views/system/mail/log/MailLogModal.vue b/src/views/system/mail/log/MailLogModal.vue new file mode 100644 index 0000000..f740230 --- /dev/null +++ b/src/views/system/mail/log/MailLogModal.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/src/views/system/mail/log/index.vue b/src/views/system/mail/log/index.vue index fd82ef2..4652530 100644 --- a/src/views/system/mail/log/index.vue +++ b/src/views/system/mail/log/index.vue @@ -1,15 +1,35 @@ diff --git a/src/views/system/mail/log/mailLog.data.ts b/src/views/system/mail/log/mailLog.data.ts index 7106cca..65b901a 100644 --- a/src/views/system/mail/log/mailLog.data.ts +++ b/src/views/system/mail/log/mailLog.data.ts @@ -1,6 +1,8 @@ import { BasicColumn, FormSchema, useRender } from '@/components/Table' import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { getSimpleMailAccountList } from '@/api/system/mail/account' +import { DescItem } from '@/components/Description/index' +import { h } from 'vue' export const columns: BasicColumn[] = [ { @@ -8,14 +10,6 @@ export const columns: BasicColumn[] = [ dataIndex: 'id', width: 100 }, - { - title: '发送时间', - dataIndex: 'sendTime', - width: 180, - customRender: ({ text }) => { - return useRender.renderDate(text) - } - }, { title: '接收邮箱', dataIndex: 'toMail', @@ -42,7 +36,15 @@ export const columns: BasicColumn[] = [ { title: '模板编号', dataIndex: 'templateId', - width: 180 + width: 100 + }, + { + title: '发送时间', + dataIndex: 'sendTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } } ] @@ -101,3 +103,89 @@ export const searchFormSchema: FormSchema[] = [ colProps: { span: 8 } } ] + +export const logSchema: DescItem[] = [ + { + field: 'sendStatus', + label: '发送状态', + labelMinWidth: 80, + render(value) { + return useRender.renderDict(value, DICT_TYPE.SYSTEM_MAIL_SEND_STATUS) + } + }, + { + field: 'sendException', + label: '异常信息', + labelMinWidth: 80, + show: (data) => data && data.sendException && data.sendException.length > 0, + render(value) { + return h('span', { style: { fontWeight: 'bold' } }, value) + } + }, + { + field: 'sendTime', + label: '发送时间', + render(value) { + return useRender.renderDate(value) + } + }, + { + field: 'userId', + label: '用户类型', + render(_, data) { + const { userId, userType } = data + const uidTag = useRender.renderTag('uid: ' + userId) + const typeTag = useRender.renderDict(userType, DICT_TYPE.USER_TYPE) + return h('span', {}, [typeTag, uidTag]) + } + }, + { + field: 'fromMail', + label: '发件邮箱' + }, + { + field: 'toMail', + label: '收件邮箱' + }, + { + field: 'templateNickname', + label: '发件昵称' + }, + { + field: 'templateTitle', + label: '邮件标题' + }, + { + field: 'templateContent', + label: '邮件内容', + render(value) { + return h('div', { innerHTML: value }) + } + }, + { + field: 'templateParams', + label: '邮件参数', + render(value) { + return useRender.renderJsonPreview(value) + } + }, + { + field: 'sendMessageId', + label: '返回ID' + }, + { + field: 'templateCode', + label: '模板编码' + }, + { + field: 'templateId', + label: '模板编号' + }, + { + field: 'createTime', + label: '记录时间', + render(value) { + return useRender.renderDate(value) + } + } +] diff --git a/src/views/system/mail/template/SendMailModal.vue b/src/views/system/mail/template/SendMailModal.vue index b0716bf..3b7ab71 100644 --- a/src/views/system/mail/template/SendMailModal.vue +++ b/src/views/system/mail/template/SendMailModal.vue @@ -1,39 +1,42 @@ diff --git a/src/views/system/mail/template/index.vue b/src/views/system/mail/template/index.vue index 67bd9e7..4a701bd 100644 --- a/src/views/system/mail/template/index.vue +++ b/src/views/system/mail/template/index.vue @@ -11,8 +11,8 @@