2025-04-03 23:36:02 +08:00
|
|
|
<script lang="ts" setup>
|
2025-05-19 17:58:06 +08:00
|
|
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
2025-04-03 23:36:02 +08:00
|
|
|
import type { SystemMailLogApi } from '#/api/system/mail/log';
|
|
|
|
|
|
2025-06-10 16:32:29 +08:00
|
|
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
2025-04-03 23:36:02 +08:00
|
|
|
|
2025-05-19 18:13:13 +08:00
|
|
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
2025-04-04 17:45:56 +08:00
|
|
|
import { getMailLogPage } from '#/api/system/mail/log';
|
2025-08-05 21:45:23 +08:00
|
|
|
import { DictTag } from '#/components/dict-tag';
|
|
|
|
|
import { DICT_TYPE } from '#/utils';
|
2025-04-03 23:36:02 +08:00
|
|
|
|
|
|
|
|
import { useGridColumns, useGridFormSchema } from './data';
|
2025-04-22 11:25:11 +08:00
|
|
|
import Detail from './modules/detail.vue';
|
2025-04-03 23:36:02 +08:00
|
|
|
|
2025-04-04 18:02:02 +08:00
|
|
|
const [DetailModal, detailModalApi] = useVbenModal({
|
|
|
|
|
connectedComponent: Detail,
|
2025-04-03 23:36:02 +08:00
|
|
|
destroyOnClose: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/** 刷新表格 */
|
|
|
|
|
function onRefresh() {
|
|
|
|
|
gridApi.query();
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-04 17:45:56 +08:00
|
|
|
/** 查看邮件日志 */
|
2025-05-20 11:23:02 +08:00
|
|
|
function handleDetail(row: SystemMailLogApi.MailLog) {
|
2025-04-04 18:02:02 +08:00
|
|
|
detailModalApi.setData(row).open();
|
2025-04-03 23:36:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const [Grid, gridApi] = useVbenVxeGrid({
|
|
|
|
|
formOptions: {
|
|
|
|
|
schema: useGridFormSchema(),
|
|
|
|
|
},
|
|
|
|
|
gridOptions: {
|
2025-05-19 17:58:06 +08:00
|
|
|
columns: useGridColumns(),
|
2025-04-03 23:36:02 +08:00
|
|
|
height: 'auto',
|
|
|
|
|
keepSource: true,
|
|
|
|
|
proxyConfig: {
|
|
|
|
|
ajax: {
|
|
|
|
|
query: async ({ page }, formValues) => {
|
|
|
|
|
return await getMailLogPage({
|
|
|
|
|
pageNo: page.currentPage,
|
|
|
|
|
pageSize: page.pageSize,
|
|
|
|
|
...formValues,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
rowConfig: {
|
|
|
|
|
keyField: 'id',
|
|
|
|
|
},
|
|
|
|
|
toolbarConfig: {
|
2025-07-19 17:15:39 +08:00
|
|
|
refresh: true,
|
2025-04-03 23:36:02 +08:00
|
|
|
search: true,
|
|
|
|
|
},
|
2025-04-22 22:10:33 +08:00
|
|
|
} as VxeTableGridOptions<SystemMailLogApi.MailLog>,
|
2025-04-03 23:36:02 +08:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<Page auto-content-height>
|
2025-04-25 22:03:06 +08:00
|
|
|
<template #doc>
|
|
|
|
|
<DocAlert title="邮件配置" url="https://doc.iocoder.cn/mail" />
|
|
|
|
|
</template>
|
2025-04-06 10:23:57 +08:00
|
|
|
|
2025-04-04 18:02:02 +08:00
|
|
|
<DetailModal @success="onRefresh" />
|
2025-04-03 23:36:02 +08:00
|
|
|
<Grid table-title="邮件日志列表">
|
2025-08-05 21:45:23 +08:00
|
|
|
<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>
|
2025-05-19 17:58:06 +08:00
|
|
|
<template #actions="{ row }">
|
|
|
|
|
<TableAction
|
|
|
|
|
:actions="[
|
|
|
|
|
{
|
|
|
|
|
label: $t('common.detail'),
|
|
|
|
|
type: 'link',
|
|
|
|
|
icon: ACTION_ICON.VIEW,
|
|
|
|
|
auth: ['system:mail-log:query'],
|
2025-05-20 11:23:02 +08:00
|
|
|
onClick: handleDetail.bind(null, row),
|
2025-05-19 17:58:06 +08:00
|
|
|
},
|
|
|
|
|
]"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2025-04-03 23:36:02 +08:00
|
|
|
</Grid>
|
|
|
|
|
</Page>
|
|
|
|
|
</template>
|