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