余菲 2 years ago
parent
commit
27310d0324
3 changed files with 16 additions and 3 deletions
  1. +8
    -0
      src/components/DataTable/tools/props.js
  2. +7
    -2
      src/components/DataTable/tools/useDataSource.js
  3. +1
    -1
      src/layout/components/Tags/index.vue

+ 8
- 0
src/components/DataTable/tools/props.js View File

@@ -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,

+ 7
- 2
src/components/DataTable/tools/useDataSource.js View File

@@ -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) {

+ 1
- 1
src/layout/components/Tags/index.vue View File

@@ -90,7 +90,7 @@ const props = defineProps({
})

/* 白名单 */
const whiteList = ['Login', 'NOT_FOUND']
const whiteList = ['Login', 'Redirect', 'NOT_FOUND']
/* 基础页面 */
const baseMenu = '/home'


Loading…
Cancel
Save