From 77062cb3911eb1c9c0f8a81bd4119ce81457ff18 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 2 Nov 2024 16:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=91=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=9A=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20sort=20=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/bpm/category/index.ts | 10 +++++++ .../bpm/model/CategoryDraggableModel.vue | 6 ++-- src/views/bpm/model/index.vue | 29 +++++++++++-------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/api/bpm/category/index.ts b/src/api/bpm/category/index.ts index d1e109cb..1854f31c 100644 --- a/src/api/bpm/category/index.ts +++ b/src/api/bpm/category/index.ts @@ -36,6 +36,16 @@ export const CategoryApi = { return await request.put({ url: `/bpm/category/update`, data }) }, + // 批量修改流程分类的排序 + updateCategorySortBatch: async (ids: number[]) => { + return await request.put({ + url: `/bpm/category/update-sort-batch`, + params: { + ids: ids.join(',') + } + }) + }, + // 删除流程分类 deleteCategory: async (id: number) => { return await request.delete({ url: `/bpm/category/delete?id=` + id }) diff --git a/src/views/bpm/model/CategoryDraggableModel.vue b/src/views/bpm/model/CategoryDraggableModel.vue index 451365a2..db08aa58 100644 --- a/src/views/bpm/model/CategoryDraggableModel.vue +++ b/src/views/bpm/model/CategoryDraggableModel.vue @@ -465,13 +465,13 @@ const handleRenameConfirm = async () => { } // 发起修改 await CategoryApi.updateCategory(renameCategoryForm.value as CategoryVO) - message.success('修改成功') + message.success('重命名成功') // 刷新列表 renameCategoryVisible.value = false emit('success') } -// 删除分类 +/** 删除分类 */ const handleDeleteCategory = async () => { try { if (props.categoryInfo.modelList.length > 0) { @@ -486,7 +486,7 @@ const handleDeleteCategory = async () => { } catch {} } -// 添加流程模型弹窗 +/** 添加流程模型弹窗 */ const modelFormRef = ref() const openModelForm = (type: string, id?: number) => { modelFormRef.value.open(type, id) diff --git a/src/views/bpm/model/index.vue b/src/views/bpm/model/index.vue index 1eb41485..aad4d5c4 100644 --- a/src/views/bpm/model/index.vue +++ b/src/views/bpm/model/index.vue @@ -52,8 +52,8 @@
- 取 消 - 保存排序 + 取 消 + 保存排序
@@ -106,7 +106,7 @@ import CategoryDraggableModel from './CategoryDraggableModel.vue' defineOptions({ name: 'BpmModel' }) -const categoryFormRef = ref() +const message = useMessage() // 消息弹窗 const loading = ref(true) // 列表的加载中 const isCategorySorting = ref(false) // 是否 category 正处于排序状态 const queryParams = reactive({ @@ -161,7 +161,7 @@ const handleCommand = (command: string) => { handleAddCategory() break case 'handleSort': - handleSort() + handleCategorySort() break default: break @@ -169,29 +169,34 @@ const handleCommand = (command: string) => { } /** 新建分类 */ +const categoryFormRef = ref() const handleAddCategory = () => { categoryFormRef.value.open('create') } -// TODO 芋艿:需要实现 -/** 分类排序 */ -const handleSort = () => { +/** 分类排序的提交 */ +const handleCategorySort = () => { // 保存初始数据 originalData.value = cloneDeep(categoryGroup.value) isCategorySorting.value = true } -// TODO 芋艿:需要实现 -/** 取消排序 */ -const cancelSort = () => { +/** 分类排序的取消 */ +const handleCategorySortCancel = () => { // 恢复初始数据 categoryGroup.value = cloneDeep(originalData.value) isCategorySorting.value = false } /** 保存排序 */ -const saveSort = () => { - // TODO 芋艿:这里需要一个保存分类排序接口 +const handleCategorySortSubmit = async () => { + // 保存排序 + const ids = categoryGroup.value.map((item: any) => item.id) + await CategoryApi.updateCategorySortBatch(ids) + // 刷新列表 + isCategorySorting.value = false + message.success('排序分类成功') + await getList() } /** 加载数据 */