lsc 6 月之前
父節點
當前提交
10b5c97911

+ 48 - 4
src/components/pages/knowledge/fileBox.vue

@@ -485,6 +485,28 @@ export default {
           headers: {
             "Content-Type": "multipart/form-data"
           }
+        }).then(res => {
+          console.log(res, formData);
+          const message = res.data.results && res.data.results.message;
+          const status = message === 'Document created and ingested successfully.' ? 'success' : 'failed';
+          const msg = message === 'Document created and ingested successfully.' ? '上传成功' : '上传失败';
+          this.$message({
+            message: msg,
+            type: status == 'success' ? status : 'error'
+          })
+          this.fileArray.forEach(e => {
+            if (e.documentid === uuid) {
+              e.ingestionStatus = status;
+            }
+          });
+        }).catch(err => {
+          this.$message.error('上传失败')
+          this.fileArray.forEach(e => {
+            if (e.documentid === uuid) {
+              e.ingestionStatus = 'failed';
+            }
+          });
+          console.error(err);
         });
 
         let params = {
@@ -496,7 +518,7 @@ export default {
         };
         const res2 = await this.ajax.post(this.$store.state.api + "addFile", [
           params
-        ]);
+        ]);        
       } catch (err) {
         console.error(err);
         this.$message.error("上传失败");
@@ -555,12 +577,12 @@ export default {
       this.deleteFile(array.join(","), array2.join(","));
     },
     checkFile(row) {
-      if (row.ingestionStatus == "augmenting") return this.$message.info('正在上传中,点击刷新查看实时状态')
+      if (row.ingestionStatus != "success") return this.$message.info('文件未上传成功,点击刷新查看实时状态')
 
       this.$refs.checkDialog.openG(row.documentid);
     },
     extractFile(row) {
-      if (row.ingestionStatus == "augmenting") return this.$message.info('正在上传中,点击刷新查看实时状态')
+      if (row.ingestionStatus != "success") return this.$message.info('文件未上传成功,点击刷新查看实时状态')
       
       let params = {
         documentid: row.documentid
@@ -569,7 +591,29 @@ export default {
       try {
         const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
           params
-        ]);
+        ]).then(res => {
+          console.log(res, row);
+          const message = res.data.result && res.data.result.message;
+          const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
+          const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
+          this.$message({
+            message: msg,
+            type: status == 'success' ? status : 'error'
+          })
+          this.fileArray.forEach(e => {
+            if (e.documentid === row.documentid) {
+              e.extractionStatus = status;
+            }
+          });
+        }).catch(err => {
+          this.$message.error('提取失败')
+          this.fileArray.forEach(e => {
+            if (e.documentid === row.documentid) {
+              e.extractionStatus = 'failed';
+            }
+          });
+          console.error(err);
+        });
         console.log(res.data);
         this.$message.success("提取文件中");
         this.getData();

+ 1 - 1
src/components/pages/knowledge/folder.vue

@@ -649,7 +649,7 @@ export default {
           this.total = res.data[0].length ? res.data[0][0].num : 0;
           this.fileArray = res.data[0];
           if (
-            res.data[1].length == 0
+            type[0] == "0" && res.data[1].length == 0
           ) {
             this.folderName = "默认文件夹";
             this.folderDescription = "该文件夹为系统创设,将自动关联您所有上传的文件";

+ 48 - 3
src/components/pages/knowledge/folderFileBox.vue

@@ -555,6 +555,28 @@ export default {
           headers: {
             "Content-Type": "multipart/form-data"
           }
+        }).then(res => {
+          console.log(res, formData);
+          const message = res.data.results && res.data.results.message;
+          const status = message === 'Document created and ingested successfully.' ? 'success' : 'failed';
+          const msg = message === 'Document created and ingested successfully.' ? '上传成功' : '上传失败';
+          this.$message({
+            message: msg,
+            type: status == 'success' ? status : 'error'
+          })
+          this.fileArray.forEach(e => {
+            if (e.documentid === uuid) {
+              e.ingestionStatus = status;
+            }
+          });
+        }).catch(err => {
+          this.$message.error('上传失败')
+          this.fileArray.forEach(e => {
+            if (e.documentid === uuid) {
+              e.ingestionStatus = 'failed';
+            }
+          });
+          console.error(err);
         });
 
         let docid = uuid;
@@ -676,12 +698,12 @@ export default {
       this.$refs.relateFiles.openG(this.userid, this.folderid, this.moFolderid);
     },
     checkFile(row) {
-      if (row.ingestionStatus == "augmenting") return this.$message.info('正在上传中,点击刷新查看实时状态')
+      if (row.ingestionStatus != "success") return this.$message.info('文件未上传成功,点击刷新查看实时状态')
 
       this.$refs.checkDialog.openG(row.documentid);
     },
     extractFile(row) {
-      if (row.ingestionStatus == "augmenting") return this.$message.info('正在上传中,点击刷新查看实时状态')
+      if (row.ingestionStatus != "success") return this.$message.info('文件未上传成功,点击刷新查看实时状态')
 
       let params = {
         documentid: row.documentid
@@ -690,7 +712,30 @@ export default {
       try {
         const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
           params
-        ]);
+        ]).then(res => {
+          console.log(res, row);
+          const message = res.data.result && res.data.result.message;
+          const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
+          const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
+          this.$message({
+            message: msg,
+            type: status == 'success' ? status : 'error'
+          })
+          this.fileArray.forEach(e => {
+            if (e.documentid === row.documentid) {
+              e.extractionStatus = status;
+            }
+          });
+        }).catch(err => {
+          this.$message.error('提取失败')
+          this.fileArray.forEach(e => {
+            if (e.documentid === row.documentid) {
+              e.extractionStatus = 'failed';
+            }
+          });
+          console.error(err);
+        });;
+
         console.log(res.data);
         this.$message.success("提取文件中");
         this.getData();

+ 2 - 1
src/components/pages/knowledge/index.vue

@@ -92,7 +92,8 @@ export default {
       addVisbile2: '',
       isLoading: false,
       typeArray: [
-        { name: '我的文件夹',child: [], id: '0', open:true }
+        { name: '我的文件夹',child: [], id: '0', open:true },
+        // { name: '共享文件夹',child: [], id: '1' }
       ],
       actionType: '',
       renameType: '',