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 5eab6fa44..dd19f4b8f 100644 --- a/apps/web-antd/src/api/system/notify/template/index.ts +++ b/apps/web-antd/src/api/system/notify/template/index.ts @@ -17,7 +17,7 @@ export namespace SystemNotifyTemplateApi { } /** 发送站内信请求 */ - export interface NotifySendReq { + export interface NotifySendReqVO { userId: number; userType: number; templateCode: string; @@ -74,6 +74,6 @@ export function exportNotifyTemplate(params: any) { } /** 发送站内信 */ -export function sendNotify(data: SystemNotifyTemplateApi.NotifySendReq) { +export function sendNotify(data: SystemNotifyTemplateApi.NotifySendReqVO) { return requestClient.post('/system/notify-template/send-notify', data); } diff --git a/apps/web-antd/src/views/system/notify/template/data.ts b/apps/web-antd/src/views/system/notify/template/data.ts index 4a251c243..d22b16ce9 100644 --- a/apps/web-antd/src/views/system/notify/template/data.ts +++ b/apps/web-antd/src/views/system/notify/template/data.ts @@ -1,14 +1,13 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; -import { CommonStatusEnum, UserTypeEnum } from '@vben/constants'; +import { CommonStatusEnum, DICT_TYPE, UserTypeEnum } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; import { z } from '#/adapter/form'; import { getSimpleUserList } from '#/api/system/user'; -import { DICT_TYPE } from '@vben/constants'; -import { getDictOptions } from '@vben/hooks'; - import { getRangePickerDefaultProps } from '#/utils'; + /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { return [ @@ -178,7 +177,7 @@ export function useSendNotifyFormSchema(): VbenFormSchema[] { }, { fieldName: 'userId', - label: '接收人ID', + label: '接收人 ID', component: 'Input', componentProps: { placeholder: '请输入用户编号', @@ -228,26 +227,32 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'id', title: '编号', + minWidth: 100, }, { field: 'name', title: '模板名称', + minWidth: 120, }, { field: 'code', title: '模板编码', + minWidth: 120, }, { field: 'nickname', title: '发送人名称', + minWidth: 120, }, { field: 'content', title: '模板内容', + minWidth: 200, }, { field: 'type', title: '模板类型', + minWidth: 120, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE }, @@ -256,6 +261,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'status', title: '状态', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.COMMON_STATUS }, @@ -264,10 +270,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'remark', title: '备注', + minWidth: 120, }, { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { diff --git a/apps/web-antd/src/views/system/notify/template/index.vue b/apps/web-antd/src/views/system/notify/template/index.vue index 3cba166ff..c019b54c7 100644 --- a/apps/web-antd/src/views/system/notify/template/index.vue +++ b/apps/web-antd/src/views/system/notify/template/index.vue @@ -4,7 +4,7 @@ import type { SystemNotifyTemplateApi } from '#/api/system/notify/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: SystemNotifyTemplateApi.NotifyTemplate) { async function handleDelete(row: SystemNotifyTemplateApi.NotifyTemplate) { const hideLoading = message.loading({ content: $t('ui.actionMessage.deleting', [row.name]), - key: 'action_key_msg', + duration: 0, }); try { await deleteNotifyTemplate(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 deleteNotifyTemplateList(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 deleteNotifyTemplateList(checkedIds.value); - checkedIds.value = []; - message.success($t('ui.actionMessage.deleteSuccess')); - onRefresh(); - } finally { - hideLoading(); - } -} - const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), @@ -140,10 +137,10 @@ const [Grid, gridApi] = useVbenVxeGrid({