From 9f352291d77afddc0028b880d15559b1b50f8f69 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 4 Apr 2025 18:02:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9A=E4=BC=98=E5=8C=96=20notify=20?= =?UTF-8?q?=E7=AB=99=E5=86=85=E4=BF=A1=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/notify/message/index.ts | 10 +-- .../src/api/system/notify/template/index.ts | 24 ++---- .../src/views/system/mail/log/index.vue | 10 +-- .../mail/log/modules/{form.vue => detail.vue} | 0 .../mail/template/modules/send-form.vue | 2 +- .../src/views/system/notify/message/data.ts | 3 +- .../src/views/system/notify/message/index.vue | 14 ++-- .../system/notify/message/modules/detail.vue | 20 ++--- .../src/views/system/notify/my/data.ts | 2 +- .../src/views/system/notify/my/index.vue | 11 +-- .../views/system/notify/my/modules/detail.vue | 4 +- .../src/views/system/notify/template/data.ts | 26 +++---- .../views/system/notify/template/index.vue | 34 ++++----- .../system/notify/template/modules/form.vue | 20 ++--- .../notify/template/modules/send-form.vue | 76 +++++++++---------- 15 files changed, 106 insertions(+), 150 deletions(-) rename apps/web-antd/src/views/system/mail/log/modules/{form.vue => detail.vue} (100%) diff --git a/apps/web-antd/src/api/system/notify/message/index.ts b/apps/web-antd/src/api/system/notify/message/index.ts index cdacbffd0..5a5c21154 100644 --- a/apps/web-antd/src/api/system/notify/message/index.ts +++ b/apps/web-antd/src/api/system/notify/message/index.ts @@ -4,7 +4,7 @@ import { requestClient } from '#/api/request'; export namespace SystemNotifyMessageApi { /** 站内信消息信息 */ - export interface NotifyMessage { + export interface SystemNotifyMessage { id: number; userId: number; userType: number; @@ -22,7 +22,7 @@ export namespace SystemNotifyMessageApi { /** 查询站内信消息列表 */ export function getNotifyMessagePage(params: PageParam) { - return requestClient.get>( + return requestClient.get>( '/system/notify-message/page', { params }, ); @@ -30,7 +30,7 @@ export function getNotifyMessagePage(params: PageParam) { /** 获得我的站内信分页 */ export function getMyNotifyMessagePage(params: PageParam) { - return requestClient.get>( + return requestClient.get>( '/system/notify-message/my-page', { params }, ); @@ -48,9 +48,7 @@ export function updateAllNotifyMessageRead() { /** 获取当前用户的最新站内信列表 */ export function getUnreadNotifyMessageList() { - return requestClient.get( - '/system/notify-message/get-unread-list', - ); + return requestClient.get('/system/notify-message/get-unread-list'); } /** 获得当前用户的未读站内信数量 */ diff --git a/apps/web-antd/src/api/system/notify/template/index.ts b/apps/web-antd/src/api/system/notify/template/index.ts index 464dec1e3..7c33f1b8b 100644 --- a/apps/web-antd/src/api/system/notify/template/index.ts +++ b/apps/web-antd/src/api/system/notify/template/index.ts @@ -4,7 +4,7 @@ import { requestClient } from '#/api/request'; export namespace SystemNotifyTemplateApi { /** 站内信模板信息 */ - export interface NotifyTemplate { + export interface SystemNotifyTemplate { id?: number; name: string; nickname: string; @@ -17,7 +17,7 @@ export namespace SystemNotifyTemplateApi { } /** 发送站内信请求 */ - export interface NotifySendReq { + export interface SystemNotifySendReqVO { userId: number; templateCode: string; templateParams: Record; @@ -26,7 +26,7 @@ export namespace SystemNotifyTemplateApi { /** 查询站内信模板列表 */ export function getNotifyTemplatePage(params: PageParam) { - return requestClient.get>( + return requestClient.get>( '/system/notify-template/page', { params }, ); @@ -34,22 +34,16 @@ export function getNotifyTemplatePage(params: PageParam) { /** 查询站内信模板详情 */ export function getNotifyTemplate(id: number) { - return requestClient.get( - `/system/notify-template/get?id=${id}`, - ); + return requestClient.get(`/system/notify-template/get?id=${id}`); } /** 新增站内信模板 */ -export function createNotifyTemplate( - data: SystemNotifyTemplateApi.NotifyTemplate, -) { +export function createNotifyTemplate(data: SystemNotifyTemplateApi.SystemNotifyTemplate) { return requestClient.post('/system/notify-template/create', data); } /** 修改站内信模板 */ -export function updateNotifyTemplate( - data: SystemNotifyTemplateApi.NotifyTemplate, -) { +export function updateNotifyTemplate(data: SystemNotifyTemplateApi.SystemNotifyTemplate) { return requestClient.put('/system/notify-template/update', data); } @@ -60,12 +54,10 @@ export function deleteNotifyTemplate(id: number) { /** 导出站内信模板 */ export function exportNotifyTemplate(params: any) { - return requestClient.download('/system/notify-template/export-excel', { - params, - }); + return requestClient.download('/system/notify-template/export-excel', { params }); } /** 发送站内信 */ -export function sendNotify(data: SystemNotifyTemplateApi.NotifySendReq) { +export function sendNotify(data: SystemNotifyTemplateApi.SystemNotifySendReqVO) { return requestClient.post('/system/notify-template/send-notify', data); } diff --git a/apps/web-antd/src/views/system/mail/log/index.vue b/apps/web-antd/src/views/system/mail/log/index.vue index d271b18e2..01882cb53 100644 --- a/apps/web-antd/src/views/system/mail/log/index.vue +++ b/apps/web-antd/src/views/system/mail/log/index.vue @@ -3,15 +3,15 @@ import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-tab import type { SystemMailLogApi } from '#/api/system/mail/log'; import { Page, useVbenModal } from '@vben/common-ui'; -import Form from './modules/form.vue'; +import Detail from './modules/detail.vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getMailLogPage } from '#/api/system/mail/log'; import { useGridColumns, useGridFormSchema } from './data'; -const [FormModal, formModalApi] = useVbenModal({ - connectedComponent: Form, +const [DetailModal, detailModalApi] = useVbenModal({ + connectedComponent: Detail, destroyOnClose: true, }); @@ -22,7 +22,7 @@ function onRefresh() { /** 查看邮件日志 */ function onView(row: SystemMailLogApi.SystemMailLog) { - formModalApi.setData(row).open(); + detailModalApi.setData(row).open(); } /** 表格操作按钮的回调函数 */ @@ -69,7 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({