1
1
<template >
2
- <!-- 默认使其全部展开 -->
3
- <el-collapse v-model =" activeCollapse" >
4
- <el-collapse-item :name =" categoryInfo.id" :disabled =" categoryInfo.modelList.length === 0" >
5
- <template #icon =" { isActive } " >
6
- <div class =" flex-1 flex" v-if =" !isCategorySorting" >
7
- <div
2
+ <div class =" flex items-center h-50px" >
3
+ <div class =" flex items-center" >
4
+ <el-tooltip content =" 拖动排序" v-if =" isCategorySorting" >
5
+ <Icon
6
+ :size =" 22"
7
+ icon =" ic:round-drag-indicator"
8
+ class =" ml-10px category-drag-icon cursor-move text-#8a909c"
9
+ />
10
+ </el-tooltip >
11
+ <h3 class =" ml-20px mr-8px text-18px" >{{ categoryInfo.name }}</h3 >
12
+ <div class =" color-gray-600 text-16px" > ({{ categoryInfo.modelList?.length || 0 }}) </div >
13
+ </div >
14
+ <div class =" flex-1 flex" v-if =" !isCategorySorting" >
15
+ <div
16
+ v-if =" categoryInfo.modelList.length > 0"
17
+ class =" ml-20px flex items-center"
18
+ :class =" [
19
+ 'transition-transform duration-300 cursor-pointer',
20
+ isExpand ? 'rotate-180' : 'rotate-0'
21
+ ]"
22
+ @click =" isExpand = !isExpand"
23
+ >
24
+ <Icon icon =" ep:arrow-down-bold" color =" #999" />
25
+ </div >
26
+ <div class =" ml-auto flex items-center" :class =" isModelSorting ? 'mr-15px' : 'mr-45px'" >
27
+ <template v-if =" ! isModelSorting " >
28
+ <el-button
8
29
v-if =" categoryInfo.modelList.length > 0"
9
- class =" ml-20px flex items-center"
10
- :class =" ['transition-transform duration-300', isActive ? 'rotate-180' : 'rotate-0']"
30
+ link
31
+ type =" info"
32
+ class =" mr-20px"
33
+ @click.stop =" handleSort"
11
34
>
12
- <Icon icon =" ep:arrow-down-bold" color =" #999" />
13
- </div >
14
- <div class =" ml-auto mr-45px flex items-center" >
15
- <template v-if =" ! isModelSorting " >
16
- <el-button
17
- v-if =" categoryInfo.modelList.length > 0"
18
- link
19
- type =" info"
20
- class =" mr-20px"
21
- @click.stop =" handleSort"
22
- >
23
- <Icon icon =" fa:sort-amount-desc" class =" mr-5px" />
24
- 排序
25
- </el-button >
26
- <el-button
27
- v-else
28
- link
29
- type =" info"
30
- class =" mr-20px"
31
- @click.stop =" handleAddModel('create')"
32
- >
33
- <Icon icon =" fa:plus" class =" mr-5px" />
34
- 新建
35
- </el-button >
36
- <el-dropdown
37
- @command =" (command) => handleCategoryCommand(command)"
38
- placement =" bottom"
39
- >
40
- <el-button link type =" info" @click.stop =" handleGroup" >
41
- <Icon icon =" ep:setting" class =" mr-5px" />
42
- 分类
43
- </el-button >
44
- <template #dropdown >
45
- <el-dropdown-menu >
46
- <el-dropdown-item command =" handleRename" > 重命名 </el-dropdown-item >
47
- <el-dropdown-item command =" handleDeleteGroup" > 删除该类 </el-dropdown-item >
48
- </el-dropdown-menu >
49
- </template >
50
- </el-dropdown >
51
- </template >
52
- <template v-else >
53
- <el-button @click.stop =" cancelSort" > 取 消 </el-button >
54
- <el-button type =" primary" @click.stop =" saveSort" > 保存排序 </el-button >
35
+ <Icon icon =" fa:sort-amount-desc" class =" mr-5px" />
36
+ 排序
37
+ </el-button >
38
+ <el-button v-else link type =" info" class =" mr-20px" @click.stop =" handleAddModel('create')" >
39
+ <Icon icon =" fa:plus" class =" mr-5px" />
40
+ 新建
41
+ </el-button >
42
+ <el-dropdown @command =" (command) => handleCategoryCommand(command)" placement =" bottom" >
43
+ <el-button link type =" info" >
44
+ <Icon icon =" ep:setting" class =" mr-5px" />
45
+ 分类
46
+ </el-button >
47
+ <template #dropdown >
48
+ <el-dropdown-menu >
49
+ <el-dropdown-item command =" handleRename" > 重命名 </el-dropdown-item >
50
+ <el-dropdown-item command =" handleDeleteGroup" > 删除该类 </el-dropdown-item >
51
+ </el-dropdown-menu >
55
52
</template >
56
- <!-- <el-button v-else type="primary" @click.stop="addModel"> 新建模型 </el-button> -->
57
- </div >
58
- </div >
59
- <div ></div >
60
- </template >
61
- <template #title >
62
- <div class =" flex items-center" >
63
- <el-tooltip content =" 拖动排序" v-if =" isCategorySorting" >
64
- <Icon
65
- :size =" 22"
66
- icon =" ic:round-drag-indicator"
67
- class =" ml-10px category-drag-icon cursor-move text-#8a909c"
68
- />
69
- </el-tooltip >
70
- <h3 class =" ml-20px mr-8px text-18px" >{{ categoryInfo.name }}</h3 >
71
- <div class =" color-gray-600 text-16px" > ({{ categoryInfo.modelList?.length || 0 }}) </div >
72
- </div >
73
- </template >
53
+ </el-dropdown >
54
+ </template >
55
+ <template v-else >
56
+ <el-button @click.stop =" cancelSort" > 取 消 </el-button >
57
+ <el-button type =" primary" @click.stop =" saveSort" > 保存排序 </el-button >
58
+ </template >
59
+ </div >
60
+ </div >
61
+ </div >
62
+ <el-collapse-transition >
63
+ <div v-show =" isExpand" >
74
64
<el-table
75
65
:class =" categoryInfo.name"
76
66
ref =" tableRef"
220
210
</template >
221
211
</el-table-column >
222
212
</el-table >
223
- </el-collapse-item >
224
- </el-collapse >
213
+ </div >
214
+ </el-collapse-transition >
225
215
226
216
<!-- 弹窗:重命名分类 -->
227
217
<Dialog :fullscreen =" false" class =" rename-dialog" v-model =" renameVisible" width =" 400" >
@@ -259,7 +249,6 @@ import { cloneDeep } from 'lodash-es'
259
249
260
250
defineOptions ({ name: ' BpmModel' })
261
251
262
- const activeCollapse: any = ref ([])
263
252
const renameVisible = ref (false )
264
253
const props = defineProps ({
265
254
// 分类后的数据
@@ -276,7 +265,7 @@ const userStore = useUserStoreWithOut() // 用户信息缓存
276
265
const isModelSorting = ref (false ) // 是否正处于排序状态
277
266
const tableData: any = ref ([])
278
267
const originalData: any = ref ([]) // 原始数据
279
-
268
+ const isExpand = ref ( false ) // 是否处于展开状态
280
269
/** '更多'操作按钮 */
281
270
const handleCommand = (command : string , row : any ) => {
282
271
switch (command ) {
@@ -436,10 +425,6 @@ const cancelSort = () => {
436
425
isModelSorting .value = false
437
426
}
438
427
439
- /* 分类 */
440
- const handleGroup = () => {
441
- console .log (' 分类' )
442
- }
443
428
const tableRef = ref ()
444
429
// 创建拖拽实例
445
430
const initSort = () => {
@@ -466,7 +451,7 @@ const initSort = () => {
466
451
const updateTableData = () => {
467
452
tableData .value = cloneDeep (props .categoryInfo .modelList )
468
453
if (props .categoryInfo .modelList .length > 0 ) {
469
- activeCollapse .value = [ props . categoryInfo . id ]
454
+ isExpand .value = true
470
455
}
471
456
}
472
457
@@ -503,13 +488,10 @@ watch(() => props.categoryInfo.modelList, updateTableData, { immediate: true })
503
488
watch (
504
489
() => props .isCategorySorting ,
505
490
(val ) => {
506
- if (val ) activeCollapse .value = []
491
+ if (val ) isExpand .value = false
507
492
},
508
493
{ immediate: true }
509
494
)
510
- defineExpose ({
511
- activeCollapse
512
- })
513
495
</script >
514
496
515
497
<style lang="scss">
@@ -525,19 +507,6 @@ defineExpose({
525
507
</style >
526
508
<style lang="scss" scoped>
527
509
:deep() {
528
- .el-collapse ,
529
- .el-collapse-item__header ,
530
- .el-collapse-item__wrap {
531
- border : none ;
532
- }
533
- .el-collapse-item__arrow {
534
- margin-left : 10px ;
535
- font-size : 20px ;
536
- font-weight : 500 ;
537
- }
538
- .el-collapse-item__content {
539
- padding-bottom : 0 ;
540
- }
541
510
.el-table__cell {
542
511
border-bottom : none !important ;
543
512
}
0 commit comments