瀏覽代碼

修改其他

yangg 9 月之前
父節點
當前提交
dd109e2dfa

文件差異過大導致無法顯示
+ 0 - 0
dist/index.html


文件差異過大導致無法顯示
+ 0 - 0
dist/static/css/chunk-4e1d7f6a.5ed2ceaa.css


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.65ce1d84.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-0313b4f9.04f4967e.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-2043d8d9.4d951597.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-4e1d7f6a.a5105aa3.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-b4ab3520.87d8538f.js


+ 10 - 0
src/api/knowledge.js

@@ -178,3 +178,13 @@ export function batchMove(data) {
     data
   })
 }
+
+/* docType/selectType0 */
+
+export function selectType0(data) {
+  return request({
+    url: '/docType/selectType0',
+    method: 'post',
+    data
+  })
+}

+ 68 - 52
src/views/knowledgeMenu/category/knowledgeSet.vue

@@ -375,6 +375,7 @@ import {
   deleteType,
   Info,
   batchMove,
+  selectType0
 } from "@/api/knowledge";
 export default {
   components: {
@@ -575,47 +576,59 @@ export default {
     },
 
     typeList() {
-      this.loading = true;
-      selectTypeList(this.typeForm)
-        .then((res) => {
-          if (res.status === 200) {
-            const folderList = res.data.dataList.map((folder) => ({
-              ...folder,
-              id: folder.id === 0 ? "001" : folder.id.toString(),
-              document_count: folder.document_count || 0,
-            }));
+  this.loading = true;
+  Promise.all([
+    selectTypeList(this.typeForm),
+    selectType0({ type_id: 0 })
+  ])
+    .then(([typeListRes, type0Res]) => {
+      if (typeListRes.status === 200 && type0Res.status === 200) {
+        const folderList = typeListRes.data.dataList.map((folder) => ({
+          ...folder,
+          id: folder.id === 0 ? "001" : folder.id.toString(),
+          document_count: folder.document_count || 0,
+        }));
 
-            this.folders = [
-              {
-                id: "001",
-                name: "全部",
-                document_count: folderList.reduce(
-                  (sum, folder) => sum + folder.document_count,
-                  0
-                ),
-              },
-              ...folderList.filter((folder) => folder.id !== "001"),
-              {
-                id: 0, // 给"其他"文件夹一个不同的 id
-                name: "其他",
-                document_count: 0, // 这个值会在 search 方法中更新
-              },
-            ];
-            this.$nextTick(() => {
-              this.initializeTree();
-            });
-          } else {
-            this.$message.error("获取文件夹列表失败");
-          }
-        })
-        .catch((error) => {
-          console.error("获取文件夹列表时出错:", error);
-          this.$message.error("获取文件夹列表时出错");
-        })
-        .finally(() => {
-          this.loading = false;
+        // Calculate total documents
+        const totalDocuments = folderList.reduce(
+          (sum, folder) => sum + folder.document_count,
+          0
+        );
+
+        // Get the count of "其他" documents from selectType0 response
+        const otherFolderCount = type0Res.data || 0;
+
+        this.folders = [
+          {
+            id: "001",
+            name: "全部",
+            document_count: totalDocuments + otherFolderCount,
+          },
+          ...folderList.filter(
+            (folder) => folder.id !== "001" && folder.id !== 0
+          ),
+          {
+            id: 0,
+            name: "其他",
+            document_count: otherFolderCount,
+          },
+        ];
+
+        this.$nextTick(() => {
+          this.initializeTree();
         });
-    },
+      } else {
+        this.$message.error("获取文件夹列表失败");
+      }
+    })
+    .catch((error) => {
+      console.error("获取文件夹列表时出错:", error);
+      this.$message.error("获取文件夹列表时出错");
+    })
+    .finally(() => {
+      this.loading = false;
+    });
+},
 
     initializeTree() {
       this.$nextTick(() => {
@@ -1000,9 +1013,9 @@ export default {
           _this.queryForm.pageSize = res.data.pagination.total_size;
           _this.loading = false;
 
-          // Count documents with doc_type_id === 0 or null
+       /*    // Count documents with doc_type_id === 0 or null
           const unclassifiedCount = res.data.documents.filter(
-            (doc) => !doc.doc_type_id || doc.doc_type_id === 0
+            (doc) => !doc.doc_type_id || doc.doc_type_id === '0'
           ).length;
 
           // Update "其他" folder count
@@ -1011,19 +1024,22 @@ export default {
             otherFolder.document_count = unclassifiedCount;
           }
 
-          // Update the selected folder count if it's not "全部" or "其他"
-          if (
-            _this.queryForm.doc_type_id &&
-            _this.queryForm.doc_type_id !== 0
-          ) {
-            const selectedFolder = _this.folders.find(
-              (f) => f.id === _this.queryForm.doc_type_id
-            );
-            if (selectedFolder) {
-              selectedFolder.document_count = _this.recordCount;
-            }
+          // Update "全部" folder count
+          const allFolder = _this.folders.find((f) => f.id === "001");
+          if (allFolder) {
+            allFolder.document_count = res.data.pagination.total_count;
           }
 
+          // Update other folder counts
+          _this.folders.forEach((folder) => {
+            if (folder.id !== "001" && folder.id !== 0) {
+              const folderCount = res.data.documents.filter(
+                (doc) => doc.doc_type_id === folder.id
+              ).length;
+              folder.document_count = folderCount;
+            }
+          }); */
+
           // Initialize the analysis status for each row
           _this.dataList.forEach((row) => {
             if (row.run === 1) {

部分文件因文件數量過多而無法顯示