|
@@ -375,7 +375,7 @@ import {
|
|
deleteType,
|
|
deleteType,
|
|
Info,
|
|
Info,
|
|
batchMove,
|
|
batchMove,
|
|
- selectType0
|
|
|
|
|
|
+ selectType0,
|
|
} from "@/api/knowledge";
|
|
} from "@/api/knowledge";
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -576,59 +576,56 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
typeList() {
|
|
typeList() {
|
|
- 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.loading = true;
|
|
|
|
+ Promise.all([selectTypeList(this.typeForm), selectType0({ kb_id:this.typeForm.kb_id,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,
|
|
|
|
+ }));
|
|
|
|
|
|
- // Calculate total documents
|
|
|
|
- const totalDocuments = folderList.reduce(
|
|
|
|
- (sum, folder) => sum + folder.document_count,
|
|
|
|
- 0
|
|
|
|
- );
|
|
|
|
|
|
+ // 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;
|
|
|
|
|
|
+ // 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.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();
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.initializeTree();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error("获取文件夹列表失败");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.error("获取文件夹列表时出错:", error);
|
|
|
|
+ this.$message.error("获取文件夹列表时出错");
|
|
|
|
+ })
|
|
|
|
+ .finally(() => {
|
|
|
|
+ this.loading = false;
|
|
});
|
|
});
|
|
- } else {
|
|
|
|
- this.$message.error("获取文件夹列表失败");
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch((error) => {
|
|
|
|
- console.error("获取文件夹列表时出错:", error);
|
|
|
|
- this.$message.error("获取文件夹列表时出错");
|
|
|
|
- })
|
|
|
|
- .finally(() => {
|
|
|
|
- this.loading = false;
|
|
|
|
- });
|
|
|
|
-},
|
|
|
|
|
|
+ },
|
|
|
|
|
|
initializeTree() {
|
|
initializeTree() {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -1013,7 +1010,7 @@ export default {
|
|
_this.queryForm.pageSize = res.data.pagination.total_size;
|
|
_this.queryForm.pageSize = res.data.pagination.total_size;
|
|
_this.loading = false;
|
|
_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(
|
|
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;
|
|
).length;
|