refactor: tree.ts 使用@vben/utils替换

This commit is contained in:
xingyu4j
2025-04-23 17:27:48 +08:00
parent ecf10c0539
commit dccb846bb0
11 changed files with 81 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
// todo @芋艿:公用逻辑
// 已迁移,后续使用 packages/core/base/shared/src/utils/tree.ts 下的方法
interface TreeNode {
[key: string]: any;
children?: TreeNode[];

View File

@@ -10,12 +10,11 @@ import { h } from 'vue';
import { useAccess } from '@vben/access';
import { IconifyIcon } from '@vben/icons';
import { $t } from '@vben/locales';
import { getRangePickerDefaultProps } from '@vben/utils';
import { getRangePickerDefaultProps, handleTree } from '@vben/utils';
import { getDataSourceConfigList } from '#/api/infra/data-source-config';
import { getMenuList } from '#/api/system/menu';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { handleTree } from '#/utils/tree';
const { hasAccessByCodes } = useAccess();

View File

@@ -5,10 +5,9 @@ import type { OnActionClickFn } from '#/adapter/vxe-table';
import type { Demo02CategoryApi } from '#/api/infra/demo/demo02';
import { useAccess } from '@vben/access';
import { getRangePickerDefaultProps } from '@vben/utils';
import { getRangePickerDefaultProps, handleTree } from '@vben/utils';
import { getDemo02CategoryList } from '#/api/infra/demo/demo02';
import { handleTree } from '#/utils/tree';
const { hasAccessByCodes } = useAccess();

View File

@@ -5,13 +5,13 @@ import type { OnActionClickFn } from '#/adapter/vxe-table';
import type { SystemDeptApi } from '#/api/system/dept';
import { useAccess } from '@vben/access';
import { handleTree } from '@vben/utils';
import { z } from '#/adapter/form';
import { getDeptList } from '#/api/system/dept';
import { getSimpleUserList } from '#/api/system/user';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { handleTree } from '#/utils/tree';
const { hasAccessByCodes } = useAccess();

View File

@@ -8,7 +8,7 @@ import { h } from 'vue';
import { useAccess } from '@vben/access';
import { IconifyIcon } from '@vben/icons';
import { isHttpUrl } from '@vben/utils';
import { handleTree, isHttpUrl } from '@vben/utils';
import { z } from '#/adapter/form';
import { getMenuList } from '#/api/system/menu';
@@ -16,7 +16,6 @@ import { $t } from '#/locales';
import { componentKeys } from '#/router/routes';
import { CommonStatusEnum, SystemMenuTypeEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { handleTree } from '#/utils/tree';
const { hasAccessByCodes } = useAccess();

View File

@@ -5,6 +5,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui';
import { handleTree } from '@vben/utils';
import { Checkbox, message, Spin } from 'ant-design-vue';
@@ -14,7 +15,6 @@ import { assignRoleDataScope } from '#/api/system/permission';
import { getRole } from '#/api/system/role';
import { $t } from '#/locales';
import { SystemDataScopeEnum } from '#/utils/constants';
import { handleTree } from '#/utils/tree';
import { useAssignDataPermissionFormSchema } from '../data';

View File

@@ -5,6 +5,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui';
import { handleTree } from '@vben/utils';
import { Checkbox, message, Spin } from 'ant-design-vue';
@@ -12,7 +13,6 @@ import { useVbenForm } from '#/adapter/form';
import { getMenuList } from '#/api/system/menu';
import { assignRoleMenu, getRoleMenuList } from '#/api/system/permission';
import { $t } from '#/locales';
import { handleTree } from '#/utils/tree';
import { useAssignMenuFormSchema } from '../data';

View File

@@ -5,6 +5,7 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { computed, ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui';
import { handleTree } from '@vben/utils';
import { Checkbox, message } from 'ant-design-vue';
@@ -16,7 +17,6 @@ import {
updateTenantPackage,
} from '#/api/system/tenant-package';
import { $t } from '#/locales';
import { handleTree } from '#/utils/tree';
import { useFormSchema } from '../data';

View File

@@ -3,7 +3,7 @@ import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemUserApi } from '#/api/system/user';
import { useAccess } from '@vben/access';
import { getRangePickerDefaultProps } from '@vben/utils';
import { getRangePickerDefaultProps, handleTree } from '@vben/utils';
import { z } from '#/adapter/form';
import { getDeptList } from '#/api/system/dept';
@@ -11,7 +11,6 @@ import { getSimplePostList } from '#/api/system/post';
import { getSimpleRoleList } from '#/api/system/role';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { handleTree } from '#/utils/tree';
const { hasAccessByCodes } = useAccess();

View File

@@ -4,11 +4,11 @@ import type { SystemDeptApi } from '#/api/system/dept';
import { onMounted, ref } from 'vue';
import { Search } from '@vben/icons';
import { handleTree } from '@vben/utils';
import { Input, Spin, Tree } from 'ant-design-vue';
import { getSimpleDeptList } from '#/api/system/dept';
import { handleTree } from '#/utils/tree';
const emit = defineEmits(['select']);
const deptList = ref<SystemDeptApi.Dept[]>([]); // 部门列表