From 3d634b8cc4c2438a6d7d2193bce1c3315afb3a0e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 3 Apr 2025 22:56:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9A=E4=BC=98=E5=8C=96=20sms=20?= =?UTF-8?q?=E7=9F=AD=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/mail/account/index.ts | 1 + .../web-antd/src/api/system/mail/log/index.ts | 1 + .../src/api/system/mail/template/index.ts | 1 + .../src/api/system/sms/channel/index.ts | 20 ++++----- apps/web-antd/src/api/system/sms/log/index.ts | 9 ++-- .../src/api/system/sms/template/index.ts | 20 ++++----- .../src/views/system/dept/modules/form.vue | 2 +- .../src/views/system/menu/modules/form.vue | 2 +- .../src/views/system/post/modules/form.vue | 2 +- .../modules/assign-data-permission-form.vue | 2 +- .../system/role/modules/assign-menu-form.vue | 2 +- .../src/views/system/role/modules/form.vue | 2 +- .../src/views/system/sms/channel/data.ts | 27 ++++++++++-- .../src/views/system/sms/channel/index.vue | 34 ++++++-------- .../views/system/sms/channel/modules/form.vue | 28 +++++------- .../web-antd/src/views/system/sms/log/data.ts | 17 ++++++- .../src/views/system/sms/log/index.vue | 10 ++--- .../src/views/system/sms/log/modules/form.vue | 23 +++++----- .../src/views/system/sms/template/data.ts | 44 ++++++++++++++++--- .../src/views/system/sms/template/index.vue | 36 ++++++--------- .../system/sms/template/modules/form.vue | 23 +++++----- .../system/sms/template/modules/send-form.vue | 19 +++----- .../src/views/system/tenant/modules/form.vue | 2 +- apps/web-antd/src/views/system/user/data.ts | 43 +++++++++++++++--- .../src/views/system/user/modules/form.vue | 2 +- 25 files changed, 213 insertions(+), 159 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 5c03f4f9b..3c6c6dc26 100644 --- a/apps/web-antd/src/api/system/mail/account/index.ts +++ b/apps/web-antd/src/api/system/mail/account/index.ts @@ -2,6 +2,7 @@ import type { PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; +// TODO @puhui999:代码风格的统一 export namespace SystemMailAccountApi { export interface MailAccountVO { id: number; 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 505ba471e..97ef3154e 100644 --- a/apps/web-antd/src/api/system/mail/log/index.ts +++ b/apps/web-antd/src/api/system/mail/log/index.ts @@ -2,6 +2,7 @@ import type { PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; +// TODO @puhui999:代码风格的统一 export namespace SystemMailLogApi { export interface MailLogVO { id: number; 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..2cfd697b7 100644 --- a/apps/web-antd/src/api/system/mail/template/index.ts +++ b/apps/web-antd/src/api/system/mail/template/index.ts @@ -2,6 +2,7 @@ import type { PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; +// TODO @puhui999:代码风格的统一 export namespace SystemMailTemplateApi { export interface MailTemplateVO { id: number; 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 93be7aca7..e4ee25749 100644 --- a/apps/web-antd/src/api/system/sms/channel/index.ts +++ b/apps/web-antd/src/api/system/sms/channel/index.ts @@ -1,10 +1,10 @@ -import type { PageResult } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; export namespace SystemSmsChannelApi { /** 短信渠道信息 */ - export interface SmsChannelVO { + export interface SmsChannel { id?: number; code: string; status: number; @@ -18,8 +18,8 @@ export namespace SystemSmsChannelApi { } /** 查询短信渠道列表 */ -export function getSmsChannelPage(params: any) { - return requestClient.get>( +export function getSmsChannelPage(params: PageParam) { + return requestClient.get>( '/system/sms-channel/page', { params }, ); @@ -27,25 +27,21 @@ export function getSmsChannelPage(params: any) { /** 获得短信渠道精简列表 */ 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}`); } /** 新增短信渠道 */ -export function createSmsChannel(data: SystemSmsChannelApi.SmsChannelVO) { +export function createSmsChannel(data: SystemSmsChannelApi.SmsChannel) { return requestClient.post('/system/sms-channel/create', data); } /** 修改短信渠道 */ -export function updateSmsChannel(data: SystemSmsChannelApi.SmsChannelVO) { +export function updateSmsChannel(data: SystemSmsChannelApi.SmsChannel) { return requestClient.put('/system/sms-channel/update', data); } 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 e4aa01796..cf0845800 100644 --- a/apps/web-antd/src/api/system/sms/log/index.ts +++ b/apps/web-antd/src/api/system/sms/log/index.ts @@ -1,4 +1,4 @@ -import type { PageResult } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; @@ -32,11 +32,8 @@ export namespace SystemSmsLogApi { } /** 查询短信日志列表 */ -export function getSmsLogPage(params: any) { - return requestClient.get>( - '/system/sms-log/page', - { params }, - ); +export function getSmsLogPage(params: PageParam) { + 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 336398474..808d98e32 100644 --- a/apps/web-antd/src/api/system/sms/template/index.ts +++ b/apps/web-antd/src/api/system/sms/template/index.ts @@ -4,7 +4,7 @@ import { requestClient } from '#/api/request'; export namespace SystemSmsTemplateApi { /** 短信模板信息 */ - export interface SmsTemplateVO { + export interface SmsTemplate { id?: number; type?: number; status: number; @@ -20,7 +20,7 @@ export namespace SystemSmsTemplateApi { } /** 发送短信请求 */ - export interface SendSmsReqVO { + export interface SmsSendReqVO { mobile: string; templateCode: string; templateParams: Record; @@ -29,7 +29,7 @@ export namespace SystemSmsTemplateApi { /** 查询短信模板列表 */ export function getSmsTemplatePage(params: any) { - return requestClient.get>( + return requestClient.get>( '/system/sms-template/page', { params }, ); @@ -37,18 +37,16 @@ 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}`); } /** 新增短信模板 */ -export function createSmsTemplate(data: SystemSmsTemplateApi.SmsTemplateVO) { +export function createSmsTemplate(data: SystemSmsTemplateApi.SmsTemplate) { return requestClient.post('/system/sms-template/create', data); } /** 修改短信模板 */ -export function updateSmsTemplate(data: SystemSmsTemplateApi.SmsTemplateVO) { +export function updateSmsTemplate(data: SystemSmsTemplateApi.SmsTemplate) { return requestClient.put('/system/sms-template/update', data); } @@ -59,12 +57,10 @@ 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.SendSmsReqVO) { +export function sendSms(data: SystemSmsTemplateApi.SmsSendReqVO) { return requestClient.post('/system/sms-template/send-sms', data); } diff --git a/apps/web-antd/src/views/system/dept/modules/form.vue b/apps/web-antd/src/views/system/dept/modules/form.vue index fb07f4a35..bd535b475 100644 --- a/apps/web-antd/src/views/system/dept/modules/form.vue +++ b/apps/web-antd/src/views/system/dept/modules/form.vue @@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(false); } }, - async onOpenChange(isOpen) { + async onOpenChange(isOpen: boolean) { if (!isOpen) { return; } diff --git a/apps/web-antd/src/views/system/menu/modules/form.vue b/apps/web-antd/src/views/system/menu/modules/form.vue index b9d69ae9a..dea28470e 100644 --- a/apps/web-antd/src/views/system/menu/modules/form.vue +++ b/apps/web-antd/src/views/system/menu/modules/form.vue @@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(false); } }, - async onOpenChange(isOpen) { + async onOpenChange(isOpen: boolean) { if (!isOpen) { return; } diff --git a/apps/web-antd/src/views/system/post/modules/form.vue b/apps/web-antd/src/views/system/post/modules/form.vue index 7409289d2..f257bedad 100644 --- a/apps/web-antd/src/views/system/post/modules/form.vue +++ b/apps/web-antd/src/views/system/post/modules/form.vue @@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(false); } }, - async onOpenChange(isOpen) { + async onOpenChange(isOpen: boolean) { if (!isOpen) { return; } diff --git a/apps/web-antd/src/views/system/role/modules/assign-data-permission-form.vue b/apps/web-antd/src/views/system/role/modules/assign-data-permission-form.vue index 0267b0d6c..20baad213 100644 --- a/apps/web-antd/src/views/system/role/modules/assign-data-permission-form.vue +++ b/apps/web-antd/src/views/system/role/modules/assign-data-permission-form.vue @@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(false); } }, - async onOpenChange(isOpen) { + async onOpenChange(isOpen: boolean) { if (!isOpen) { return; } diff --git a/apps/web-antd/src/views/system/role/modules/assign-menu-form.vue b/apps/web-antd/src/views/system/role/modules/assign-menu-form.vue index 593037391..92e7e8c7b 100644 --- a/apps/web-antd/src/views/system/role/modules/assign-menu-form.vue +++ b/apps/web-antd/src/views/system/role/modules/assign-menu-form.vue @@ -54,7 +54,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(false); } }, - async onOpenChange(isOpen) { + async onOpenChange(isOpen: boolean) { if (!isOpen) { return; } diff --git a/apps/web-antd/src/views/system/role/modules/form.vue b/apps/web-antd/src/views/system/role/modules/form.vue index f8942ec59..6727141a9 100644 --- a/apps/web-antd/src/views/system/role/modules/form.vue +++ b/apps/web-antd/src/views/system/role/modules/form.vue @@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(false); } }, - async onOpenChange(isOpen) { + async onOpenChange(isOpen: boolean) { if (!isOpen) { return; } diff --git a/apps/web-antd/src/views/system/sms/channel/data.ts b/apps/web-antd/src/views/system/sms/channel/data.ts index d7cda29f7..3997eaba0 100644 --- a/apps/web-antd/src/views/system/sms/channel/data.ts +++ b/apps/web-antd/src/views/system/sms/channel/data.ts @@ -11,7 +11,6 @@ export function useFormSchema(): VbenFormSchema[] { return [ { fieldName: 'id', - label: 'id', component: 'Input', dependencies: { triggerFields: [''], @@ -22,6 +21,9 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'signature', label: '短信签名', component: 'Input', + componentProps: { + placeholder: '请输入短信签名', + }, rules: 'required', }, { @@ -29,8 +31,9 @@ export function useFormSchema(): VbenFormSchema[] { label: '渠道编码', component: 'Select', componentProps: { - class: 'w-full', options: getDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, 'string'), + class: 'w-full', + placeholder: '请选择短信渠道', }, rules: 'required', }, @@ -49,22 +52,34 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'remark', label: '备注', component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + } }, { fieldName: 'apiKey', label: '短信 API 的账号', component: 'Input', + componentProps: { + placeholder: '请输入短信 API 的账号', + }, rules: 'required', }, { fieldName: 'apiSecret', label: '短信 API 的密钥', component: 'Input', + componentProps: { + placeholder: '请输入短信 API 的密钥', + } }, { fieldName: 'callbackUrl', label: '短信发送回调 URL', component: 'Input', + componentProps: { + placeholder: '请输入短信发送回调 URL', + } }, ]; } @@ -76,6 +91,10 @@ export function useGridFormSchema(): VbenFormSchema[] { fieldName: 'signature', label: '短信签名', component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入短信签名', + } }, { fieldName: 'code', @@ -84,6 +103,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { allowClear: true, options: getDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, 'string'), + placeholder: '请选择短信渠道', }, }, { @@ -96,6 +116,7 @@ export function useGridFormSchema(): VbenFormSchema[] { }, }, { + // TODO @芋艿:怎么解决范围检索 fieldName: 'createTime', label: '创建时间', component: 'RangePicker', @@ -107,7 +128,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/channel/index.vue b/apps/web-antd/src/views/system/sms/channel/index.vue index 866ee605c..73fc3f927 100644 --- a/apps/web-antd/src/views/system/sms/channel/index.vue +++ b/apps/web-antd/src/views/system/sms/channel/index.vue @@ -1,26 +1,18 @@ diff --git a/apps/web-antd/src/views/system/sms/channel/modules/form.vue b/apps/web-antd/src/views/system/sms/channel/modules/form.vue index 3cacd6732..ccfb6a7f7 100644 --- a/apps/web-antd/src/views/system/sms/channel/modules/form.vue +++ b/apps/web-antd/src/views/system/sms/channel/modules/form.vue @@ -1,24 +1,18 @@ +