Skip to content

Commit c3cf479

Browse files
committed
【功能新增】工作流:流程模型增加批量修改 sort 交互
1 parent 77062cb commit c3cf479

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

src/api/bpm/model/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ export const updateModel = async (data: ModelVO) => {
3838
return await request.put({ url: '/bpm/model/update', data: data })
3939
}
4040

41+
// 批量修改流程分类的排序
42+
export const updateModelSortBatch = async (ids: number[]) => {
43+
return await request.put({
44+
url: `/bpm/model/update-sort-batch`,
45+
params: {
46+
ids: ids.join(',')
47+
}
48+
})
49+
}
50+
4151
export const updateModelBpmn = async (data: ModelVO) => {
4252
return await request.put({ url: '/bpm/model/update-bpmn', data: data })
4353
}

src/views/bpm/model/CategoryDraggableModel.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
link
3131
type="info"
3232
class="mr-20px"
33-
@click.stop="handleSort"
33+
@click.stop="handleModelSort"
3434
>
3535
<Icon icon="fa:sort-amount-desc" class="mr-5px" />
3636
排序
@@ -56,8 +56,8 @@
5656
</el-dropdown>
5757
</template>
5858
<template v-else>
59-
<el-button @click.stop="cancelSort"> 取 消 </el-button>
60-
<el-button type="primary" @click.stop="saveSort"> 保存排序 </el-button>
59+
<el-button @click.stop="handleModelSortCancel"> 取 消 </el-button>
60+
<el-button type="primary" @click.stop="handleModelSortSubmit"> 保存排序 </el-button>
6161
</template>
6262
</div>
6363
</div>
@@ -267,7 +267,7 @@ const { t } = useI18n() // 国际化
267267
const { push } = useRouter() // 路由
268268
const userStore = useUserStoreWithOut() // 用户信息缓存
269269
const isModelSorting = ref(false) // 是否正处于排序状态
270-
const tableData: any = ref([])
270+
const tableData: any = ref([]) // 模型列表
271271
const originalData: any = ref([]) // 原始数据
272272
const isExpand = ref(false) // 是否处于展开状态
273273
@@ -403,22 +403,27 @@ const isManagerUser = (row: any) => {
403403
return row.managerUserIds && row.managerUserIds.includes(userId)
404404
}
405405
406-
/* 排序 */
407-
const handleSort = () => {
406+
/** 处理模型的排序 **/
407+
const handleModelSort = () => {
408408
// 保存初始数据
409409
originalData.value = cloneDeep(props.categoryInfo.modelList)
410410
isModelSorting.value = true
411411
initSort()
412412
}
413413
414-
const saveSort = () => {
415-
// TODO 芋艿:这里需要一个保存分类下模型排序接口
414+
/** 处理模型的排序提交 */
415+
const handleModelSortSubmit = async () => {
416+
// 保存排序
417+
const ids = tableData.value.map((item: any) => item.id)
418+
await ModelApi.updateModelSortBatch(ids)
416419
// 刷新列表
417-
emit('success')
418420
isModelSorting.value = false
421+
message.success('排序模型成功')
422+
emit('success')
419423
}
420424
421-
const cancelSort = () => {
425+
/** 处理模型的排序取消 */
426+
const handleModelSortCancel = () => {
422427
// 恢复初始数据
423428
tableData.value = cloneDeep(originalData.value)
424429
isModelSorting.value = false

src/views/bpm/model/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const handleCategorySortCancel = () => {
188188
isCategorySorting.value = false
189189
}
190190
191-
/** 保存排序 */
191+
/** 分类排序的保存 */
192192
const handleCategorySortSubmit = async () => {
193193
// 保存排序
194194
const ids = categoryGroup.value.map((item: any) => item.id)

0 commit comments

Comments
 (0)