|
@@ -158,18 +158,22 @@
|
|
|
effect="dark"
|
|
|
placement="top"
|
|
|
:disabled="
|
|
|
- Number(scope.row.run) !== 1 && Number(scope.row.run) !== 4
|
|
|
+ ![1, 4, 7].includes(Number(scope.row.run))
|
|
|
"
|
|
|
>
|
|
|
<template #content>
|
|
|
<div style="padding: 5px">
|
|
|
<div style="margin-top: 5px; font-size: 12px">
|
|
|
- {{ scope.row.progress_msg || "正在解析中..." }}
|
|
|
+ {{
|
|
|
+ Number(scope.row.run) === 7
|
|
|
+ ? (scope.row.progress_msg || "正在生成问答对...")
|
|
|
+ : (scope.row.progress_msg || "正在解析中...")
|
|
|
+ }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<div class="status-wrapper">
|
|
|
- <template v-if="Number(scope.row.run) === 1">
|
|
|
+ <template v-if="Number(scope.row.run) === 1||Number(scope.row.run) === 6">
|
|
|
<div class="progress-wrapper">
|
|
|
<el-progress
|
|
|
type="circle"
|
|
@@ -872,12 +876,13 @@ export default {
|
|
|
/* 状态展示 */
|
|
|
getStatusType(status) {
|
|
|
const statusMap = {
|
|
|
- 0: "info", // 未解析
|
|
|
+ 0: "info", // 未解析
|
|
|
1: "warning", // 解析中
|
|
|
- 3: "success", // 成功
|
|
|
- 4: "danger", // 失败
|
|
|
- 5: "info", // 待解析
|
|
|
- 6: "danger", // 文件异常
|
|
|
+ 3: "success", // 解析成功,问答对生成成功
|
|
|
+ 4: "danger", // 解析失败
|
|
|
+ 5: "info", // 待解析
|
|
|
+ 6: "warning", // 待生成问答对
|
|
|
+ 7: "danger" // 解析成功,问答对生成失败
|
|
|
};
|
|
|
return statusMap[status] || "info";
|
|
|
},
|
|
@@ -886,10 +891,11 @@ export default {
|
|
|
const statusMap = {
|
|
|
0: "未解析",
|
|
|
1: "解析中",
|
|
|
- 3: "解析成功",
|
|
|
+ 3: "处理成功",
|
|
|
4: "解析失败",
|
|
|
- 5: "待解析",
|
|
|
- 6: "文件异常",
|
|
|
+ 5: "待解析",
|
|
|
+ 6: "待生成问答对",
|
|
|
+ 7: "处理失败"
|
|
|
};
|
|
|
return statusMap[status] || "未知状态";
|
|
|
},
|
|
@@ -1361,7 +1367,7 @@ export default {
|
|
|
},
|
|
|
/* 解析 */
|
|
|
analysis(row) {
|
|
|
- if (row.run == 1 || row.run == 5) return;
|
|
|
+ if (row.run == 1 || row.run == 5 || row.run == 6) return;
|
|
|
|
|
|
// Set the status to "解析中" (1) immediately
|
|
|
this.$set(row, "run", 1);
|
|
@@ -1398,75 +1404,55 @@ export default {
|
|
|
},
|
|
|
/* 任务监控 */
|
|
|
startAnalysisStatusChecker(row) {
|
|
|
- // Clear any existing checker for this row
|
|
|
+ // 清除该行已存在的检查器
|
|
|
if (this.analysisStatusCheckers[row.id]) {
|
|
|
clearTimeout(this.analysisStatusCheckers[row.id]);
|
|
|
}
|
|
|
- /* 获取token数 */
|
|
|
- /* const checkStatus = () => {
|
|
|
- getdocpro({ document_id: row.id })
|
|
|
- .then((res) => {
|
|
|
- if (res.status === 200) {
|
|
|
- const newStatus = Number(res.data.status);
|
|
|
- const newProgress = Number(res.data.total_tasks);
|
|
|
- this.$set(row, "run", newStatus);
|
|
|
- this.$set(row, "progress", newProgress);
|
|
|
|
|
|
- if (newStatus === 3) {
|
|
|
- this.$message.success("解析成功");
|
|
|
- delete this.analysisStatusCheckers[row.id];
|
|
|
- // 在这里添加刷新列表的逻辑
|
|
|
- this.refreshCurrentList();
|
|
|
- } else if (newStatus === 4) {
|
|
|
- this.$message.error("解析失败");
|
|
|
- delete this.analysisStatusCheckers[row.id];
|
|
|
- } else if (newStatus === 1 || newStatus === 5) {
|
|
|
- // Continue checking
|
|
|
- this.analysisStatusCheckers[row.id] = setTimeout(
|
|
|
- checkStatus,
|
|
|
- 15000
|
|
|
- );
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error("获取解析状态失败");
|
|
|
- delete this.analysisStatusCheckers[row.id];
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- console.error("获取解析状态错误:", error);
|
|
|
- this.$message.error("获取解析状态时出现错误");
|
|
|
- delete this.analysisStatusCheckers[row.id];
|
|
|
- });
|
|
|
- }; */
|
|
|
- /* 监控任务 */
|
|
|
const checkStatus = () => {
|
|
|
resultTask(row.id)
|
|
|
.then((res) => {
|
|
|
if (res.status === 200) {
|
|
|
const newStatus = Number(res.data.document_status);
|
|
|
- const newProgress =
|
|
|
- Number(res.data.progress) == 100
|
|
|
- ? 0
|
|
|
- : Number(res.data.progress);
|
|
|
+ const newProgress = Number(res.data.progress) === 100 ? 0 : Number(res.data.progress);
|
|
|
const newProgressMsg = res.data.progress_msg;
|
|
|
+
|
|
|
+ // 更新状态和进度
|
|
|
this.$set(row, "run", newStatus);
|
|
|
this.$set(row, "progress", newProgress);
|
|
|
this.$set(row, "progress_msg", newProgressMsg);
|
|
|
|
|
|
- if (newStatus === 3) {
|
|
|
- this.$message.success("解析成功");
|
|
|
- delete this.analysisStatusCheckers[row.id];
|
|
|
- // 在这里添加刷新列表的逻辑
|
|
|
- this.refreshCurrentList();
|
|
|
- } else if (newStatus === 4) {
|
|
|
- this.$message.error("解析失败");
|
|
|
- delete this.analysisStatusCheckers[row.id];
|
|
|
- } else if (newStatus === 1 || newStatus === 5) {
|
|
|
- // Continue checking
|
|
|
- this.analysisStatusCheckers[row.id] = setTimeout(
|
|
|
- checkStatus,
|
|
|
- 15000
|
|
|
- );
|
|
|
+ // 根据不同状态处理
|
|
|
+ switch (newStatus) {
|
|
|
+ case 3: // 解析成功
|
|
|
+ this.$message.success("解析成功");
|
|
|
+ delete this.analysisStatusCheckers[row.id];
|
|
|
+ this.refreshCurrentList();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 4: // 解析失败
|
|
|
+ this.$message.error(newProgressMsg || "解析失败");
|
|
|
+ delete this.analysisStatusCheckers[row.id];
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 1: // 解析中
|
|
|
+ case 5: // 待解析
|
|
|
+ case 6: // 待生成问答对
|
|
|
+ case 7: // 解析成功,问答对生成失败
|
|
|
+ // 设置检查间隔
|
|
|
+ const checkInterval = newStatus === 6 ? 5000 : 15000;
|
|
|
+
|
|
|
+ // 更新进度信息
|
|
|
+ if (newStatus === 6) {
|
|
|
+ this.$set(row, "progress_msg", "正在生成问答对...");
|
|
|
+ } else if (newStatus === 7) {
|
|
|
+ const progressMsg = res.data.Result?.message || "问答对生成失败";
|
|
|
+ this.$set(row, "progress_msg", progressMsg);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 继续检查状态
|
|
|
+ this.analysisStatusCheckers[row.id] = setTimeout(checkStatus, checkInterval);
|
|
|
+ break;
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.error("获取解析状态失败");
|
|
@@ -1480,7 +1466,7 @@ export default {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- // Start checking immediately
|
|
|
+ // 立即开始检查
|
|
|
checkStatus();
|
|
|
},
|
|
|
|
|
@@ -1703,7 +1689,7 @@ export default {
|
|
|
|
|
|
// Initialize the analysis status for each row
|
|
|
_this.dataList.forEach((row) => {
|
|
|
- if (row.run == 1 || row.run == 5) {
|
|
|
+ if (row.run == 1 || row.run == 5 || row.run == 6) {
|
|
|
_this.startAnalysisStatusChecker(row);
|
|
|
}
|
|
|
});
|