reactor:【system 系统管理】mail/log 进一步统一代码风格

This commit is contained in:
YunaiV
2025-09-06 11:21:34 +08:00
parent 9565de2b5c
commit 5f77cde53f
4 changed files with 41 additions and 56 deletions

View File

@@ -4,13 +4,12 @@ import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { formatDateTime } from '@vben/utils';
import { getSimpleMailAccountList } from '#/api/system/mail/account';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getRangePickerDefaultProps } from '#/utils';
/** 列表的搜索表单 */
@@ -84,22 +83,24 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'id',
title: '编号',
minWidth: 100,
},
{
field: 'sendTime',
title: '发送时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{
field: 'userType',
title: '接收用户',
width: 150,
minWidth: 150,
slots: { default: 'userInfo' },
},
{
field: 'toMails',
title: '接收信息',
width: 300,
minWidth: 300,
formatter: ({ row }) => {
const lines: string[] = [];
if (row.toMails && row.toMails.length > 0) {
@@ -117,18 +118,22 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'templateTitle',
title: '邮件标题',
minWidth: 120,
},
{
field: 'templateContent',
title: '邮件内容',
minWidth: 300,
},
{
field: 'fromMail',
title: '发送邮箱',
minWidth: 120,
},
{
field: 'sendStatus',
title: '发送状态',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS },
@@ -137,6 +142,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'templateCode',
title: '模板编码',
minWidth: 120,
},
{
title: '操作',

View File

@@ -8,6 +8,7 @@ import { DICT_TYPE } from '@vben/constants';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getMailLogPage } from '#/api/system/mail/log';
import { DictTag } from '#/components/dict-tag';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Detail from './modules/detail.vue';
@@ -18,7 +19,7 @@ const [DetailModal, detailModalApi] = useVbenModal({
});
/** 刷新表格 */
function onRefresh() {
function handleRefresh() {
gridApi.query();
}
@@ -48,6 +49,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
@@ -62,7 +64,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<DocAlert title="邮件配置" url="https://doc.iocoder.cn/mail" />
</template>
<DetailModal @success="onRefresh" />
<DetailModal @success="handleRefresh" />
<Grid table-title="邮件日志列表">
<template #userInfo="{ row }">
<div v-if="row.userType && row.userId" class="flex items-center gap-1">