feat(recycle-bin): 实现回收站功能
- 在数据库中添加逻辑删除字段和相关索引- 新增回收站相关实体类和接口 - 实现回收站列表查询、项目恢复、永久删除和清空回收站等功能 - 前端集成回收站接口,支持回收站页面操作
This commit is contained in:
@@ -120,10 +120,10 @@ export const MD5 = (data, file) => {
|
||||
export const getTrash = () => axiosApi.get('/api/trash');
|
||||
|
||||
// 恢复项目
|
||||
export const restoreTrashItem = (id) => axiosApi.post(`/api/trash/restore/${id}`);
|
||||
export const restoreTrashItem = (id, type) => axiosApi.post(`/api/trash/restore/${type}/${id}`);
|
||||
|
||||
// 彻底删除
|
||||
export const permanentlyDeleteItem = (id) => axiosApi.delete(`/api/trash/permanently/${id}`);
|
||||
export const permanentlyDeleteItem = (id, type) => axiosApi.delete(`/api/trash/permanently/${type}/${id}`);
|
||||
|
||||
// 清空回收站
|
||||
export const cleanTrash = () => axiosApi.delete('/api/trash/clean');
|
||||
|
||||
@@ -48,7 +48,7 @@ const fetchTrashItems = async () => {
|
||||
|
||||
const handleRestore = async (item) => {
|
||||
try {
|
||||
await restoreTrashItem(item.id);
|
||||
await restoreTrashItem(item.id, item.type);
|
||||
ElMessage.success('恢复成功');
|
||||
fetchTrashItems();
|
||||
} catch (error) {
|
||||
@@ -63,7 +63,7 @@ const handleDeletePermanently = async (item) => {
|
||||
type: 'warning',
|
||||
});
|
||||
try {
|
||||
await permanentlyDeleteItem(item.id);
|
||||
await permanentlyDeleteItem(item.id, item.type);
|
||||
ElMessage.success('已永久删除');
|
||||
fetchTrashItems();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user