feat: add delete

dev-v5
xingyu4j 2024-12-18 15:05:08 +08:00
parent 02795947ca
commit 7811e0c2e4
1 changed files with 15 additions and 6 deletions

View File

@ -8,7 +8,12 @@ import { $t } from '@vben/locales';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; 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 { ActionButtons, IconEnum } from '#/components/action-buttons';
import { columns, formSchema } from './post.data'; import { columns, formSchema } from './post.data';
@ -62,9 +67,10 @@ async function handleEdit(id: number) {
formModalApi.setData({ id }); formModalApi.setData({ id });
formModalApi.open(); formModalApi.open();
} }
// TODO async function handleDelete(id: number) {
function handleDelete(id: number) { await deletePost(id);
message.success(id); message.success('删除成功');
tableApi.query();
} }
// TODO // TODO
async function handleExport() { async function handleExport() {
@ -107,12 +113,15 @@ async function handleExport() {
onClick: handleEdit.bind(null, row.id), onClick: handleEdit.bind(null, row.id),
}, },
{ {
popConfirm: {
title: $t('page.action.delete'),
icon: IconEnum.DELETE,
confirm: handleDelete.bind(null, row.id),
},
type: 'link', type: 'link',
danger: true, danger: true,
label: $t('page.action.delete'), label: $t('page.action.delete'),
icon: IconEnum.DELETE,
auth: ['system:post:delete'], auth: ['system:post:delete'],
onClick: handleDelete.bind(null, row.id),
}, },
]" ]"
/> />