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"
77
67
:header-cell-style =" { backgroundColor: isDark ? '' : '#edeff0', paddingLeft: '10px' }"
78
68
:cell-style =" { paddingLeft: '10px' }"
69
+ :row-style =" { height: '68px' }"
79
70
:data =" tableData"
80
71
row-key =" id"
81
72
>
220
211
</template >
221
212
</el-table-column >
222
213
</el-table >
223
- </el-collapse-item >
224
- </el-collapse >
214
+ </div >
215
+ </el-collapse-transition >
225
216
226
217
<!-- 弹窗:重命名分类 -->
227
218
<Dialog :fullscreen =" false" class =" rename-dialog" v-model =" renameVisible" width =" 400" >
@@ -259,7 +250,6 @@ import { cloneDeep } from 'lodash-es'
259
250
260
251
defineOptions ({ name: ' BpmModel' })
261
252
262
- const activeCollapse: any = ref ([])
263
253
const renameVisible = ref (false )
264
254
const props = defineProps ({
265
255
// 分类后的数据
@@ -276,7 +266,7 @@ const userStore = useUserStoreWithOut() // 用户信息缓存
276
266
const isModelSorting = ref (false ) // 是否正处于排序状态
277
267
const tableData: any = ref ([])
278
268
const originalData: any = ref ([]) // 原始数据
279
-
269
+ const isExpand = ref ( false ) // 是否处于展开状态
280
270
/** '更多'操作按钮 */
281
271
const handleCommand = (command : string , row : any ) => {
282
272
switch (command ) {
@@ -436,10 +426,6 @@ const cancelSort = () => {
436
426
isModelSorting .value = false
437
427
}
438
428
439
- /* 分类 */
440
- const handleGroup = () => {
441
- console .log (' 分类' )
442
- }
443
429
const tableRef = ref ()
444
430
// 创建拖拽实例
445
431
const initSort = () => {
@@ -466,7 +452,7 @@ const initSort = () => {
466
452
const updateTableData = () => {
467
453
tableData .value = cloneDeep (props .categoryInfo .modelList )
468
454
if (props .categoryInfo .modelList .length > 0 ) {
469
- activeCollapse .value = [ props . categoryInfo . id ]
455
+ isExpand .value = true
470
456
}
471
457
}
472
458
@@ -503,13 +489,10 @@ watch(() => props.categoryInfo.modelList, updateTableData, { immediate: true })
503
489
watch (
504
490
() => props .isCategorySorting ,
505
491
(val ) => {
506
- if (val ) activeCollapse .value = []
492
+ if (val ) isExpand .value = false
507
493
},
508
494
{ immediate: true }
509
495
)
510
- defineExpose ({
511
- activeCollapse
512
- })
513
496
</script >
514
497
515
498
<style lang="scss">
@@ -525,24 +508,9 @@ defineExpose({
525
508
</style >
526
509
<style lang="scss" scoped>
527
510
: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
511
.el-table__cell {
542
512
border-bottom : none !important ;
543
- }
544
- .el-table__row {
545
- height : 68px ;
513
+ overflow : hidden ;
546
514
}
547
515
}
548
516
</style >
0 commit comments