mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-07 07:35:06 +08:00
邮箱模块:vue3 邮件日志的管理
This commit is contained in:
40
yudao-ui-admin-vue3/src/api/system/mail/log/index.ts
Normal file
40
yudao-ui-admin-vue3/src/api/system/mail/log/index.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface MailLogVO {
|
||||
id: number
|
||||
userId: number
|
||||
userType: number
|
||||
toMail: string
|
||||
accountId: number
|
||||
fromMail: string
|
||||
templateId: number
|
||||
templateCode: string
|
||||
templateNickname: string
|
||||
templateTitle: string
|
||||
templateContent: string
|
||||
templateParams: string
|
||||
sendStatus: number
|
||||
sendTime: Date
|
||||
sendMessageId: string
|
||||
sendException: string
|
||||
}
|
||||
|
||||
export interface MailLogPageReqVO extends PageParam {
|
||||
userId?: number
|
||||
userType?: number
|
||||
toMail?: string
|
||||
accountId?: number
|
||||
templateId?: number
|
||||
sendStatus?: number
|
||||
sendTime?: Date[]
|
||||
}
|
||||
|
||||
// 查询邮件日志列表
|
||||
export const getMailLogPageApi = async (params: MailLogPageReqVO) => {
|
||||
return await request.get({ url: '/system/mail-log/page', params })
|
||||
}
|
||||
|
||||
// 查询邮件日志详情
|
||||
export const getMailLogApi = async (id: number) => {
|
||||
return await request.get({ url: '/system/mail-log/get?id=' + id })
|
||||
}
|
@ -90,6 +90,7 @@ export enum DICT_TYPE {
|
||||
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
|
||||
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
|
||||
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
|
||||
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
|
||||
|
||||
// ========== INFRA 模块 ==========
|
||||
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
|
||||
|
96
yudao-ui-admin-vue3/src/views/system/mail/log/index.vue
Normal file
96
yudao-ui-admin-vue3/src/views/system/mail/log/index.vue
Normal file
@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 列表 -->
|
||||
<XTable @register="registerTable">
|
||||
<template #accountId_search>
|
||||
<el-select v-model="queryParams.accountId">
|
||||
<el-option :key="undefined" label="全部" :value="undefined" />
|
||||
<el-option
|
||||
v-for="item in accountOptions"
|
||||
:key="item.id"
|
||||
:label="item.mail"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #toMail_default="{ row }">
|
||||
<div>{{ row.toMail }}</div>
|
||||
<div v-if="row.userType && row.userId">
|
||||
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />{{ '(' + row.userId + ')' }}
|
||||
</div>
|
||||
</template>
|
||||
<template #actionbtns_default="{ row }">
|
||||
<!-- 操作:详情 -->
|
||||
<XTextButton
|
||||
preIcon="ep:view"
|
||||
:title="t('action.detail')"
|
||||
v-hasPermi="['system:mail-log:query']"
|
||||
@click="handleDetail(row.id)"
|
||||
/>
|
||||
</template>
|
||||
</XTable>
|
||||
</ContentWrap>
|
||||
<!-- 弹窗 -->
|
||||
<XModal id="mailLogModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
|
||||
<!-- 表单:详情 -->
|
||||
<Descriptions
|
||||
v-if="actionType === 'detail'"
|
||||
:schema="allSchemas.detailSchema"
|
||||
:data="detailData"
|
||||
/>
|
||||
<template #footer>
|
||||
<!-- 按钮:关闭 -->
|
||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
|
||||
</template>
|
||||
</XModal>
|
||||
</template>
|
||||
<script setup lang="ts" name="MailLog">
|
||||
// 业务相关的 import
|
||||
import { allSchemas } from './log.data'
|
||||
import * as MailLogApi from '@/api/system/mail/log'
|
||||
import * as MailAccountApi from '@/api/system/mail/account'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
// 列表相关的变量
|
||||
const queryParams = reactive({
|
||||
accountId: null
|
||||
})
|
||||
const [registerTable] = useXTable({
|
||||
allSchemas: allSchemas,
|
||||
params: queryParams,
|
||||
getListApi: MailLogApi.getMailLogPageApi
|
||||
})
|
||||
const accountOptions = ref([]) // 账号下拉选项
|
||||
|
||||
// 弹窗相关的变量
|
||||
const modelVisible = ref(false) // 是否显示弹出层
|
||||
const modelTitle = ref('edit') // 弹出层标题
|
||||
const modelLoading = ref(false) // 弹出层loading
|
||||
const actionType = ref('') // 操作按钮的类型
|
||||
const actionLoading = ref(false) // 按钮 Loading
|
||||
const detailData = ref() // 详情 Ref
|
||||
|
||||
// 设置标题
|
||||
const setDialogTile = (type: string) => {
|
||||
modelLoading.value = true
|
||||
modelTitle.value = t('action.' + type)
|
||||
actionType.value = type
|
||||
modelVisible.value = true
|
||||
}
|
||||
|
||||
// 详情操作
|
||||
const handleDetail = async (rowId: number) => {
|
||||
setDialogTile('detail')
|
||||
const res = await MailLogApi.getMailLogApi(rowId)
|
||||
detailData.value = res
|
||||
modelLoading.value = false
|
||||
}
|
||||
|
||||
// ========== 初始化 ==========
|
||||
onMounted(() => {
|
||||
MailAccountApi.getSimpleMailAccounts().then((data) => {
|
||||
accountOptions.value = data
|
||||
})
|
||||
})
|
||||
</script>
|
121
yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts
Normal file
121
yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts
Normal file
@ -0,0 +1,121 @@
|
||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryTitle: '编号',
|
||||
primaryType: 'id',
|
||||
action: true,
|
||||
actionWidth: '70',
|
||||
columns: [
|
||||
{
|
||||
title: '发送时间',
|
||||
field: 'sendTime',
|
||||
table: {
|
||||
width: 180
|
||||
},
|
||||
formatter: 'formatDate',
|
||||
search: {
|
||||
show: true,
|
||||
itemRender: {
|
||||
name: 'XDataTimePicker'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '接收邮箱',
|
||||
field: 'toMail',
|
||||
isSearch: true,
|
||||
table: {
|
||||
width: 180,
|
||||
slots: {
|
||||
default: 'toMail_default'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '用户编号',
|
||||
field: 'userId',
|
||||
isSearch: true,
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '用户类型',
|
||||
field: 'userType',
|
||||
dictType: DICT_TYPE.USER_TYPE,
|
||||
dictClass: 'number',
|
||||
isSearch: true,
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '邮件标题',
|
||||
field: 'templateTitle'
|
||||
},
|
||||
{
|
||||
title: '邮件内容',
|
||||
field: 'templateContent',
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '邮箱参数',
|
||||
field: 'templateParams',
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '发送状态',
|
||||
field: 'sendStatus',
|
||||
dictType: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS,
|
||||
dictClass: 'string',
|
||||
isSearch: true
|
||||
},
|
||||
{
|
||||
title: '邮箱账号',
|
||||
field: 'accountId',
|
||||
isSearch: true,
|
||||
isTable: false,
|
||||
search: {
|
||||
slots: {
|
||||
default: 'accountId_search'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '发送邮箱地址',
|
||||
field: 'fromMail',
|
||||
table: {
|
||||
title: '邮箱账号'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '模板编号',
|
||||
field: 'templateId',
|
||||
isSearch: true
|
||||
},
|
||||
{
|
||||
title: '模板编码',
|
||||
field: 'templateCode',
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '模版发送人名称',
|
||||
field: 'templateNickname',
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '发送返回的消息编号',
|
||||
field: 'sendMessageId',
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '发送异常',
|
||||
field: 'sendException',
|
||||
isTable: false
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
isTable: false
|
||||
}
|
||||
]
|
||||
})
|
||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
Reference in New Issue
Block a user