feat: add delete
parent
02795947ca
commit
7811e0c2e4
|
@ -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),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue