From 3bae7aa44292b861655dd4aadccc5e06d3a9a0e2 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Mon, 16 Jun 2025 21:24:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90ele=E3=80=91=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=96=B0=E5=A2=9E=E6=89=B9=E9=87=8F=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/mail/account/index.ts | 7 ++ .../src/api/system/mail/template/index.ts | 7 ++ .../src/views/system/mail/account/data.ts | 4 ++ .../src/views/system/mail/account/index.vue | 66 +++++++++++++++---- .../src/views/system/mail/template/data.ts | 4 ++ .../src/views/system/mail/template/index.vue | 62 +++++++++++++---- 6 files changed, 126 insertions(+), 24 deletions(-) diff --git a/apps/web-ele/src/api/system/mail/account/index.ts b/apps/web-ele/src/api/system/mail/account/index.ts index 8a43a3326..7f506fd87 100644 --- a/apps/web-ele/src/api/system/mail/account/index.ts +++ b/apps/web-ele/src/api/system/mail/account/index.ts @@ -49,6 +49,13 @@ export function deleteMailAccount(id: number) { return requestClient.delete(`/system/mail-account/delete?id=${id}`); } +/** 批量删除邮箱账号 */ +export function deleteMailAccountList(ids: number[]) { + return requestClient.delete( + `/system/mail-account/delete-list?ids=${ids.join(',')}`, + ); +} + /** 获得邮箱账号精简列表 */ export function getSimpleMailAccountList() { return requestClient.get( diff --git a/apps/web-ele/src/api/system/mail/template/index.ts b/apps/web-ele/src/api/system/mail/template/index.ts index 34b4a09d0..1750cfd2a 100644 --- a/apps/web-ele/src/api/system/mail/template/index.ts +++ b/apps/web-ele/src/api/system/mail/template/index.ts @@ -56,6 +56,13 @@ export function deleteMailTemplate(id: number) { return requestClient.delete(`/system/mail-template/delete?id=${id}`); } +/** 批量删除邮件模版 */ +export function deleteMailTemplateList(ids: number[]) { + return requestClient.delete( + `/system/mail-template/delete-list?ids=${ids.join(',')}`, + ); +} + /** 发送邮件 */ export function sendMail(data: SystemMailTemplateApi.MailSendReqVO) { return requestClient.post('/system/mail-template/send-mail', data); diff --git a/apps/web-ele/src/views/system/mail/account/data.ts b/apps/web-ele/src/views/system/mail/account/data.ts index 48a7989a2..964b70b71 100644 --- a/apps/web-ele/src/views/system/mail/account/data.ts +++ b/apps/web-ele/src/views/system/mail/account/data.ts @@ -129,6 +129,10 @@ export function useGridColumns( onActionClick: OnActionClickFn, ): VxeTableGridOptions['columns'] { return [ + { + type: 'checkbox', + width: 40, + }, { field: 'id', title: '编号', diff --git a/apps/web-ele/src/views/system/mail/account/index.vue b/apps/web-ele/src/views/system/mail/account/index.vue index cf7a4e923..fdd342bbd 100644 --- a/apps/web-ele/src/views/system/mail/account/index.vue +++ b/apps/web-ele/src/views/system/mail/account/index.vue @@ -5,14 +5,17 @@ import type { } from '#/adapter/vxe-table'; import type { SystemMailAccountApi } from '#/api/system/mail/account'; +import { ref } from 'vue'; + import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { Plus } from '@vben/icons'; +import { isEmpty } from '@vben/utils'; -import { ElButton, ElLoading, ElMessage } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; -import { useVbenVxeGrid } from '#/adapter/vxe-table'; +import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteMailAccount, + deleteMailAccountList, getMailAccountPage, } from '#/api/system/mail/account'; import { $t } from '#/locales'; @@ -50,13 +53,35 @@ async function onDelete(row: SystemMailAccountApi.MailAccount) { await deleteMailAccount(row.id as number); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.mail])); onRefresh(); - } catch { - // 异常处理 } finally { loadingInstance.close(); } } +/** 批量删除邮箱账号 */ +async function onDeleteBatch() { + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting'), + fullscreen: true, + }); + try { + await deleteMailAccountList(checkedIds.value); + ElMessage.success($t('ui.actionMessage.deleteSuccess')); + onRefresh(); + } finally { + loadingInstance.close(); + } +} + +const checkedIds = ref([]); +function handleRowCheckboxChange({ + records, +}: { + records: SystemMailAccountApi.MailAccount[]; +}) { + checkedIds.value = records.map((item) => item.id as number); +} + /** 表格操作按钮的回调函数 */ function onActionClick({ code, @@ -101,6 +126,10 @@ const [Grid, gridApi] = useVbenVxeGrid({ search: true, }, } as VxeTableGridOptions, + gridEvents: { + checkboxAll: handleRowCheckboxChange, + checkboxChange: handleRowCheckboxChange, + }, });