Skip to content

Commit 77062cb

Browse files
committed
【功能新增】工作流:流程分类增加批量修改 sort 界面
1 parent 1bb6a23 commit 77062cb

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

src/api/bpm/category/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ export const CategoryApi = {
3636
return await request.put({ url: `/bpm/category/update`, data })
3737
},
3838

39+
// 批量修改流程分类的排序
40+
updateCategorySortBatch: async (ids: number[]) => {
41+
return await request.put({
42+
url: `/bpm/category/update-sort-batch`,
43+
params: {
44+
ids: ids.join(',')
45+
}
46+
})
47+
},
48+
3949
// 删除流程分类
4050
deleteCategory: async (id: number) => {
4151
return await request.delete({ url: `/bpm/category/delete?id=` + id })

src/views/bpm/model/CategoryDraggableModel.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,13 @@ const handleRenameConfirm = async () => {
465465
}
466466
// 发起修改
467467
await CategoryApi.updateCategory(renameCategoryForm.value as CategoryVO)
468-
message.success('修改成功')
468+
message.success('重命名成功')
469469
// 刷新列表
470470
renameCategoryVisible.value = false
471471
emit('success')
472472
}
473473
474-
// 删除分类
474+
/** 删除分类 */
475475
const handleDeleteCategory = async () => {
476476
try {
477477
if (props.categoryInfo.modelList.length > 0) {
@@ -486,7 +486,7 @@ const handleDeleteCategory = async () => {
486486
} catch {}
487487
}
488488
489-
// 添加流程模型弹窗
489+
/** 添加流程模型弹窗 */
490490
const modelFormRef = ref()
491491
const openModelForm = (type: string, id?: number) => {
492492
modelFormRef.value.open(type, id)

src/views/bpm/model/index.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
</el-form-item>
5353
</el-form>
5454
<div class="mr-20px" v-else>
55-
<el-button @click="cancelSort"> 取 消 </el-button>
56-
<el-button type="primary" @click="saveSort"> 保存排序 </el-button>
55+
<el-button @click="handleCategorySortCancel"> 取 消 </el-button>
56+
<el-button type="primary" @click="handleCategorySortSubmit"> 保存排序 </el-button>
5757
</div>
5858
</div>
5959

@@ -106,7 +106,7 @@ import CategoryDraggableModel from './CategoryDraggableModel.vue'
106106
107107
defineOptions({ name: 'BpmModel' })
108108
109-
const categoryFormRef = ref()
109+
const message = useMessage() // 消息弹窗
110110
const loading = ref(true) // 列表的加载中
111111
const isCategorySorting = ref(false) // 是否 category 正处于排序状态
112112
const queryParams = reactive({
@@ -161,37 +161,42 @@ const handleCommand = (command: string) => {
161161
handleAddCategory()
162162
break
163163
case 'handleSort':
164-
handleSort()
164+
handleCategorySort()
165165
break
166166
default:
167167
break
168168
}
169169
}
170170
171171
/** 新建分类 */
172+
const categoryFormRef = ref()
172173
const handleAddCategory = () => {
173174
categoryFormRef.value.open('create')
174175
}
175176
176-
// TODO 芋艿:需要实现
177-
/** 分类排序 */
178-
const handleSort = () => {
177+
/** 分类排序的提交 */
178+
const handleCategorySort = () => {
179179
// 保存初始数据
180180
originalData.value = cloneDeep(categoryGroup.value)
181181
isCategorySorting.value = true
182182
}
183183
184-
// TODO 芋艿:需要实现
185-
/** 取消排序 */
186-
const cancelSort = () => {
184+
/** 分类排序的取消 */
185+
const handleCategorySortCancel = () => {
187186
// 恢复初始数据
188187
categoryGroup.value = cloneDeep(originalData.value)
189188
isCategorySorting.value = false
190189
}
191190
192191
/** 保存排序 */
193-
const saveSort = () => {
194-
// TODO 芋艿:这里需要一个保存分类排序接口
192+
const handleCategorySortSubmit = async () => {
193+
// 保存排序
194+
const ids = categoryGroup.value.map((item: any) => item.id)
195+
await CategoryApi.updateCategorySortBatch(ids)
196+
// 刷新列表
197+
isCategorySorting.value = false
198+
message.success('排序分类成功')
199+
await getList()
195200
}
196201
197202
/** 加载数据 */

0 commit comments

Comments
 (0)