Browse Source

FWHL-551 邮箱记录添加导出按钮

hella_online_20250724
陈放 3 days ago
parent
commit
ec1e775033
  1. 5
      src/api/system/mail/log/index.ts
  2. 49
      src/views/system/mail/log/index.vue
  3. 1
      src/views/system/mail/log/log.data.ts

5
src/api/system/mail/log/index.ts

@ -28,3 +28,8 @@ export const getMailLogPage = async (params: PageParam) => {
export const getMailLog = async (id: number) => {
return await request.get({ url: '/system/mail-log/get?id=' + id })
}
// 查询邮件日志详情
export const exportMailLog = async (params) => {
return await request.download({ url: `/system/mail-log/export-excel`, params })
}

49
src/views/system/mail/log/index.vue

@ -4,6 +4,14 @@
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:route-name="routeName"
:allSchemas="allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
@ -35,11 +43,17 @@
</template>
<script lang="ts" setup>
import { allSchemas } from './log.data'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as MailLogApi from '@/api/system/mail/log'
import MailLogDetail from './MailLogDetail.vue'
import download from '@/utils/download'
defineOptions({ name: 'SystemMailLog' })
const message = useMessage()
const exportLoading = ref(false)
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
// tableObject
// tableMethods
// https://doc.iocoder.cn/vue3/crud-schema/
@ -49,7 +63,12 @@ const { tableObject, tableMethods } = useTable({
//
const { getList, setSearchParams } = tableMethods
/** 详情操作 */
//
const HeadButttondata = [
defaultButtons.defaultExportBtn({hasPermi:''}), //
]
/** 详情操作 */1
const detailRef = ref()
const openDetail = (id: number) => {
detailRef.value.open(id)
@ -59,4 +78,30 @@ const openDetail = (id: number) => {
onMounted(() => {
getList()
})
//
const buttonBaseClick = (val, item) => {
if (val == 'export') { //
handleExport()
} else { //
console.log('其他按钮', item)
}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
exportLoading.value = true
//
const data = await MailLogApi.exportMailLog(tableObject.params)
download.excel(data, '邮箱记录.xlsx')
} catch {
//
} finally {
exportLoading.value = false
}
}
</script>

1
src/views/system/mail/log/log.data.ts

@ -30,6 +30,7 @@ const crudSchemas = reactive<CrudSchema[]>([
},
{
label: '接收邮箱',
isSearch: true,
field: 'toMail'
},
{

Loading…
Cancel
Save