diff --git a/apps/web-antd/src/views/workflow/category/category-modal.vue b/apps/web-antd/src/views/workflow/category/category-modal.vue index 75fb8d60..06938e84 100644 --- a/apps/web-antd/src/views/workflow/category/category-modal.vue +++ b/apps/web-antd/src/views/workflow/category/category-modal.vue @@ -3,7 +3,12 @@ import { computed, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { cloneDeep, getPopupContainer, listToTree } from '@vben/utils'; +import { + addFullName, + cloneDeep, + getPopupContainer, + listToTree, +} from '@vben/utils'; import { useVbenForm } from '#/adapter/form'; import { @@ -40,17 +45,11 @@ const [BasicForm, formApi] = useVbenForm({ async function setupCategorySelect() { const listData = await categoryList(); - let treeData = listToTree(listData, { + const treeData = listToTree(listData, { id: 'categoryId', pid: 'parentId', }); - treeData = [ - { - categoryName: '根目录', - categoryId: 0, - children: treeData, - }, - ]; + addFullName(treeData, 'categoryName', ' / '); formApi.updateSchema([ { fieldName: 'parentId', @@ -59,6 +58,7 @@ async function setupCategorySelect() { treeLine: { showLeafIcon: false }, fieldNames: { label: 'categoryName', value: 'categoryId' }, treeDefaultExpandAll: true, + treeNodeLabelProp: 'fullName', getPopupContainer, }, }, @@ -120,7 +120,11 @@ async function handleCancel() { diff --git a/apps/web-antd/src/views/workflow/category/data.ts b/apps/web-antd/src/views/workflow/category/data.ts index b9b757af..0e504699 100644 --- a/apps/web-antd/src/views/workflow/category/data.ts +++ b/apps/web-antd/src/views/workflow/category/data.ts @@ -51,7 +51,7 @@ export const modalSchema: FormSchemaGetter = () => [ fieldName: 'parentId', label: '父级分类', rules: 'required', - defaultValue: 0, + defaultValue: 100, component: 'TreeSelect', }, { diff --git a/apps/web-antd/src/views/workflow/processDefinition/category-tree.vue b/apps/web-antd/src/views/workflow/processDefinition/category-tree.vue index b87676dd..2969c4da 100644 --- a/apps/web-antd/src/views/workflow/processDefinition/category-tree.vue +++ b/apps/web-antd/src/views/workflow/processDefinition/category-tree.vue @@ -43,17 +43,10 @@ async function loadTree() { selectCode.value = []; const ret = await categoryList(); - let treeData = listToTree(ret, { + const treeData = listToTree(ret, { id: 'categoryId', pid: 'parentId', }); - treeData = [ - { - categoryName: '根目录', - categoryId: 0, - children: treeData, - }, - ]; categoryTreeArray.value = treeData; showTreeSkeleton.value = false;