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 8f8e4c8c7..eccfb911e 100644 --- a/apps/web-antd/src/api/system/sms/template/index.ts +++ b/apps/web-antd/src/api/system/sms/template/index.ts @@ -20,7 +20,7 @@ export namespace SystemSmsTemplateApi { } /** 发送短信请求 */ - export interface SmsSendReq { + export interface SmsSendReqVO { mobile: string; templateCode: string; templateParams: Record; @@ -72,6 +72,6 @@ export function exportSmsTemplate(params: any) { } /** 发送短信 */ -export function sendSms(data: SystemSmsTemplateApi.SmsSendReq) { +export function sendSms(data: SystemSmsTemplateApi.SmsSendReqVO) { return requestClient.post('/system/sms-template/send-sms', data); } 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 701e532f1..5b5364f38 100644 --- a/apps/web-antd/src/views/system/sms/template/data.ts +++ b/apps/web-antd/src/views/system/sms/template/data.ts @@ -204,10 +204,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'id', title: '编号', + minWidth: 100, }, { field: 'type', title: '短信类型', + minWidth: 120, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE }, @@ -216,10 +218,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'name', title: '模板名称', + minWidth: 120, }, { field: 'code', title: '模板编码', + minWidth: 120, }, { field: 'content', @@ -229,6 +233,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'status', title: '开启状态', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.COMMON_STATUS }, @@ -237,10 +242,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'apiTemplateId', title: '短信 API 的模板编号', + minWidth: 180, }, { field: 'channelCode', title: '短信渠道', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE }, @@ -249,11 +256,13 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { field: 'remark', title: '备注', + minWidth: 120, }, { title: '操作', diff --git a/apps/web-antd/src/views/system/sms/template/index.vue b/apps/web-antd/src/views/system/sms/template/index.vue index 65d402cec..1ae241330 100644 --- a/apps/web-antd/src/views/system/sms/template/index.vue +++ b/apps/web-antd/src/views/system/sms/template/index.vue @@ -4,7 +4,7 @@ import type { SystemSmsTemplateApi } from '#/api/system/sms/template'; import { ref } from 'vue'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { message } from 'ant-design-vue'; @@ -33,7 +33,7 @@ const [SendModal, sendModalApi] = useVbenModal({ }); /** 刷新表格 */ -function onRefresh() { +function handleRefresh() { gridApi.query(); } @@ -62,15 +62,29 @@ function handleSend(row: SystemSmsTemplateApi.SmsTemplate) { async function handleDelete(row: SystemSmsTemplateApi.SmsTemplate) { const hideLoading = message.loading({ content: $t('ui.actionMessage.deleting', [row.name]), - key: 'action_key_msg', + duration: 0, }); try { await deleteSmsTemplate(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.name]), - key: 'action_key_msg', - }); - onRefresh(); + message.success($t('ui.actionMessage.deleteSuccess', [row.name])); + handleRefresh(); + } finally { + hideLoading(); + } +} + +/** 批量删除短信模板 */ +async function handleDeleteBatch() { + await confirm($t('ui.actionMessage.deleteBatchConfirm')); + const hideLoading = message.loading({ + content: $t('ui.actionMessage.deletingBatch'), + duration: 0, + }); + try { + await deleteSmsTemplateList(checkedIds.value); + checkedIds.value = []; + message.success($t('ui.actionMessage.deleteSuccess')); + handleRefresh(); } finally { hideLoading(); } @@ -85,23 +99,6 @@ function handleRowCheckboxChange({ checkedIds.value = records.map((item) => item.id!); } -/** 批量删除短信模板 */ -async function handleDeleteBatch() { - const hideLoading = message.loading({ - content: $t('ui.actionMessage.deleting'), - duration: 0, - key: 'action_process_msg', - }); - try { - await deleteSmsTemplateList(checkedIds.value); - checkedIds.value = []; - message.success($t('ui.actionMessage.deleteSuccess')); - onRefresh(); - } finally { - hideLoading(); - } -} - const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), @@ -143,7 +140,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ - +