4
4
<h3 class =" font-extrabold" >流程模型</h3 >
5
5
<!-- 搜索工作栏 -->
6
6
<el-form
7
+ v-if =" !isCategorySorting"
7
8
class =" -mb-15px flex"
8
9
:model =" queryParams"
9
10
ref =" queryFormRef"
30
31
</el-form-item >
31
32
32
33
<el-form-item >
33
- <el-dropdown placement =" bottom-end" >
34
+ <el-dropdown @command = " (command) => handleCommand(command) " placement =" bottom-end" >
34
35
<el-button class =" w-30px" plain >
35
36
<Icon icon =" ep:setting" />
36
37
</el-button >
37
38
<template #dropdown >
38
39
<el-dropdown-menu >
39
- <el-dropdown-item >
40
+ <el-dropdown-item command = " handleAddCategory " >
40
41
<Icon icon =" ep:circle-plus" :size =" 13" class =" mr-5px" />
41
42
新建分类
42
43
</el-dropdown-item >
43
- <el-dropdown-item >
44
+ <el-dropdown-item command = " handleSort " >
44
45
<Icon icon =" fa:sort-amount-desc" :size =" 13" class =" mr-5px" />
45
46
分类排序
46
47
</el-dropdown-item >
49
50
</el-dropdown >
50
51
</el-form-item >
51
52
</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 >
52
57
</div >
53
58
54
59
<el-divider />
63
68
>
64
69
<CategoryDraggableModel
65
70
ref =" draggableModelRef"
71
+ :isCategorySorting =" isCategorySorting"
66
72
:dataList =" list"
67
73
:title =" title"
68
74
@success =" getList"
@@ -91,6 +97,7 @@ defineOptions({ name: 'BpmModel' })
91
97
92
98
const draggableModelRef = ref ()
93
99
const loading = ref (true ) // 列表的加载中
100
+ const isCategorySorting = ref (false ) // 是否正处于排序状态
94
101
const queryParams = reactive ({
95
102
pageNo: 1 ,
96
103
pageSize: 10 ,
@@ -105,7 +112,7 @@ const categoryGroup = ref<any>({}) // 按照category分组的数据
105
112
const getList = async () => {
106
113
loading .value = true
107
114
try {
108
- // TODO 芋艿:这里需要一个不分页查全部的流程模型接口
115
+ // TODO 芋艿:这里需要一个不分页查全部的流程模型接口,并且每条数据都应包含categoryId字段,用于重命名/删除分类。
109
116
const data = await ModelApi .getModelPage (queryParams )
110
117
data .list = mockData
111
118
categoryGroup .value = groupBy (data .list , ' categoryName' )
@@ -133,6 +140,33 @@ const formDetailPreview = ref({
133
140
option: {}
134
141
})
135
142
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
+
136
170
/** 初始化 **/
137
171
onMounted (async () => {
138
172
await getList ()
0 commit comments