reactor:【system 系统管理】notice 在 ele 和 antd 的代码一致性

This commit is contained in:
YunaiV
2025-09-04 21:31:24 +08:00
parent cf8745d844
commit a153a86142
6 changed files with 82 additions and 103 deletions

View File

@@ -92,14 +92,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'id',
title: '公告编号',
minWidth: 100,
},
{
field: 'title',
title: '公告标题',
minWidth: 200,
},
{
field: 'type',
title: '公告类型',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.SYSTEM_NOTICE_TYPE },
@@ -108,6 +111,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'status',
title: '公告状态',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
@@ -116,6 +120,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'createTime',
title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{

View File

@@ -4,7 +4,7 @@ import type { SystemNoticeApi } from '#/api/system/notice';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -45,14 +45,11 @@ function handleEdit(row: SystemNoticeApi.Notice) {
async function handleDelete(row: SystemNoticeApi.Notice) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.title]),
key: 'action_key_msg',
duration: 0,
});
try {
await deleteNotice(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.title]),
key: 'action_key_msg',
});
message.success($t('ui.actionMessage.deleteSuccess', [row.title]));
onRefresh();
} finally {
hideLoading();
@@ -61,10 +58,10 @@ async function handleDelete(row: SystemNoticeApi.Notice) {
/** 批量删除公告 */
async function handleDeleteBatch() {
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting'),
content: $t('ui.actionMessage.deletingBatch'),
duration: 0,
key: 'action_process_msg',
});
try {
await deleteNoticeList(checkedIds.value);
@@ -82,21 +79,17 @@ function handleRowCheckboxChange({
}: {
records: SystemNoticeApi.Notice[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 推送公告 */
async function handlePush(row: SystemNoticeApi.Notice) {
const hideLoading = message.loading({
content: '正在推送中',
key: 'action_process_msg',
content: '正在推送中...',
});
try {
await pushNotice(row.id as number);
message.success({
content: $t('ui.actionMessage.operationSuccess'),
key: 'action_key_msg',
});
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
hideLoading();
}
@@ -152,12 +145,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
onClick: handleCreate,
},
{
label: '批量删除',
label: $t('ui.actionTitle.deleteBatch'),
type: 'primary',
danger: true,
disabled: isEmpty(checkedIds),
icon: ACTION_ICON.DELETE,
auth: ['system:notice:delete'],
disabled: isEmpty(checkedIds),
onClick: handleDeleteBatch,
},
]"