Merge branch 'master' of http://192.168.11.14:51037/zhangtao/restructure
This commit is contained in:
commit
27310d0324
|
|
@ -12,6 +12,14 @@ export const tableProps = {
|
||||||
type: [Object, Boolean],
|
type: [Object, Boolean],
|
||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
|
/* 数据格式 */
|
||||||
|
dataType: {
|
||||||
|
type: String,
|
||||||
|
default: 'flat',
|
||||||
|
validator: (value) => {
|
||||||
|
return ['flat', 'tree'].indexOf(value) !== -1
|
||||||
|
}
|
||||||
|
},
|
||||||
/* 分页设置信息 */
|
/* 分页设置信息 */
|
||||||
paginationSetting: {
|
paginationSetting: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
|
||||||
try {
|
try {
|
||||||
/* 设置loading */
|
/* 设置loading */
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const { request, pagination, paginationSetting } = unref(propsRef)
|
const { request, pagination, paginationSetting, dataType } = unref(propsRef)
|
||||||
/* 无接口请求中断 */
|
/* 无接口请求中断 */
|
||||||
if (!request) return
|
if (!request) return
|
||||||
/* 获取分页信息 */
|
/* 获取分页信息 */
|
||||||
|
|
@ -43,7 +43,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const resultInfo = res[listField] ? res[listField] : []
|
const resultInfo = res[listField] ? res[listField] : []
|
||||||
dataSourceRef.value = resultInfo
|
dataSourceRef.value = dataType === 'tree' ? dealTree(resultInfo) : resultInfo
|
||||||
setPagination({
|
setPagination({
|
||||||
[pageField]: currentPage,
|
[pageField]: currentPage,
|
||||||
[totalField]: Math.ceil(resultTotal / pageSize)
|
[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 getDataSourceRef = computed(() => {
|
||||||
const dataSource = unref(dataSourceRef)
|
const dataSource = unref(dataSourceRef)
|
||||||
if (!dataSource || dataSource.length === 0) {
|
if (!dataSource || dataSource.length === 0) {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ const props = defineProps({
|
||||||
})
|
})
|
||||||
|
|
||||||
/* 白名单 */
|
/* 白名单 */
|
||||||
const whiteList = ['Login', 'NOT_FOUND']
|
const whiteList = ['Login', 'Redirect', 'NOT_FOUND']
|
||||||
/* 基础页面 */
|
/* 基础页面 */
|
||||||
const baseMenu = '/home'
|
const baseMenu = '/home'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue