feat:【system 系统功能】邮箱增加抄送、密送,支持多个
parent
55061b73de
commit
d48b78a462
|
@ -8,7 +8,9 @@ export namespace SystemMailLogApi {
|
|||
id: number;
|
||||
userId: number;
|
||||
userType: number;
|
||||
toMail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
accountId: number;
|
||||
fromMail: string;
|
||||
templateId: number;
|
||||
|
|
|
@ -20,7 +20,9 @@ export namespace SystemMailTemplateApi {
|
|||
|
||||
/** 邮件发送信息 */
|
||||
export interface MailSendReqVO {
|
||||
mail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
templateCode: string;
|
||||
templateParams: Record<string, any>;
|
||||
}
|
||||
|
|
|
@ -91,9 +91,28 @@ export function useGridColumns<T = SystemMailLogApi.MailLog>(
|
|||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'toMail',
|
||||
title: '收件邮箱',
|
||||
minWidth: 160,
|
||||
field: 'userType',
|
||||
title: '接收用户',
|
||||
minWidth: 150,
|
||||
slots: { default: 'userInfo' },
|
||||
},
|
||||
{
|
||||
field: 'toMails',
|
||||
title: '接收信息',
|
||||
minWidth: 300,
|
||||
formatter: ({ row }) => {
|
||||
const lines: string[] = [];
|
||||
if (row.toMails && row.toMails.length > 0) {
|
||||
lines.push(`收件:${row.toMails.join('、')}`);
|
||||
}
|
||||
if (row.ccMails && row.ccMails.length > 0) {
|
||||
lines.push(`抄送:${row.ccMails.join('、')}`);
|
||||
}
|
||||
if (row.bccMails && row.bccMails.length > 0) {
|
||||
lines.push(`密送:${row.bccMails.join('、')}`);
|
||||
}
|
||||
return lines.join('\n');
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'templateTitle',
|
||||
|
|
|
@ -9,6 +9,8 @@ import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
|||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getMailLogPage } from '#/api/system/mail/log';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { DICT_TYPE } from '#/utils';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Detail from './modules/detail.vue';
|
||||
|
@ -78,6 +80,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<DetailModal @success="onRefresh" />
|
||||
<Grid table-title="邮件日志列表">
|
||||
<template #userInfo="{ row }">
|
||||
<div v-if="row.userType && row.userId" class="flex items-center gap-1">
|
||||
<DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />
|
||||
<span>({{ row.userId }})</span>
|
||||
</div>
|
||||
<div v-else>-</div>
|
||||
</template>
|
||||
<template #toolbar-tools> </template>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
|
|
@ -47,17 +47,31 @@ const [Modal, modalApi] = useVbenModal({
|
|||
<ElDescriptionsItem label="创建时间">
|
||||
{{ formatDateTime(formData?.createTime || '') }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="收件邮箱">
|
||||
{{ formData?.toMail }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="发送邮箱">
|
||||
{{ formData?.fromMail }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="用户编号">
|
||||
{{ formData?.userId }}
|
||||
<ElDescriptionsItem label="接收用户">
|
||||
<div
|
||||
v-if="formData?.userType && formData?.userId"
|
||||
class="flex items-center gap-1"
|
||||
>
|
||||
<DictTag :type="DICT_TYPE.USER_TYPE" :value="formData.userType" />
|
||||
<span>({{ formData.userId }})</span>
|
||||
</div>
|
||||
<div v-else>无</div>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="用户类型">
|
||||
{{ formData?.userType }}
|
||||
<ElDescriptionsItem label="接收信息" :span="2">
|
||||
<div v-if="formData">
|
||||
<div v-if="formData.toMails && formData.toMails.length > 0">
|
||||
收件:{{ formData.toMails.join('、') }}
|
||||
</div>
|
||||
<div v-if="formData.ccMails && formData.ccMails.length > 0">
|
||||
抄送:{{ formData.ccMails.join('、') }}
|
||||
</div>
|
||||
<div v-if="formData.bccMails && formData.bccMails.length > 0">
|
||||
密送:{{ formData.bccMails.join('、') }}
|
||||
</div>
|
||||
</div>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="模板编号">
|
||||
{{ formData?.templateId }}
|
||||
|
|
|
@ -126,13 +126,31 @@ export function useSendMailFormSchema(): VbenFormSchema[] {
|
|||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'mail',
|
||||
fieldName: 'toMails',
|
||||
label: '收件邮箱',
|
||||
component: 'Input',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入收件邮箱',
|
||||
placeholder: '请输入收件邮箱,每行一个邮箱地址',
|
||||
rows: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'ccMails',
|
||||
label: '抄送邮箱',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入抄送邮箱,每行一个邮箱地址',
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'bccMails',
|
||||
label: '密送邮箱',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入密送邮箱,每行一个邮箱地址',
|
||||
rows: 2,
|
||||
},
|
||||
rules: z.string().email('请输入正确的邮箱'),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -42,8 +42,17 @@ const [Modal, modalApi] = useVbenModal({
|
|||
paramsObj[param] = values[`param_${param}`];
|
||||
});
|
||||
}
|
||||
const parseEmails = (text: string): string[] => {
|
||||
if (!text) return [];
|
||||
return text
|
||||
.split('\n')
|
||||
.map((email) => email.trim())
|
||||
.filter((email) => email.length > 0);
|
||||
};
|
||||
const data: SystemMailTemplateApi.MailSendReqVO = {
|
||||
mail: values.mail,
|
||||
toMails: parseEmails(values.toMails || ''),
|
||||
ccMails: parseEmails(values.ccMails || ''),
|
||||
bccMails: parseEmails(values.bccMails || ''),
|
||||
templateCode: formData.value?.code || '',
|
||||
templateParams: paramsObj,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue