|
@@ -375,6 +375,7 @@ import {
|
|
deleteType,
|
|
deleteType,
|
|
Info,
|
|
Info,
|
|
batchMove,
|
|
batchMove,
|
|
|
|
+ selectType0
|
|
} from "@/api/knowledge";
|
|
} from "@/api/knowledge";
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -575,47 +576,59 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
typeList() {
|
|
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() {
|
|
initializeTree() {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -1000,9 +1013,9 @@ 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;
|
|
|
|
|
|
// Update "其他" folder count
|
|
// Update "其他" folder count
|
|
@@ -1011,19 +1024,22 @@ export default {
|
|
otherFolder.document_count = unclassifiedCount;
|
|
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
|
|
// Initialize the analysis status for each row
|
|
_this.dataList.forEach((row) => {
|
|
_this.dataList.forEach((row) => {
|
|
if (row.run === 1) {
|
|
if (row.run === 1) {
|