feat:【antd】【ele】统一 mail/template 的实现
This commit is contained in:
@@ -119,28 +119,31 @@ export function useSendMailFormSchema(): VbenFormSchema[] {
|
|||||||
{
|
{
|
||||||
fieldName: 'toMails',
|
fieldName: 'toMails',
|
||||||
label: '收件邮箱',
|
label: '收件邮箱',
|
||||||
component: 'Textarea',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入收件邮箱,每行一个邮箱地址',
|
mode: 'tags',
|
||||||
rows: 3,
|
allowClear: true,
|
||||||
|
placeholder: '请输入收件邮箱,按 Enter 添加',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'ccMails',
|
fieldName: 'ccMails',
|
||||||
label: '抄送邮箱',
|
label: '抄送邮箱',
|
||||||
component: 'Textarea',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入抄送邮箱,每行一个邮箱地址',
|
mode: 'tags',
|
||||||
rows: 2,
|
allowClear: true,
|
||||||
|
placeholder: '请输入抄送邮箱,按 Enter 添加',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'bccMails',
|
fieldName: 'bccMails',
|
||||||
label: '密送邮箱',
|
label: '密送邮箱',
|
||||||
component: 'Textarea',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入密送邮箱,每行一个邮箱地址',
|
mode: 'tags',
|
||||||
rows: 2,
|
allowClear: true,
|
||||||
|
placeholder: '请输入密送邮箱,按 Enter 添加',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -42,17 +42,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
paramsObj[param] = values[`param_${param}`];
|
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 = {
|
const data: SystemMailTemplateApi.MailSendReqVO = {
|
||||||
toMails: parseEmails(values.toMails || ''),
|
toMails: values.toMails,
|
||||||
ccMails: parseEmails(values.ccMails || ''),
|
ccMails: values.ccMails,
|
||||||
bccMails: parseEmails(values.bccMails || ''),
|
bccMails: values.bccMails,
|
||||||
templateCode: formData.value?.code || '',
|
templateCode: formData.value?.code || '',
|
||||||
templateParams: paramsObj,
|
templateParams: paramsObj,
|
||||||
};
|
};
|
||||||
@@ -64,8 +57,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
message.success('邮件发送成功');
|
message.success('邮件发送成功');
|
||||||
} catch (error) {
|
|
||||||
console.error('发送邮件失败', error);
|
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,28 +119,25 @@ export function useSendMailFormSchema(): VbenFormSchema[] {
|
|||||||
{
|
{
|
||||||
fieldName: 'toMails',
|
fieldName: 'toMails',
|
||||||
label: '收件邮箱',
|
label: '收件邮箱',
|
||||||
component: 'Textarea',
|
component: 'InputTag',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入收件邮箱,每行一个邮箱地址',
|
placeholder: '请输入收件邮箱,按 Enter 添加',
|
||||||
rows: 3,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'ccMails',
|
fieldName: 'ccMails',
|
||||||
label: '抄送邮箱',
|
label: '抄送邮箱',
|
||||||
component: 'Textarea',
|
component: 'InputTag',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入抄送邮箱,每行一个邮箱地址',
|
placeholder: '请输入抄送邮箱,按 Enter 添加',
|
||||||
rows: 2,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'bccMails',
|
fieldName: 'bccMails',
|
||||||
label: '密送邮箱',
|
label: '密送邮箱',
|
||||||
component: 'Textarea',
|
component: 'InputTag',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入密送邮箱,每行一个邮箱地址',
|
placeholder: '请输入密送邮箱,按 Enter 添加',
|
||||||
rows: 2,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -42,17 +42,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
paramsObj[param] = values[`param_${param}`];
|
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 = {
|
const data: SystemMailTemplateApi.MailSendReqVO = {
|
||||||
toMails: parseEmails(values.toMails || ''),
|
toMails: values.toMails,
|
||||||
ccMails: parseEmails(values.ccMails || ''),
|
ccMails: values.ccMails,
|
||||||
bccMails: parseEmails(values.bccMails || ''),
|
bccMails: values.bccMails,
|
||||||
templateCode: formData.value?.code || '',
|
templateCode: formData.value?.code || '',
|
||||||
templateParams: paramsObj,
|
templateParams: paramsObj,
|
||||||
};
|
};
|
||||||
@@ -64,8 +57,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
ElMessage.success('邮件发送成功');
|
ElMessage.success('邮件发送成功');
|
||||||
} catch (error) {
|
|
||||||
console.error('发送邮件失败', error);
|
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user