|
|
@@ -273,9 +273,12 @@ const rootDeptOriginId = ref<TreeKey | undefined>(undefined)
|
|
|
const rootNodeName = ref('')
|
|
|
const treeOriginIdMap = ref<Record<string, TreeKey | undefined>>({})
|
|
|
|
|
|
-const filterFileListMode = (rows: FileRow[] = []) => {
|
|
|
- if (fileViewMode.value !== 'file') return rows
|
|
|
- return rows.filter((row) => row.fileType === 'file')
|
|
|
+const normalizeListData = (data: any) => {
|
|
|
+ if (fileViewMode.value !== 'file') return Array.isArray(data) ? data : []
|
|
|
+
|
|
|
+ if (Array.isArray(data)) return data
|
|
|
+ if (Array.isArray(data?.list)) return data.list
|
|
|
+ return []
|
|
|
}
|
|
|
|
|
|
const getCurrentListApi = () => {
|
|
|
@@ -322,7 +325,7 @@ const searchFolderAndFile = async () => {
|
|
|
try {
|
|
|
syncSelectedTreeOriginId()
|
|
|
const data = await getCurrentListApi()(queryParams)
|
|
|
- list.value = filterFileListMode(data)
|
|
|
+ list.value = normalizeListData(data)
|
|
|
} finally {
|
|
|
formLoading.value = false
|
|
|
queryParams.filename = ''
|
|
|
@@ -582,7 +585,7 @@ const getList = async () => {
|
|
|
syncSelectedTreeOriginId()
|
|
|
const api = getCurrentListApi()
|
|
|
const data = await api(queryParams)
|
|
|
- list.value = filterFileListMode(data)
|
|
|
+ list.value = normalizeListData(data)
|
|
|
} finally {
|
|
|
formLoading.value = false
|
|
|
}
|