fix: 使用Tree替换原有VbenTree

This commit is contained in:
xingyu4j
2025-09-19 16:08:23 +08:00
parent 7689aff790
commit 2f55bca2e4
9 changed files with 20 additions and 27 deletions

View File

@@ -4,7 +4,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { SystemDataScopeEnum } from '@vben/constants'; import { SystemDataScopeEnum } from '@vben/constants';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
@@ -134,7 +134,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal title="数据权限" class="w-2/5"> <Modal title="数据权限" class="w-2/5">
<Form class="mx-4"> <Form class="mx-4">
<template #dataScopeDeptIds="slotProps"> <template #dataScopeDeptIds="slotProps">
<VbenTree <Tree
:tree-data="deptTree" :tree-data="deptTree"
multiple multiple
bordered bordered

View File

@@ -4,9 +4,9 @@ import type { Recordable } from '@vben/types';
import type { SystemMenuApi } from '#/api/system/menu'; import type { SystemMenuApi } from '#/api/system/menu';
import type { SystemRoleApi } from '#/api/system/role'; import type { SystemRoleApi } from '#/api/system/role';
import {nextTick, ref} from 'vue'; import { nextTick, ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { SystemMenuTypeEnum } from '@vben/constants'; import { SystemMenuTypeEnum } from '@vben/constants';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
@@ -142,7 +142,7 @@ function getNodeClass(node: Recordable<any>) {
<Modal title="数据权限" class="w-2/5"> <Modal title="数据权限" class="w-2/5">
<Form class="mx-4"> <Form class="mx-4">
<template #menuIds="slotProps"> <template #menuIds="slotProps">
<VbenTree <Tree
:spinning="menuLoading" :spinning="menuLoading"
:tree-data="menuTree" :tree-data="menuTree"
multiple multiple

View File

@@ -4,7 +4,7 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
import { Checkbox, message } from 'ant-design-vue'; import { Checkbox, message } from 'ant-design-vue';
@@ -134,7 +134,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal :title="getTitle" class="w-2/5"> <Modal :title="getTitle" class="w-2/5">
<Form class="mx-6"> <Form class="mx-6">
<template #menuIds="slotProps"> <template #menuIds="slotProps">
<VbenTree <Tree
class="max-h-96 overflow-y-auto" class="max-h-96 overflow-y-auto"
:loading="menuLoading" :loading="menuLoading"
:tree-data="menuTree" :tree-data="menuTree"

View File

@@ -4,7 +4,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { SystemDataScopeEnum } from '@vben/constants'; import { SystemDataScopeEnum } from '@vben/constants';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
@@ -134,7 +134,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal title="数据权限" class="w-2/5"> <Modal title="数据权限" class="w-2/5">
<Form class="mx-4"> <Form class="mx-4">
<template #dataScopeDeptIds="slotProps"> <template #dataScopeDeptIds="slotProps">
<VbenTree <Tree
:tree-data="deptTree" :tree-data="deptTree"
multiple multiple
bordered bordered

View File

@@ -4,9 +4,9 @@ import type { Recordable } from '@vben-core/typings';
import type { SystemMenuApi } from '#/api/system/menu'; import type { SystemMenuApi } from '#/api/system/menu';
import type { SystemRoleApi } from '#/api/system/role'; import type { SystemRoleApi } from '#/api/system/role';
import {nextTick, ref} from 'vue'; import { nextTick, ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { SystemMenuTypeEnum } from '@vben/constants'; import { SystemMenuTypeEnum } from '@vben/constants';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
@@ -142,7 +142,7 @@ function getNodeClass(node: Recordable<any>) {
<Modal title="数据权限" class="w-2/5"> <Modal title="数据权限" class="w-2/5">
<Form class="mx-4"> <Form class="mx-4">
<template #menuIds="slotProps"> <template #menuIds="slotProps">
<VbenTree <Tree
:spinning="menuLoading" :spinning="menuLoading"
:tree-data="menuTree" :tree-data="menuTree"
multiple multiple

View File

@@ -4,7 +4,7 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
import { ElCheckbox, ElMessage } from 'element-plus'; import { ElCheckbox, ElMessage } from 'element-plus';
@@ -134,7 +134,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal :title="getTitle" class="w-2/5"> <Modal :title="getTitle" class="w-2/5">
<Form class="mx-6"> <Form class="mx-6">
<template #menuIds="slotProps"> <template #menuIds="slotProps">
<VbenTree <Tree
class="max-h-96 overflow-y-auto" class="max-h-96 overflow-y-auto"
:loading="menuLoading" :loading="menuLoading"
:tree-data="menuTree" :tree-data="menuTree"

View File

@@ -4,7 +4,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
import { NCheckbox } from 'naive-ui'; import { NCheckbox } from 'naive-ui';
@@ -136,9 +136,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal title="数据权限" class="w-[40%]"> <Modal title="数据权限" class="w-[40%]">
<Form class="mx-4"> <Form class="mx-4">
<template #dataScopeDeptIds="slotProps"> <template #dataScopeDeptIds="slotProps">
<!-- <Spin :spinning="deptLoading"> --> <Tree
<!-- TODO @芋艿可优化使用 antd tree原因是更原生 -->
<VbenTree
:tree-data="deptTree" :tree-data="deptTree"
multiple multiple
bordered bordered
@@ -149,7 +147,6 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
:auto-check-parent="false" :auto-check-parent="false"
:check-strictly="!isCheckStrictly" :check-strictly="!isCheckStrictly"
/> />
<!-- </Spin> -->
</template> </template>
</Form> </Form>
<template #prepend-footer> <template #prepend-footer>

View File

@@ -4,7 +4,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
import { NCheckbox } from 'naive-ui'; import { NCheckbox } from 'naive-ui';
@@ -127,9 +127,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal title="数据权限" class="w-[40%]"> <Modal title="数据权限" class="w-[40%]">
<Form class="mx-4"> <Form class="mx-4">
<template #menuIds="slotProps"> <template #menuIds="slotProps">
<!-- <Spin :spinning="menuLoading" class="w-full"> --> <Tree
<!-- TODO @芋艿可优化使用 antd tree原因是更原生 -->
<VbenTree
:tree-data="menuTree" :tree-data="menuTree"
multiple multiple
bordered bordered
@@ -138,7 +136,6 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
value-field="id" value-field="id"
label-field="name" label-field="name"
/> />
<!-- </Spin> -->
</template> </template>
</Form> </Form>
<template #prepend-footer> <template #prepend-footer>

View File

@@ -4,7 +4,7 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui'; import { Tree, useVbenModal } from '@vben/common-ui';
import { handleTree } from '@vben/utils'; import { handleTree } from '@vben/utils';
import { NCheckbox } from 'naive-ui'; import { NCheckbox } from 'naive-ui';
@@ -135,8 +135,7 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
<Modal :title="getTitle" class="w-[40%]"> <Modal :title="getTitle" class="w-[40%]">
<Form class="mx-6"> <Form class="mx-6">
<template #menuIds="slotProps"> <template #menuIds="slotProps">
<!-- TODO @芋艿可优化使用 antd tree原因是更原生 --> <Tree
<VbenTree
class="max-h-[400px] overflow-y-auto" class="max-h-[400px] overflow-y-auto"
:loading="menuLoading" :loading="menuLoading"
:tree-data="menuTree" :tree-data="menuTree"