refactor:优化 mail 邮箱的实现
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { SystemMailLogApi } from '#/api/system/mail/log';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getMailLogPage, resendMail } from '#/api/system/mail/log';
|
||||
import { getMailLogPage } from '#/api/system/mail/log';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
@@ -25,40 +20,17 @@ function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 查看邮件日志详情 */
|
||||
function onView(row: SystemMailLogApi.MailLog) {
|
||||
/** 查看邮件日志 */
|
||||
function onView(row: SystemMailLogApi.SystemMailLog) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 重新发送邮件 */
|
||||
async function onResend(row: SystemMailLogApi.MailLog) {
|
||||
const hideLoading = message.loading({
|
||||
content: '重新发送邮件中...',
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
try {
|
||||
await resendMail(row.id as number);
|
||||
message.success({
|
||||
content: '重新发送邮件成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemMailLogApi.MailLog>) {
|
||||
}: OnActionClickParams<SystemMailLogApi.SystemMailLog>) {
|
||||
switch (code) {
|
||||
case 'resend': {
|
||||
onResend(row);
|
||||
break;
|
||||
}
|
||||
case 'view': {
|
||||
onView(row);
|
||||
break;
|
||||
@@ -92,7 +64,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<SystemMailLogApi.MailLog>,
|
||||
} as VxeTableGridOptions<SystemMailLogApi.SystemMailLog>,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user