feat: 优化交互细节、删除流程分类接口联调
parent
91ea4b7936
commit
708e12b6ce
|
@ -1,10 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 默认使其全部展开 -->
|
<!-- 默认使其全部展开 -->
|
||||||
<el-collapse v-model="activeCollapse">
|
<el-collapse v-model="activeCollapse">
|
||||||
<el-collapse-item :name="categoryInfo.id">
|
<el-collapse-item :name="categoryInfo.id" :disabled="categoryInfo.modelList.length === 0">
|
||||||
<template #icon="{ isActive }">
|
<template #icon="{ isActive }">
|
||||||
<div class="flex-1 flex" v-if="!isCategorySorting">
|
<div class="flex-1 flex" v-if="!isCategorySorting">
|
||||||
<div
|
<div
|
||||||
|
v-if="categoryInfo.modelList.length > 0"
|
||||||
class="ml-20px flex items-center"
|
class="ml-20px flex items-center"
|
||||||
:class="['transition-transform duration-300', isActive ? 'rotate-180' : 'rotate-0']"
|
:class="['transition-transform duration-300', isActive ? 'rotate-180' : 'rotate-0']"
|
||||||
>
|
>
|
||||||
|
@ -230,6 +231,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { CategoryApi } from '@/api/bpm/category'
|
||||||
import Sortable from 'sortablejs'
|
import Sortable from 'sortablejs'
|
||||||
import { propTypes } from '@/utils/propTypes'
|
import { propTypes } from '@/utils/propTypes'
|
||||||
import { formatDate } from '@/utils/formatTime'
|
import { formatDate } from '@/utils/formatTime'
|
||||||
|
@ -409,8 +411,7 @@ const handleSort = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveSort = () => {
|
const saveSort = () => {
|
||||||
// 接口调用
|
// TODO 芋艿:这里需要一个保存分类下模型排序接口
|
||||||
console.log(tableData.value)
|
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
emit('success')
|
emit('success')
|
||||||
isModelSorting.value = false
|
isModelSorting.value = false
|
||||||
|
@ -451,6 +452,9 @@ const initSort = () => {
|
||||||
// 更新表格数据
|
// 更新表格数据
|
||||||
const updateTableData = () => {
|
const updateTableData = () => {
|
||||||
tableData.value = cloneDeep(props.categoryInfo.modelList)
|
tableData.value = cloneDeep(props.categoryInfo.modelList)
|
||||||
|
if (props.categoryInfo.modelList.length > 0) {
|
||||||
|
activeCollapse.value = [props.categoryInfo.id]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const renameVal = ref('')
|
const renameVal = ref('')
|
||||||
|
@ -463,15 +467,27 @@ const handleRenameConfirm = () => {
|
||||||
|
|
||||||
// 删除分类
|
// 删除分类
|
||||||
const handleDeleteGroup = async () => {
|
const handleDeleteGroup = async () => {
|
||||||
if (props.categoryInfo.modelList.length > 0) {
|
try {
|
||||||
return message.warning('该分类下仍有流程定义,不允许删除')
|
if (props.categoryInfo.modelList.length > 0) {
|
||||||
}
|
return message.warning('该分类下仍有流程定义,不允许删除')
|
||||||
await message.confirm('确认删除分类吗?')
|
}
|
||||||
// 实际调用接口删除
|
await message.confirm('确认删除分类吗?')
|
||||||
|
// 发起删除
|
||||||
|
await CategoryApi.deleteCategory(props.categoryInfo.id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
emit('success')
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.categoryInfo.modelList, updateTableData, { immediate: true })
|
watch(() => props.categoryInfo.modelList, updateTableData, { immediate: true })
|
||||||
|
watch(
|
||||||
|
() => props.isCategorySorting,
|
||||||
|
(val) => {
|
||||||
|
if (val) activeCollapse.value = []
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
defineExpose({
|
defineExpose({
|
||||||
activeCollapse
|
activeCollapse
|
||||||
})
|
})
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
ref="categoryDraggableModelRef"
|
ref="categoryDraggableModelRef"
|
||||||
:isCategorySorting="isCategorySorting"
|
:isCategorySorting="isCategorySorting"
|
||||||
:categoryInfo="element"
|
:categoryInfo="element"
|
||||||
@success="getAllModel"
|
@success="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
</template>
|
</template>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改流程 -->
|
<!-- 表单弹窗:添加/修改流程 -->
|
||||||
<ModelForm ref="formRef" @success="getAllModel" />
|
<ModelForm ref="formRef" @success="getList" />
|
||||||
<!-- 表单弹窗:添加/修改分类 -->
|
<!-- 表单弹窗:添加/修改分类 -->
|
||||||
<CategoryForm ref="categoryFormRef" @success="getList" />
|
<CategoryForm ref="categoryFormRef" @success="getList" />
|
||||||
<!-- 弹窗:表单详情 -->
|
<!-- 弹窗:表单详情 -->
|
||||||
|
@ -133,7 +133,7 @@ const getAllModel = async () => {
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
getAllModel()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
|
@ -171,9 +171,6 @@ const handleSort = () => {
|
||||||
// 保存初始数据
|
// 保存初始数据
|
||||||
originalData.value = cloneDeep(categoryGroup.value)
|
originalData.value = cloneDeep(categoryGroup.value)
|
||||||
isCategorySorting.value = true
|
isCategorySorting.value = true
|
||||||
categoryDraggableModelRef.value?.forEach((element) => {
|
|
||||||
element.activeCollapse = []
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// 取消排序
|
// 取消排序
|
||||||
const cancelSort = () => {
|
const cancelSort = () => {
|
||||||
|
@ -182,7 +179,9 @@ const cancelSort = () => {
|
||||||
isCategorySorting.value = false
|
isCategorySorting.value = false
|
||||||
}
|
}
|
||||||
// 保存排序
|
// 保存排序
|
||||||
const saveSort = () => {}
|
const saveSort = () => {
|
||||||
|
// TODO 芋艿:这里需要一个保存分类排序接口
|
||||||
|
}
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
Loading…
Reference in New Issue