Skip to content

Commit 2db1f72

Browse files
committed
feat: 流程模型分类排序按钮显示逻辑完善
1 parent 57820cb commit 2db1f72

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

src/views/bpm/model/CategoryDraggableModel.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
</template>
3737
<template #title>
3838
<div class="flex items-center">
39+
<el-tooltip content="拖动排序" v-if="isCategorySorting">
40+
<Icon
41+
:size="22"
42+
icon="ic:round-drag-indicator"
43+
class="ml-10px category-drag-icon cursor-move text-#8a909c"
44+
/>
45+
</el-tooltip>
3946
<h3 class="ml-20px mr-8px text-18px">{{ title }}</h3>
4047
<div class="color-gray-600 text-16px"> ({{ dataList?.length || 0 }}) </div>
4148
</div>
@@ -228,7 +235,8 @@ const renameVisible = ref(false)
228235
const props = defineProps({
229236
// 分类后的数据
230237
dataList: propTypes.object.def([]),
231-
title: propTypes.string.def('')
238+
title: propTypes.string.def(''),
239+
isCategorySorting: propTypes.bool.def(false)
232240
})
233241
const emit = defineEmits(['success'])
234242
const appStore = useAppStore()

src/views/bpm/model/index_new.vue

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<h3 class="font-extrabold">流程模型</h3>
55
<!-- 搜索工作栏 -->
66
<el-form
7+
v-if="!isCategorySorting"
78
class="-mb-15px flex"
89
:model="queryParams"
910
ref="queryFormRef"
@@ -30,17 +31,17 @@
3031
</el-form-item>
3132

3233
<el-form-item>
33-
<el-dropdown placement="bottom-end">
34+
<el-dropdown @command="(command) => handleCommand(command)" placement="bottom-end">
3435
<el-button class="w-30px" plain>
3536
<Icon icon="ep:setting" />
3637
</el-button>
3738
<template #dropdown>
3839
<el-dropdown-menu>
39-
<el-dropdown-item>
40+
<el-dropdown-item command="handleAddCategory">
4041
<Icon icon="ep:circle-plus" :size="13" class="mr-5px" />
4142
新建分类
4243
</el-dropdown-item>
43-
<el-dropdown-item>
44+
<el-dropdown-item command="handleSort">
4445
<Icon icon="fa:sort-amount-desc" :size="13" class="mr-5px" />
4546
分类排序
4647
</el-dropdown-item>
@@ -49,6 +50,10 @@
4950
</el-dropdown>
5051
</el-form-item>
5152
</el-form>
53+
<template v-else>
54+
<el-button type="primary" @click="cancelSort"> 取 消 </el-button>
55+
<el-button type="primary" @click="saveSort"> 保存排序 </el-button>
56+
</template>
5257
</div>
5358

5459
<el-divider />
@@ -63,6 +68,7 @@
6368
>
6469
<CategoryDraggableModel
6570
ref="draggableModelRef"
71+
:isCategorySorting="isCategorySorting"
6672
:dataList="list"
6773
:title="title"
6874
@success="getList"
@@ -91,6 +97,7 @@ defineOptions({ name: 'BpmModel' })
9197
9298
const draggableModelRef = ref()
9399
const loading = ref(true) // 列表的加载中
100+
const isCategorySorting = ref(false) // 是否正处于排序状态
94101
const queryParams = reactive({
95102
pageNo: 1,
96103
pageSize: 10,
@@ -105,7 +112,7 @@ const categoryGroup = ref<any>({}) // 按照category分组的数据
105112
const getList = async () => {
106113
loading.value = true
107114
try {
108-
// TODO 芋艿:这里需要一个不分页查全部的流程模型接口
115+
// TODO 芋艿:这里需要一个不分页查全部的流程模型接口,并且每条数据都应包含categoryId字段,用于重命名/删除分类。
109116
const data = await ModelApi.getModelPage(queryParams)
110117
data.list = mockData
111118
categoryGroup.value = groupBy(data.list, 'categoryName')
@@ -133,6 +140,33 @@ const formDetailPreview = ref({
133140
option: {}
134141
})
135142
143+
/** 右上角设置按钮 */
144+
const handleCommand = (command: string) => {
145+
switch (command) {
146+
case 'handleAddCategory':
147+
handleAddCategory()
148+
break
149+
case 'handleSort':
150+
handleSort()
151+
break
152+
default:
153+
break
154+
}
155+
}
156+
157+
// 新建分类
158+
const handleAddCategory = () => {}
159+
// 分类排序
160+
const handleSort = () => {
161+
isCategorySorting.value = true
162+
}
163+
// 取消排序
164+
const cancelSort = () => {
165+
isCategorySorting.value = false
166+
}
167+
// 保存排序
168+
const saveSort = () => {}
169+
136170
/** 初始化 **/
137171
onMounted(async () => {
138172
await getList()

0 commit comments

Comments
 (0)