From c3cf479f6f62e8abefc070149d59d83ece06bb5e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 2 Nov 2024 18:11:35 +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?=E6=A8=A1=E5=9E=8B=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20sort=20=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/bpm/model/index.ts | 10 ++++++++ .../bpm/model/CategoryDraggableModel.vue | 25 +++++++++++-------- src/views/bpm/model/index.vue | 2 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/api/bpm/model/index.ts b/src/api/bpm/model/index.ts index cbcb8a0f..0c499dba 100644 --- a/src/api/bpm/model/index.ts +++ b/src/api/bpm/model/index.ts @@ -38,6 +38,16 @@ export const updateModel = async (data: ModelVO) => { return await request.put({ url: '/bpm/model/update', data: data }) } +// 批量修改流程分类的排序 +export const updateModelSortBatch = async (ids: number[]) => { + return await request.put({ + url: `/bpm/model/update-sort-batch`, + params: { + ids: ids.join(',') + } + }) +} + export const updateModelBpmn = async (data: ModelVO) => { return await request.put({ url: '/bpm/model/update-bpmn', data: data }) } diff --git a/src/views/bpm/model/CategoryDraggableModel.vue b/src/views/bpm/model/CategoryDraggableModel.vue index db08aa58..7f67a516 100644 --- a/src/views/bpm/model/CategoryDraggableModel.vue +++ b/src/views/bpm/model/CategoryDraggableModel.vue @@ -30,7 +30,7 @@ link type="info" class="mr-20px" - @click.stop="handleSort" + @click.stop="handleModelSort" > 排序 @@ -56,8 +56,8 @@ @@ -267,7 +267,7 @@ const { t } = useI18n() // 国际化 const { push } = useRouter() // 路由 const userStore = useUserStoreWithOut() // 用户信息缓存 const isModelSorting = ref(false) // 是否正处于排序状态 -const tableData: any = ref([]) +const tableData: any = ref([]) // 模型列表 const originalData: any = ref([]) // 原始数据 const isExpand = ref(false) // 是否处于展开状态 @@ -403,22 +403,27 @@ const isManagerUser = (row: any) => { return row.managerUserIds && row.managerUserIds.includes(userId) } -/* 排序 */ -const handleSort = () => { +/** 处理模型的排序 **/ +const handleModelSort = () => { // 保存初始数据 originalData.value = cloneDeep(props.categoryInfo.modelList) isModelSorting.value = true initSort() } -const saveSort = () => { - // TODO 芋艿:这里需要一个保存分类下模型排序接口 +/** 处理模型的排序提交 */ +const handleModelSortSubmit = async () => { + // 保存排序 + const ids = tableData.value.map((item: any) => item.id) + await ModelApi.updateModelSortBatch(ids) // 刷新列表 - emit('success') isModelSorting.value = false + message.success('排序模型成功') + emit('success') } -const cancelSort = () => { +/** 处理模型的排序取消 */ +const handleModelSortCancel = () => { // 恢复初始数据 tableData.value = cloneDeep(originalData.value) isModelSorting.value = false diff --git a/src/views/bpm/model/index.vue b/src/views/bpm/model/index.vue index aad4d5c4..1ecdabee 100644 --- a/src/views/bpm/model/index.vue +++ b/src/views/bpm/model/index.vue @@ -188,7 +188,7 @@ const handleCategorySortCancel = () => { isCategorySorting.value = false } -/** 保存排序 */ +/** 分类排序的保存 */ const handleCategorySortSubmit = async () => { // 保存排序 const ids = categoryGroup.value.map((item: any) => item.id)