feat: 优化交互细节、删除流程分类接口联调

pull/582/head
GoldenZqqq 2024-10-16 16:23:41 +08:00
parent 91ea4b7936
commit 708e12b6ce
2 changed files with 31 additions and 16 deletions

View File

@ -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
}) })

View File

@ -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