Ver código fonte

处理聊天应用目录不展示

yangg 8 meses atrás
pai
commit
9aba19e37f
1 arquivos alterados com 10 adições e 10 exclusões
  1. 10 10
      src/components/webAi/js/ChatBox.js

+ 10 - 10
src/components/webAi/js/ChatBox.js

@@ -260,10 +260,10 @@ export default {
         
         try {
           const res = await selectTypeList(typeForm);
-          if (res.data && Array.isArray(res.data)) {
-            this.editDirectoryList = [...new Set([...this.editDirectoryList, ...res.data])];
+          if (res.data) {
+            this.editDirectoryList = [...new Set([...this.editDirectoryList, ...res.data.dataList])];
             
-            res.data.forEach(folder => {
+            res.data.dataList.forEach(folder => {
               if (folder.id === "other") {
                 otherFolderCount += folder.document_count || 0;
               } else {
@@ -517,12 +517,12 @@ export default {
         try {
           const res = await selectTypeList(typeForm);
           // 假设 res.data 包含目录列表
-          if (res.data && Array.isArray(res.data)) {
+          if (res.data) {
             // 将新的目录添加到列表中,避免重复
-            this.directoryList = [...new Set([...this.directoryList, ...res.data])];
-            
+            this.directoryList = [...new Set([...this.directoryList, ...res.data.dataList])];
+            console.log(res.data.dataList);
             // 计算总文档数和其他文件夹数量
-            res.data.forEach(folder => {
+            res.data.dataList.forEach(folder => {
               if (folder.id === "other") {
                 otherFolderCount += folder.document_count || 0;
               } else {
@@ -540,18 +540,18 @@ export default {
       this.directoryList.unshift({
         id: "001",
         name: "全部",
-        document_count: totalDocuments + otherFolderCount,
+       /*  document_count: totalDocuments + otherFolderCount, */
       });
     },
     loadDocumentList(val) {
+      console.log(val);
       let queryForm={
         page: 1,
         pageSize: 9999,
         bucket_id: this.bucket_id,
-        doc_type_id: val[0]=='001'?0 :val[0],
+        doc_type_id: val=='001'?0 :val,
       }
       getBucketContents(queryForm).then(res=>{
-        console.log(res);
         this.documentList=res.data.documents
       })
     },