1
1
<template >
2
2
<!-- 默认使其全部展开 -->
3
3
<el-collapse v-model =" activeCollapse" >
4
- <el-collapse-item :name =" categoryInfo.id" >
4
+ <el-collapse-item :name =" categoryInfo.id" :disabled = " categoryInfo.modelList.length === 0 " >
5
5
<template #icon =" { isActive } " >
6
6
<div class =" flex-1 flex" v-if =" !isCategorySorting" >
7
7
<div
8
+ v-if =" categoryInfo.modelList.length > 0"
8
9
class =" ml-20px flex items-center"
9
10
:class =" ['transition-transform duration-300', isActive ? 'rotate-180' : 'rotate-0']"
10
11
>
230
231
</template >
231
232
232
233
<script lang="ts" setup>
234
+ import { CategoryApi } from ' @/api/bpm/category'
233
235
import Sortable from ' sortablejs'
234
236
import { propTypes } from ' @/utils/propTypes'
235
237
import { formatDate } from ' @/utils/formatTime'
@@ -409,8 +411,7 @@ const handleSort = () => {
409
411
}
410
412
411
413
const saveSort = () => {
412
- // 接口调用
413
- console .log (tableData .value )
414
+ // TODO 芋艿:这里需要一个保存分类下模型排序接口
414
415
// 刷新列表
415
416
emit (' success' )
416
417
isModelSorting .value = false
@@ -451,6 +452,9 @@ const initSort = () => {
451
452
// 更新表格数据
452
453
const updateTableData = () => {
453
454
tableData .value = cloneDeep (props .categoryInfo .modelList )
455
+ if (props .categoryInfo .modelList .length > 0 ) {
456
+ activeCollapse .value = [props .categoryInfo .id ]
457
+ }
454
458
}
455
459
456
460
const renameVal = ref (' ' )
@@ -463,15 +467,27 @@ const handleRenameConfirm = () => {
463
467
464
468
// 删除分类
465
469
const handleDeleteGroup = async () => {
466
- if (props .categoryInfo .modelList .length > 0 ) {
467
- return message .warning (' 该分类下仍有流程定义,不允许删除' )
468
- }
469
- await message .confirm (' 确认删除分类吗?' )
470
- // 实际调用接口删除
470
+ try {
471
+ if (props .categoryInfo .modelList .length > 0 ) {
472
+ return message .warning (' 该分类下仍有流程定义,不允许删除' )
473
+ }
474
+ await message .confirm (' 确认删除分类吗?' )
475
+ // 发起删除
476
+ await CategoryApi .deleteCategory (props .categoryInfo .id )
477
+ message .success (t (' common.delSuccess' ))
478
+ // 刷新列表
479
+ emit (' success' )
480
+ } catch {}
471
481
}
472
482
473
483
watch (() => props .categoryInfo .modelList , updateTableData , { immediate: true })
474
-
484
+ watch (
485
+ () => props .isCategorySorting ,
486
+ (val ) => {
487
+ if (val ) activeCollapse .value = []
488
+ },
489
+ { immediate: true }
490
+ )
475
491
defineExpose ({
476
492
activeCollapse
477
493
})
0 commit comments