From 7811e0c2e486c3a0b54b4c2adcd574220411f652 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Wed, 18 Dec 2024 15:05:08 +0800 Subject: [PATCH] feat: add delete --- apps/web-antd/src/views/system/post/index.vue | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue index 203e84aa..5386ee54 100644 --- a/apps/web-antd/src/views/system/post/index.vue +++ b/apps/web-antd/src/views/system/post/index.vue @@ -8,7 +8,12 @@ import { $t } from '@vben/locales'; import { message } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import { exportPost, getPostPage, type PostVO } from '#/api/system/post'; +import { + deletePost, + exportPost, + getPostPage, + type PostVO, +} from '#/api/system/post'; import { ActionButtons, IconEnum } from '#/components/action-buttons'; import { columns, formSchema } from './post.data'; @@ -62,9 +67,10 @@ async function handleEdit(id: number) { formModalApi.setData({ id }); formModalApi.open(); } -// TODO -function handleDelete(id: number) { - message.success(id); +async function handleDelete(id: number) { + await deletePost(id); + message.success('删除成功'); + tableApi.query(); } // TODO async function handleExport() { @@ -107,12 +113,15 @@ async function handleExport() { onClick: handleEdit.bind(null, row.id), }, { + popConfirm: { + title: $t('page.action.delete'), + icon: IconEnum.DELETE, + confirm: handleDelete.bind(null, row.id), + }, type: 'link', danger: true, label: $t('page.action.delete'), - icon: IconEnum.DELETE, auth: ['system:post:delete'], - onClick: handleDelete.bind(null, row.id), }, ]" />