From 6a029ad7a07ba1cc2096e95f7196189ccdf3e7d0 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Wed, 7 May 2025 16:28:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=B5=81=E7=A8=8B=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=88=97=E8=A1=A8=2070%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/bpm/category/index.ts | 1 + apps/web-antd/src/views/bpm/category/data.ts | 1 + .../bpm/category/modules/rename-form.vue | 102 ++++++++++++++++++ apps/web-antd/src/views/bpm/model/index.vue | 21 +++- .../modules/category-draggable-model.vue | 77 ++++++++++++- 5 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 apps/web-antd/src/views/bpm/category/modules/rename-form.vue diff --git a/apps/web-antd/src/api/bpm/category/index.ts b/apps/web-antd/src/api/bpm/category/index.ts index 0a558f6d..767f3c40 100644 --- a/apps/web-antd/src/api/bpm/category/index.ts +++ b/apps/web-antd/src/api/bpm/category/index.ts @@ -11,6 +11,7 @@ export namespace BpmCategoryApi { name: string; code: string; status: number; + description?: string; sort: number; // 分类排序 } diff --git a/apps/web-antd/src/views/bpm/category/data.ts b/apps/web-antd/src/views/bpm/category/data.ts index db53d57e..1df6ba2d 100644 --- a/apps/web-antd/src/views/bpm/category/data.ts +++ b/apps/web-antd/src/views/bpm/category/data.ts @@ -64,6 +64,7 @@ export function useFormSchema(): VbenFormSchema[] { min: 0, controlsPosition: 'right', placeholder: '请输入分类排序', + class: 'w-full', }, }, ]; diff --git a/apps/web-antd/src/views/bpm/category/modules/rename-form.vue b/apps/web-antd/src/views/bpm/category/modules/rename-form.vue new file mode 100644 index 00000000..ba68a44e --- /dev/null +++ b/apps/web-antd/src/views/bpm/category/modules/rename-form.vue @@ -0,0 +1,102 @@ + + + + + + + diff --git a/apps/web-antd/src/views/bpm/model/index.vue b/apps/web-antd/src/views/bpm/model/index.vue index c40c53e8..00c2ac1f 100644 --- a/apps/web-antd/src/views/bpm/model/index.vue +++ b/apps/web-antd/src/views/bpm/model/index.vue @@ -3,7 +3,7 @@ import type { BpmModelApi } from '#/api/bpm/model'; import { onActivated, reactive, ref, useTemplateRef, watch } from 'vue'; -import { Page } from '@vben/common-ui'; +import { Page, useVbenModal } from '@vben/common-ui'; import { Plus, Search, Settings } from '@vben/icons'; import { cloneDeep } from '@vben/utils'; @@ -26,7 +26,16 @@ import { } from '#/api/bpm/category'; import { getModelList } from '#/api/bpm/model'; +// 流程分类对话框 +import CategoryForm from '../category/modules/form.vue'; import CategoryDraggableModel from './modules/category-draggable-model.vue'; + +// 新建流程分类对话框 +const [CategoryFormModal, categoryFormModalApi] = useVbenModal({ + connectedComponent: CategoryForm, + destroyOnClose: true, +}); + // 模型列表加载状态 const modelListSpinning = refAutoReset(false, 3000); // 保存排序状态 @@ -100,7 +109,8 @@ const createModel = () => { /** 处理下拉菜单命令 */ const handleCommand = (command: string) => { if (command === 'handleCategoryAdd') { - // TODO 新建分类逻辑 + // 打开新建流程分类弹窗 + categoryFormModalApi.open(); } else if (command === 'handleCategorySort') { originalData.value = cloneDeep(categoryGroup.value); isCategorySorting.value = true; @@ -152,7 +162,7 @@ const handleCategorySortSubmit = async () => { @@ -184,7 +194,7 @@ const handleCategorySortSubmit = async () => { - + @@ -239,4 +249,7 @@ const handleCategorySortSubmit = async () => { + + + diff --git a/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue b/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue index 08443f1e..b061df44 100644 --- a/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue +++ b/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue @@ -4,6 +4,7 @@ import type { BpmModelApi } from '#/api/bpm/model'; import { computed, ref, watchEffect } from 'vue'; +import { confirm, useVbenModal } from '@vben/common-ui'; import { cloneDeep, formatDateTime, isEqual } from '@vben/utils'; import { useDebounceFn } from '@vueuse/core'; @@ -12,16 +13,23 @@ import { Button, Card, Collapse, + Dropdown, + Menu, message, Table, Tag, Tooltip, } from 'ant-design-vue'; +import { deleteCategory } from '#/api/bpm/category'; import { updateModelSortBatch } from '#/api/bpm/model'; import { DictTag } from '#/components/dict-tag'; +import { $t } from '#/locales'; import { DICT_TYPE } from '#/utils'; +// 导入重命名表单 +import CategoryRenameForm from '../../category/modules/rename-form.vue'; + const props = defineProps<{ categoryInfo: BpmCategoryApi.ModelCategoryInfo; isCategorySorting: boolean; @@ -131,6 +139,36 @@ const handleModelSortCancel = () => { } }; +/** 处理下拉菜单命令 */ +const handleCommand = (command: string) => { + if (command === 'renameCategory') { + // 打开重命名分类对话框 + categoryRenameModalApi.setData(props.categoryInfo).open(); + } else if (command === 'deleteCategory') { + handleDeleteCategory(); + } +}; + +/** 删除流程分类 */ +const handleDeleteCategory = async () => { + if (props.categoryInfo.modelList.length > 0) { + message.warning('该分类下仍有流程定义,不允许删除'); + return; + } + + confirm({ + content: `确定要删除[${props.categoryInfo.name}]吗?`, + }).then(async () => { + // 发起删除 + await deleteCategory(props.categoryInfo.id); + message.success( + $t('ui.actionMessage.deleteSuccess', [props.categoryInfo.name]), + ); + // 刷新列表 + emit('success'); + }); +}; + /** 处理表单详情点击 */ const handleFormDetail = (row: any) => { // TODO 待实现 @@ -169,6 +207,17 @@ const customRow = (_record: any) => { class: isModelSorting.value ? 'cursor-move' : '', }; }; + +// 重命名分类对话框 +const [CategoryRenameModal, categoryRenameModalApi] = useVbenModal({ + connectedComponent: CategoryRenameForm, + destroyOnClose: true, +}); + +// 处理重命名成功 +const handleRenameSuccess = () => { + emit('success'); +}; @@ -205,20 +254,39 @@ const customRow = (_record: any) => { - + 排序 + + + + + + 分类 + + + handleCommand(e.key as string)"> + 重命名 + 删除分类 + + + @@ -370,6 +438,9 @@ const customRow = (_record: any) => { + + +