From c0317477c1d9d19fa3a01b92bab3a6982277696b Mon Sep 17 00:00:00 2001 From: puhui999 Date: Thu, 3 Apr 2025 23:33:23 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E9=82=AE=E4=BB=B6=E6=A8=A1?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/mail/template/index.ts | 2 +- .../src/views/system/mail/template/data.ts | 230 ++++++++++++++++++ .../src/views/system/mail/template/index.vue | 136 +++++++++++ .../system/mail/template/modules/form.vue | 84 +++++++ .../mail/template/modules/send-form.vue | 109 +++++++++ 5 files changed, 560 insertions(+), 1 deletion(-) create mode 100644 apps/web-antd/src/views/system/mail/template/data.ts create mode 100644 apps/web-antd/src/views/system/mail/template/index.vue create mode 100644 apps/web-antd/src/views/system/mail/template/modules/form.vue create mode 100644 apps/web-antd/src/views/system/mail/template/modules/send-form.vue diff --git a/apps/web-antd/src/api/system/mail/template/index.ts b/apps/web-antd/src/api/system/mail/template/index.ts index bf85bab97..a57f9fed3 100644 --- a/apps/web-antd/src/api/system/mail/template/index.ts +++ b/apps/web-antd/src/api/system/mail/template/index.ts @@ -11,7 +11,7 @@ export namespace SystemMailTemplateApi { nickname: string; title: string; content: string; - params: string; + params: string[]; status: number; remark: string; createTime: Date; diff --git a/apps/web-antd/src/views/system/mail/template/data.ts b/apps/web-antd/src/views/system/mail/template/data.ts new file mode 100644 index 000000000..ce1a750dc --- /dev/null +++ b/apps/web-antd/src/views/system/mail/template/data.ts @@ -0,0 +1,230 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { SystemMailTemplateApi } from '#/api/system/mail/template'; + +import { z } from '#/adapter/form'; +import { getSimpleMailAccountList } from '#/api/system/mail/account'; +import { CommonStatusEnum } from '#/utils/constants'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + label: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '模板名称', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'code', + label: '模板编码', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'accountId', + label: '邮箱账号', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleMailAccountList(), + class: 'w-full', + labelField: 'mail', + valueField: 'id', + }, + rules: 'required', + }, + { + fieldName: 'nickname', + label: '发送人名称', + component: 'Input', + }, + { + fieldName: 'title', + label: '模板标题', + component: 'Input', + rules: 'required', + }, + // TODO puhui999: 富文本组件缺失 + { + fieldName: 'content', + label: '模板内容', + component: 'Editor', + componentProps: { + height: 300, + }, + rules: 'required', + }, + { + fieldName: 'status', + label: '开启状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'status', + label: '开启状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + { + fieldName: 'code', + label: '模板编码', + component: 'Input', + }, + { + fieldName: 'name', + label: '模板名称', + component: 'Input', + }, + { + fieldName: 'accountId', + label: '邮箱账号', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleMailAccountList(), + labelField: 'mail', + valueField: 'id', + allowClear: true, + }, + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + ]; +} + +/** 发送邮件表单 */ +export function useSendMailFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'mail', + label: '收件邮箱', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'templateParams', + label: '模板参数', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'name', + title: '模板名称', + minWidth: 120, + }, + { + field: 'code', + title: '模板编码', + minWidth: 120, + }, + { + field: 'title', + title: '模板标题', + minWidth: 120, + }, + { + field: 'accountId', + title: '邮箱账号', + minWidth: 120, + }, + { + field: 'nickname', + title: '发送人名称', + minWidth: 120, + }, + { + field: 'status', + title: '开启状态', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'operation', + title: '操作', + minWidth: 300, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'name', + nameTitle: '邮件模板', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + 'edit', // 默认的编辑按钮 + 'delete', // 默认的删除按钮 + { + code: 'mail-send', + text: '发送邮件', + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/mail/template/index.vue b/apps/web-antd/src/views/system/mail/template/index.vue new file mode 100644 index 000000000..f1c83b910 --- /dev/null +++ b/apps/web-antd/src/views/system/mail/template/index.vue @@ -0,0 +1,136 @@ + + diff --git a/apps/web-antd/src/views/system/mail/template/modules/form.vue b/apps/web-antd/src/views/system/mail/template/modules/form.vue new file mode 100644 index 000000000..a05cfd9c2 --- /dev/null +++ b/apps/web-antd/src/views/system/mail/template/modules/form.vue @@ -0,0 +1,84 @@ + + + diff --git a/apps/web-antd/src/views/system/mail/template/modules/send-form.vue b/apps/web-antd/src/views/system/mail/template/modules/send-form.vue new file mode 100644 index 000000000..8c5c6a89c --- /dev/null +++ b/apps/web-antd/src/views/system/mail/template/modules/send-form.vue @@ -0,0 +1,109 @@ + + + From 30d9fc388e17789e8e63b969fa845ea8987432d3 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Thu, 3 Apr 2025 23:36:02 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E9=82=AE=E4=BB=B6=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/mail/log/data.ts | 167 ++++++++++++++++++ .../src/views/system/mail/log/index.vue | 105 +++++++++++ .../views/system/mail/log/modules/form.vue | 111 ++++++++++++ 3 files changed, 383 insertions(+) create mode 100644 apps/web-antd/src/views/system/mail/log/data.ts create mode 100644 apps/web-antd/src/views/system/mail/log/index.vue create mode 100644 apps/web-antd/src/views/system/mail/log/modules/form.vue diff --git a/apps/web-antd/src/views/system/mail/log/data.ts b/apps/web-antd/src/views/system/mail/log/data.ts new file mode 100644 index 000000000..6a383bb04 --- /dev/null +++ b/apps/web-antd/src/views/system/mail/log/data.ts @@ -0,0 +1,167 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { SystemMailLogApi } from '#/api/system/mail/log'; + +import { getSimpleMailAccountList } from '#/api/system/mail/account'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'toMail', + label: '收件邮箱', + component: 'Input', + }, + { + fieldName: 'accountId', + label: '邮箱账号', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleMailAccountList(), + labelField: 'mail', + valueField: 'id', + allowClear: true, + }, + }, + { + fieldName: 'templateId', + label: '模板编号', + component: 'Input', + }, + { + fieldName: 'sendStatus', + label: '发送状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_MAIL_SEND_STATUS, 'number'), + }, + }, + { + fieldName: 'sendTime', + label: '发送时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + { + fieldName: 'userId', + label: '用户编号', + component: 'Input', + }, + { + fieldName: 'userType', + label: '用户类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.USER_TYPE, 'number'), + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'toMail', + title: '收件邮箱', + minWidth: 120, + }, + { + field: 'fromMail', + title: '发送邮箱', + minWidth: 120, + }, + { + field: 'templateTitle', + title: '邮件标题', + minWidth: 120, + }, + { + field: 'templateContent', + title: '邮件内容', + minWidth: 300, + }, + { + field: 'sendStatus', + title: '发送状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS }, + }, + }, + { + field: 'sendTime', + title: '发送时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'templateId', + title: '模板编号', + minWidth: 100, + }, + { + field: 'templateCode', + title: '模板编码', + minWidth: 120, + }, + { + field: 'userId', + title: '用户编号', + minWidth: 100, + }, + { + field: 'userType', + title: '用户类型', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.USER_TYPE }, + }, + }, + { + field: 'operation', + title: '操作', + minWidth: 120, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'toMail', + nameTitle: '邮件日志', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'view', + text: '查看', + }, + { + code: 'resend', + text: '重发', + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/mail/log/index.vue b/apps/web-antd/src/views/system/mail/log/index.vue new file mode 100644 index 000000000..42f9be14e --- /dev/null +++ b/apps/web-antd/src/views/system/mail/log/index.vue @@ -0,0 +1,105 @@ + + diff --git a/apps/web-antd/src/views/system/mail/log/modules/form.vue b/apps/web-antd/src/views/system/mail/log/modules/form.vue new file mode 100644 index 000000000..53090048a --- /dev/null +++ b/apps/web-antd/src/views/system/mail/log/modules/form.vue @@ -0,0 +1,111 @@ + + + + + From 8ecb0bca39d5cb6b221e2fb4eeecff400bc74e85 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Thu, 3 Apr 2025 23:39:31 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=E9=82=AE=E7=AE=B1=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/mail/account/data.ts | 191 ++++++++++++++++++ .../src/views/system/mail/account/index.vue | 143 +++++++++++++ .../system/mail/account/modules/form.vue | 84 ++++++++ 3 files changed, 418 insertions(+) create mode 100644 apps/web-antd/src/views/system/mail/account/data.ts create mode 100644 apps/web-antd/src/views/system/mail/account/index.vue create mode 100644 apps/web-antd/src/views/system/mail/account/modules/form.vue diff --git a/apps/web-antd/src/views/system/mail/account/data.ts b/apps/web-antd/src/views/system/mail/account/data.ts new file mode 100644 index 000000000..9a9183925 --- /dev/null +++ b/apps/web-antd/src/views/system/mail/account/data.ts @@ -0,0 +1,191 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { SystemMailAccountApi } from '#/api/system/mail/account'; + +import { z } from '#/adapter/form'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + label: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'mail', + label: '邮箱', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'username', + label: '用户名', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'password', + label: '密码', + component: 'InputPassword', + rules: 'required', + }, + { + fieldName: 'host', + label: 'SMTP 服务器域名', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'port', + label: 'SMTP 服务器端口', + component: 'InputNumber', + componentProps: { + min: 0, + max: 65_535, + }, + rules: 'required', + }, + { + fieldName: 'sslEnable', + label: '是否开启 SSL', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.boolean().default(true), + }, + { + fieldName: 'starttlsEnable', + label: '是否开启 STARTTLS', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.boolean().default(false), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'mail', + label: '邮箱', + component: 'Input', + }, + { + fieldName: 'username', + label: '用户名', + component: 'Input', + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'mail', + title: '邮箱', + minWidth: 120, + }, + { + field: 'username', + title: '用户名', + minWidth: 120, + }, + { + field: 'host', + title: 'SMTP 服务器域名', + minWidth: 150, + }, + { + field: 'port', + title: 'SMTP 服务器端口', + minWidth: 120, + }, + { + field: 'sslEnable', + title: '是否开启 SSL', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, + }, + }, + { + field: 'starttlsEnable', + title: '是否开启 STARTTLS', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, + }, + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'operation', + title: '操作', + minWidth: 220, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'mail', + nameTitle: '邮箱账号', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + 'edit', // 默认的编辑按钮 + 'delete', // 默认的删除按钮 + { + code: 'test', + text: '测试连接', + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/mail/account/index.vue b/apps/web-antd/src/views/system/mail/account/index.vue new file mode 100644 index 000000000..9b33037e4 --- /dev/null +++ b/apps/web-antd/src/views/system/mail/account/index.vue @@ -0,0 +1,143 @@ + + diff --git a/apps/web-antd/src/views/system/mail/account/modules/form.vue b/apps/web-antd/src/views/system/mail/account/modules/form.vue new file mode 100644 index 000000000..7033967da --- /dev/null +++ b/apps/web-antd/src/views/system/mail/account/modules/form.vue @@ -0,0 +1,84 @@ + + + From 28d1df74ad01fd7f1ae657bbb5de76201e2b8340 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 4 Apr 2025 12:37:12 +0800 Subject: [PATCH 4/9] =?UTF-8?q?refactor:=20=E7=9F=AD=E4=BF=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/sms/channel/index.ts | 8 +- apps/web-antd/src/api/system/sms/log/index.ts | 13 +- .../src/api/system/sms/template/index.ts | 16 +- .../web-antd/src/views/system/sms/log/data.ts | 6 +- .../src/views/system/sms/log/index.vue | 18 +- .../src/views/system/sms/log/modules/form.vue | 170 ++++++++---------- .../src/views/system/sms/template/data.ts | 14 +- .../system/sms/template/modules/send-form.vue | 19 +- 8 files changed, 141 insertions(+), 123 deletions(-) diff --git a/apps/web-antd/src/api/system/sms/channel/index.ts b/apps/web-antd/src/api/system/sms/channel/index.ts index e4ee25749..56890bea5 100644 --- a/apps/web-antd/src/api/system/sms/channel/index.ts +++ b/apps/web-antd/src/api/system/sms/channel/index.ts @@ -27,12 +27,16 @@ export function getSmsChannelPage(params: PageParam) { /** 获得短信渠道精简列表 */ export function getSimpleSmsChannelList() { - return requestClient.get('/system/sms-channel/simple-list'); + return requestClient.get( + '/system/sms-channel/simple-list', + ); } /** 查询短信渠道详情 */ export function getSmsChannel(id: number) { - return requestClient.get(`/system/sms-channel/get?id=${id}`); + return requestClient.get( + `/system/sms-channel/get?id=${id}`, + ); } /** 新增短信渠道 */ diff --git a/apps/web-antd/src/api/system/sms/log/index.ts b/apps/web-antd/src/api/system/sms/log/index.ts index cf0845800..8344f9932 100644 --- a/apps/web-antd/src/api/system/sms/log/index.ts +++ b/apps/web-antd/src/api/system/sms/log/index.ts @@ -4,7 +4,7 @@ import { requestClient } from '#/api/request'; export namespace SystemSmsLogApi { /** 短信日志信息 */ - export interface SmsLogVO { + export interface SmsLog { id?: number; channelId?: number; channelCode: string; @@ -18,22 +18,25 @@ export namespace SystemSmsLogApi { userId?: number; userType?: number; sendStatus?: number; - sendTime?: Date; + sendTime?: string; apiSendCode: string; apiSendMsg: string; apiRequestId: string; apiSerialNo: string; receiveStatus?: number; - receiveTime?: Date; + receiveTime?: string; apiReceiveCode: string; apiReceiveMsg: string; - createTime?: Date; + createTime: string; } } /** 查询短信日志列表 */ export function getSmsLogPage(params: PageParam) { - return requestClient.get>('/system/sms-log/page', { params }); + return requestClient.get>( + '/system/sms-log/page', + { params }, + ); } /** 导出短信日志 */ diff --git a/apps/web-antd/src/api/system/sms/template/index.ts b/apps/web-antd/src/api/system/sms/template/index.ts index 808d98e32..0ea7425a1 100644 --- a/apps/web-antd/src/api/system/sms/template/index.ts +++ b/apps/web-antd/src/api/system/sms/template/index.ts @@ -1,4 +1,4 @@ -import type { PageResult } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; @@ -20,7 +20,7 @@ export namespace SystemSmsTemplateApi { } /** 发送短信请求 */ - export interface SmsSendReqVO { + export interface SmsSendReq { mobile: string; templateCode: string; templateParams: Record; @@ -28,7 +28,7 @@ export namespace SystemSmsTemplateApi { } /** 查询短信模板列表 */ -export function getSmsTemplatePage(params: any) { +export function getSmsTemplatePage(params: PageParam) { return requestClient.get>( '/system/sms-template/page', { params }, @@ -37,7 +37,9 @@ export function getSmsTemplatePage(params: any) { /** 查询短信模板详情 */ export function getSmsTemplate(id: number) { - return requestClient.get(`/system/sms-template/get?id=${id}`); + return requestClient.get( + `/system/sms-template/get?id=${id}`, + ); } /** 新增短信模板 */ @@ -57,10 +59,12 @@ export function deleteSmsTemplate(id: number) { /** 导出短信模板 */ export function exportSmsTemplate(params: any) { - return requestClient.download('/system/sms-template/export-excel', { params }); + return requestClient.download('/system/sms-template/export-excel', { + params, + }); } /** 发送短信 */ -export function sendSms(data: SystemSmsTemplateApi.SmsSendReqVO) { +export function sendSms(data: SystemSmsTemplateApi.SmsSendReq) { return requestClient.post('/system/sms-template/send-sms', data); } diff --git a/apps/web-antd/src/views/system/sms/log/data.ts b/apps/web-antd/src/views/system/sms/log/data.ts index 76a24000c..019b04dee 100644 --- a/apps/web-antd/src/views/system/sms/log/data.ts +++ b/apps/web-antd/src/views/system/sms/log/data.ts @@ -15,7 +15,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { allowClear: true, placeholder: '请输入手机号', - } + }, }, { fieldName: 'channelId', @@ -36,7 +36,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { allowClear: true, placeholder: '请输入模板编号', - } + }, }, { fieldName: 'sendStatus', @@ -80,7 +80,7 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns( +export function useGridColumns( onActionClick: OnActionClickFn, ): VxeTableGridOptions['columns'] { return [ diff --git a/apps/web-antd/src/views/system/sms/log/index.vue b/apps/web-antd/src/views/system/sms/log/index.vue index 247539578..2a4f58c22 100644 --- a/apps/web-antd/src/views/system/sms/log/index.vue +++ b/apps/web-antd/src/views/system/sms/log/index.vue @@ -1,18 +1,22 @@ diff --git a/apps/web-antd/src/views/system/sms/log/modules/form.vue b/apps/web-antd/src/views/system/sms/log/modules/form.vue index 61ec2abd2..3fdae816d 100644 --- a/apps/web-antd/src/views/system/sms/log/modules/form.vue +++ b/apps/web-antd/src/views/system/sms/log/modules/form.vue @@ -1,11 +1,16 @@ - - - diff --git a/apps/web-antd/src/views/system/sms/template/data.ts b/apps/web-antd/src/views/system/sms/template/data.ts index 4725db770..4bf751a5f 100644 --- a/apps/web-antd/src/views/system/sms/template/data.ts +++ b/apps/web-antd/src/views/system/sms/template/data.ts @@ -95,7 +95,7 @@ export function useFormSchema(): VbenFormSchema[] { component: 'Textarea', componentProps: { placeholder: '请输入备注', - } + }, }, ]; } @@ -130,7 +130,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { allowClear: true, placeholder: '请输入模板编码', - } + }, }, { fieldName: 'name', @@ -139,7 +139,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { allowClear: true, placeholder: '请输入模板名称', - } + }, }, { fieldName: 'channelId', @@ -168,6 +168,14 @@ export function useGridFormSchema(): VbenFormSchema[] { /** 发送短信表单 */ export function useSendSmsFormSchema(): VbenFormSchema[] { return [ + { + fieldName: 'content', + label: '模板内容', + component: 'Textarea', + componentProps: { + disabled: true, + }, + }, { fieldName: 'mobile', label: '手机号码', diff --git a/apps/web-antd/src/views/system/sms/template/modules/send-form.vue b/apps/web-antd/src/views/system/sms/template/modules/send-form.vue index 0f67bb6a9..d31d1edee 100644 --- a/apps/web-antd/src/views/system/sms/template/modules/send-form.vue +++ b/apps/web-antd/src/views/system/sms/template/modules/send-form.vue @@ -1,10 +1,12 @@ From 3d692a583da1178e015bd1b7b13a9dd35a88a8c6 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 4 Apr 2025 12:54:03 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E9=82=AE=E7=AE=B1=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/mail/account/index.ts | 41 +++--- .../web-antd/src/api/system/mail/log/index.ts | 24 ++-- .../src/api/system/mail/template/index.ts | 37 ++--- .../src/views/system/mail/account/data.ts | 2 +- .../src/views/system/mail/account/index.vue | 10 +- .../system/mail/account/modules/form.vue | 6 +- .../src/views/system/mail/log/data.ts | 2 +- .../src/views/system/mail/log/index.vue | 8 +- .../views/system/mail/log/modules/form.vue | 132 ++++++++---------- .../src/views/system/mail/template/data.ts | 13 +- .../src/views/system/mail/template/index.vue | 10 +- .../system/mail/template/modules/form.vue | 6 +- .../mail/template/modules/send-form.vue | 13 +- 13 files changed, 150 insertions(+), 154 deletions(-) diff --git a/apps/web-antd/src/api/system/mail/account/index.ts b/apps/web-antd/src/api/system/mail/account/index.ts index 3c6c6dc26..505670294 100644 --- a/apps/web-antd/src/api/system/mail/account/index.ts +++ b/apps/web-antd/src/api/system/mail/account/index.ts @@ -1,10 +1,10 @@ -import type { PageResult } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -// TODO @puhui999:代码风格的统一 export namespace SystemMailAccountApi { - export interface MailAccountVO { + /** 邮箱信息 */ + export interface MailAccount { id: number; mail: string; username: string; @@ -19,16 +19,17 @@ export namespace SystemMailAccountApi { } } -// 查询邮箱账号列表 -export const getMailAccountPage = async (params: any) => { - return await requestClient.get< - PageResult - >('/system/mail-account/page', { params }); +/** 查询邮箱账号列表 */ +export const getMailAccountPage = async (params: PageParam) => { + return await requestClient.get>( + '/system/mail-account/page', + { params }, + ); }; -// 查询邮箱账号详情 +/** 查询邮箱账号详情 */ export const getMailAccount = async (id: number) => { - return await requestClient.get( + return await requestClient.get( '/system/mail-account/get', { params: { id }, @@ -36,41 +37,41 @@ export const getMailAccount = async (id: number) => { ); }; -// 新增邮箱账号 +/** 新增邮箱账号 */ export const createMailAccount = async ( - data: SystemMailAccountApi.MailAccountVO, + data: SystemMailAccountApi.MailAccount, ) => { - return await requestClient.post( + return await requestClient.post( '/system/mail-account/create', data, ); }; -// 修改邮箱账号 +/** 修改邮箱账号 */ export const updateMailAccount = async ( - data: SystemMailAccountApi.MailAccountVO, + data: SystemMailAccountApi.MailAccount, ) => { - return await requestClient.put( + return await requestClient.put( '/system/mail-account/update', data, ); }; -// 删除邮箱账号 +/** 删除邮箱账号 */ export const deleteMailAccount = async (id: number) => { return await requestClient.delete('/system/mail-account/delete', { params: { id }, }); }; -// 获得邮箱账号精简列表 +/** 获得邮箱账号精简列表 */ export const getSimpleMailAccountList = async () => { - return await requestClient.get( + return await requestClient.get( '/system/mail-account/simple-list', ); }; -// 测试邮箱连接 +/** 测试邮箱连接 */ export const testMailAccount = async (id: number) => { return await requestClient.post('/system/mail-account/test', null, { params: { id }, diff --git a/apps/web-antd/src/api/system/mail/log/index.ts b/apps/web-antd/src/api/system/mail/log/index.ts index 97ef3154e..3e71d4edd 100644 --- a/apps/web-antd/src/api/system/mail/log/index.ts +++ b/apps/web-antd/src/api/system/mail/log/index.ts @@ -1,10 +1,10 @@ -import type { PageResult } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -// TODO @puhui999:代码风格的统一 export namespace SystemMailLogApi { - export interface MailLogVO { + /** 邮件日志 */ + export interface MailLog { id: number; userId: number; userType: number; @@ -18,24 +18,24 @@ export namespace SystemMailLogApi { templateContent: string; templateParams: string; sendStatus: number; - sendTime: Date; + sendTime: string; sendMessageId: string; sendException: string; - createTime: Date; + createTime: string; } } -// 查询邮件日志列表 -export const getMailLogPage = async (params: any) => { - return await requestClient.get>( +/** 查询邮件日志列表 */ +export const getMailLogPage = async (params: PageParam) => { + return await requestClient.get>( '/system/mail-log/page', { params }, ); }; -// 查询邮件日志详情 +/** 查询邮件日志详情 */ export const getMailLog = async (id: number) => { - return await requestClient.get( + return await requestClient.get( '/system/mail-log/get', { params: { id }, @@ -43,14 +43,14 @@ export const getMailLog = async (id: number) => { ); }; -// 重新发送邮件 +/** 重新发送邮件 */ export const resendMail = async (id: number) => { return await requestClient.put('/system/mail-log/resend', null, { params: { id }, }); }; -// 批量删除邮件日志 +/** 批量删除邮件日志 */ export const deleteMailLogs = async (ids: number[]) => { return await requestClient.delete('/system/mail-log/delete', { data: { ids }, diff --git a/apps/web-antd/src/api/system/mail/template/index.ts b/apps/web-antd/src/api/system/mail/template/index.ts index 144b817d2..e87f5c38f 100644 --- a/apps/web-antd/src/api/system/mail/template/index.ts +++ b/apps/web-antd/src/api/system/mail/template/index.ts @@ -1,10 +1,10 @@ -import type { PageResult } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -// TODO @puhui999:代码风格的统一 export namespace SystemMailTemplateApi { - export interface MailTemplateVO { + /** 邮件模版信息 */ + export interface MailTemplate { id: number; name: string; code: string; @@ -18,23 +18,24 @@ export namespace SystemMailTemplateApi { createTime: Date; } - export interface MailSendReqVO { + /** 邮件发送信息 */ + export interface MailSendReq { mail: string; templateCode: string; templateParams: Record; } } -// 查询邮件模版列表 -export const getMailTemplatePage = async (params: any) => { +/** 查询邮件模版列表 */ +export const getMailTemplatePage = async (params: PageParam) => { return await requestClient.get< - PageResult + PageResult >('/system/mail-template/page', { params }); }; -// 查询邮件模版详情 +/** 查询邮件模版详情 */ export const getMailTemplate = async (id: number) => { - return await requestClient.get( + return await requestClient.get( '/system/mail-template/get', { params: { id }, @@ -42,35 +43,35 @@ export const getMailTemplate = async (id: number) => { ); }; -// 新增邮件模版 +/** 新增邮件模版 */ export const createMailTemplate = async ( - data: SystemMailTemplateApi.MailTemplateVO, + data: SystemMailTemplateApi.MailTemplate, ) => { - return await requestClient.post( + return await requestClient.post( '/system/mail-template/create', data, ); }; -// 修改邮件模版 +/** 修改邮件模版 */ export const updateMailTemplate = async ( - data: SystemMailTemplateApi.MailTemplateVO, + data: SystemMailTemplateApi.MailTemplate, ) => { - return await requestClient.put( + return await requestClient.put( '/system/mail-template/update', data, ); }; -// 删除邮件模版 +/** 删除邮件模版 */ export const deleteMailTemplate = async (id: number) => { return await requestClient.delete('/system/mail-template/delete', { params: { id }, }); }; -// 发送邮件 -export const sendMail = async (data: SystemMailTemplateApi.MailSendReqVO) => { +/** 发送邮件 */ +export const sendMail = async (data: SystemMailTemplateApi.MailSendReq) => { return await requestClient.post( '/system/mail-template/send-mail', data, diff --git a/apps/web-antd/src/views/system/mail/account/data.ts b/apps/web-antd/src/views/system/mail/account/data.ts index 9a9183925..46d28ed7a 100644 --- a/apps/web-antd/src/views/system/mail/account/data.ts +++ b/apps/web-antd/src/views/system/mail/account/data.ts @@ -106,7 +106,7 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns( +export function useGridColumns( onActionClick: OnActionClickFn, ): VxeTableGridOptions['columns'] { return [ diff --git a/apps/web-antd/src/views/system/mail/account/index.vue b/apps/web-antd/src/views/system/mail/account/index.vue index 9b33037e4..d44b313bd 100644 --- a/apps/web-antd/src/views/system/mail/account/index.vue +++ b/apps/web-antd/src/views/system/mail/account/index.vue @@ -37,12 +37,12 @@ function onCreate() { } /** 编辑邮箱账号 */ -function onEdit(row: SystemMailAccountApi.MailAccountVO) { +function onEdit(row: SystemMailAccountApi.MailAccount) { formModalApi.setData(row).open(); } /** 测试邮箱连接 */ -async function onTest(row: SystemMailAccountApi.MailAccountVO) { +async function onTest(row: SystemMailAccountApi.MailAccount) { const hideLoading = message.loading({ content: '正在测试邮箱连接...', duration: 0, @@ -60,7 +60,7 @@ async function onTest(row: SystemMailAccountApi.MailAccountVO) { } /** 删除邮箱账号 */ -async function onDelete(row: SystemMailAccountApi.MailAccountVO) { +async function onDelete(row: SystemMailAccountApi.MailAccount) { const hideLoading = message.loading({ content: $t('ui.actionMessage.deleting', [row.mail]), duration: 0, @@ -82,7 +82,7 @@ async function onDelete(row: SystemMailAccountApi.MailAccountVO) { function onActionClick({ code, row, -}: OnActionClickParams) { +}: OnActionClickParams) { switch (code) { case 'delete': { onDelete(row); @@ -125,7 +125,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ refresh: { code: 'query' }, search: true, }, - } as VxeTableGridOptions, + } as VxeTableGridOptions, });