diff --git a/src/components/DataTable/tools/props.js b/src/components/DataTable/tools/props.js index a65a32d..876a8b7 100644 --- a/src/components/DataTable/tools/props.js +++ b/src/components/DataTable/tools/props.js @@ -12,6 +12,14 @@ export const tableProps = { type: [Object, Boolean], default: () => {} }, + /* 数据格式 */ + dataType: { + type: String, + default: 'flat', + validator: (value) => { + return ['flat', 'tree'].indexOf(value) !== -1 + } + }, /* 分页设置信息 */ paginationSetting: { type: Object, diff --git a/src/components/DataTable/tools/useDataSource.js b/src/components/DataTable/tools/useDataSource.js index 2319c4f..9df01d8 100644 --- a/src/components/DataTable/tools/useDataSource.js +++ b/src/components/DataTable/tools/useDataSource.js @@ -8,7 +8,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL try { /* 设置loading */ setLoading(true) - const { request, pagination, paginationSetting } = unref(propsRef) + const { request, pagination, paginationSetting, dataType } = unref(propsRef) /* 无接口请求中断 */ if (!request) return /* 获取分页信息 */ @@ -43,7 +43,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL } } const resultInfo = res[listField] ? res[listField] : [] - dataSourceRef.value = resultInfo + dataSourceRef.value = dataType === 'tree' ? dealTree(resultInfo) : resultInfo setPagination({ [pageField]: currentPage, [totalField]: Math.ceil(resultTotal / pageSize) @@ -67,6 +67,11 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL } } + function dealTree() { + const tree = [] + return tree + } + const getDataSourceRef = computed(() => { const dataSource = unref(dataSourceRef) if (!dataSource || dataSource.length === 0) { diff --git a/src/layout/components/Tags/index.vue b/src/layout/components/Tags/index.vue index 9b30f9e..e5b9bb2 100644 --- a/src/layout/components/Tags/index.vue +++ b/src/layout/components/Tags/index.vue @@ -90,7 +90,7 @@ const props = defineProps({ }) /* 白名单 */ -const whiteList = ['Login', 'NOT_FOUND'] +const whiteList = ['Login', 'Redirect', 'NOT_FOUND'] /* 基础页面 */ const baseMenu = '/home'