diff --git a/src/modules/contents/posts/PostList.vue b/src/modules/contents/posts/PostList.vue index 25e5f609..47a4979e 100644 --- a/src/modules/contents/posts/PostList.vue +++ b/src/modules/contents/posts/PostList.vue @@ -37,7 +37,6 @@ import { apiClient } from "@halo-dev/admin-shared"; import { formatDatetime } from "@/utils/date"; import { usePostCategory } from "@/modules/contents/posts/categories/composables/use-post-category"; import { usePostTag } from "@/modules/contents/posts/tags/composables/use-post-tag"; -import cloneDeep from "lodash.clonedeep"; import { postLabels } from "@/constants/labels"; enum PostPhase { @@ -217,17 +216,32 @@ const handleDelete = async (post: Post) => { title: "是否确认删除该文章?", confirmType: "danger", onConfirm: async () => { - const postToUpdate = cloneDeep(post); - postToUpdate.spec.deleted = true; - await apiClient.extension.post.updatecontentHaloRunV1alpha1Post({ - name: postToUpdate.metadata.name, - post: postToUpdate, + await apiClient.extension.post.deletecontentHaloRunV1alpha1Post({ + name: post.metadata.name, }); await handleFetchPosts(); }, }); }; +const handleDeleteInBatch = async () => { + dialog.warning({ + title: "是否确认删除选中的文章?", + confirmType: "danger", + onConfirm: async () => { + await Promise.all( + selectedPostNames.value.map((name) => { + return apiClient.extension.post.deletecontentHaloRunV1alpha1Post({ + name, + }); + }) + ); + await handleFetchPosts(); + selectedPostNames.value.length = 0; + }, + }); +}; + watch(selectedPostNames, (newValue) => { checkedAll.value = newValue.length === posts.value.items?.length; }); @@ -445,8 +459,9 @@ function handleContributorFilterItemChange(user?: User) { - 设置 - 删除 + + 删除 +
@@ -843,6 +858,11 @@ function handleContributorFilterItemChange(user?: User) { /> + + +