|
@@ -485,6 +485,28 @@ export default {
|
|
headers: {
|
|
headers: {
|
|
"Content-Type": "multipart/form-data"
|
|
"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 = {
|
|
let params = {
|
|
@@ -496,7 +518,7 @@ export default {
|
|
};
|
|
};
|
|
const res2 = await this.ajax.post(this.$store.state.api + "addFile", [
|
|
const res2 = await this.ajax.post(this.$store.state.api + "addFile", [
|
|
params
|
|
params
|
|
- ]);
|
|
|
|
|
|
+ ]);
|
|
} catch (err) {
|
|
} catch (err) {
|
|
console.error(err);
|
|
console.error(err);
|
|
this.$message.error("上传失败");
|
|
this.$message.error("上传失败");
|
|
@@ -555,12 +577,12 @@ export default {
|
|
this.deleteFile(array.join(","), array2.join(","));
|
|
this.deleteFile(array.join(","), array2.join(","));
|
|
},
|
|
},
|
|
checkFile(row) {
|
|
checkFile(row) {
|
|
- if (row.ingestionStatus == "augmenting") return this.$message.info('正在上传中,点击刷新查看实时状态')
|
|
|
|
|
|
+ if (row.ingestionStatus != "success") return this.$message.info('文件未上传成功,点击刷新查看实时状态')
|
|
|
|
|
|
this.$refs.checkDialog.openG(row.documentid);
|
|
this.$refs.checkDialog.openG(row.documentid);
|
|
},
|
|
},
|
|
extractFile(row) {
|
|
extractFile(row) {
|
|
- if (row.ingestionStatus == "augmenting") return this.$message.info('正在上传中,点击刷新查看实时状态')
|
|
|
|
|
|
+ if (row.ingestionStatus != "success") return this.$message.info('文件未上传成功,点击刷新查看实时状态')
|
|
|
|
|
|
let params = {
|
|
let params = {
|
|
documentid: row.documentid
|
|
documentid: row.documentid
|
|
@@ -569,7 +591,29 @@ export default {
|
|
try {
|
|
try {
|
|
const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
|
|
const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
|
|
params
|
|
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);
|
|
console.log(res.data);
|
|
this.$message.success("提取文件中");
|
|
this.$message.success("提取文件中");
|
|
this.getData();
|
|
this.getData();
|