|
@@ -235,66 +235,20 @@
|
|
|
/>
|
|
|
<el-table-column prop="status" label="处理状态" width="100">
|
|
|
<template #default="{ row }">
|
|
|
- <!-- <el-tooltip
|
|
|
- effect="dark"
|
|
|
- placement="top"
|
|
|
- :disabled="
|
|
|
- Number(row.processing_status) !== 1 &&
|
|
|
- Number(row.processing_status) !== 5 &&
|
|
|
- Number(row.processing_status) !== 4
|
|
|
- "
|
|
|
- >
|
|
|
- <template #content>
|
|
|
- <div style="padding: 5px">
|
|
|
- <div style="margin-top: 5px; font-size: 12px">
|
|
|
- {{ row.progress_msg || "正在处理中..." }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <div class="status-wrapper">
|
|
|
- <template v-if="Number(row.processing_status) === 1 || Number(row.processing_status) === 5">
|
|
|
- <div class="progress-wrapper">
|
|
|
- <el-progress
|
|
|
- type="circle"
|
|
|
- :percentage="Math.floor(row.progress) || 0"
|
|
|
- :width="35"
|
|
|
- :stroke-width="4"
|
|
|
- :format="percentFormat"
|
|
|
-
|
|
|
- ></el-progress>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <el-tag :type="getStatusType(row.processing_status)">
|
|
|
- {{ getStatusText(row.processing_status) }}
|
|
|
- </el-tag>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </el-tooltip> -->
|
|
|
<el-tooltip
|
|
|
effect="dark"
|
|
|
placement="top"
|
|
|
- :disabled="
|
|
|
- Number(row.processing_status) !== 1 &&
|
|
|
- Number(row.processing_status) !== 5 &&
|
|
|
- Number(row.processing_status) !== 4
|
|
|
- "
|
|
|
+ :disabled="![1, 3, 5].includes(Number(row.processing_status))"
|
|
|
>
|
|
|
<template #content>
|
|
|
<div style="padding: 5px">
|
|
|
<div style="margin-top: 5px; font-size: 12px">
|
|
|
- {{ row.progress_msg || "正在处理中..." }}
|
|
|
+ {{ row.progress_msg || (row.processing_status === 3 ? "处理失败" : "正在处理中...") }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<div class="status-wrapper">
|
|
|
- <template
|
|
|
- v-if="
|
|
|
- Number(row.processing_status) === 1 ||
|
|
|
- Number(row.processing_status) === 5
|
|
|
- "
|
|
|
- >
|
|
|
- <!-- 移除进度条,改为显示文本 -->
|
|
|
+ <template v-if="[1, 5].includes(Number(row.processing_status))">
|
|
|
<el-tag type="warning">处理中</el-tag>
|
|
|
</template>
|
|
|
<template v-else>
|
|
@@ -517,7 +471,6 @@ export default {
|
|
|
1: { text: "处理中", type: "warning" },
|
|
|
2: { text: "处理完成", type: "success" },
|
|
|
3: { text: "处理失败", type: "danger" },
|
|
|
- 4: { text: "处理失败", type: "danger" },
|
|
|
5: { text: "待处理", type: "warning" },
|
|
|
},
|
|
|
multipleSelection: [], // 存储跨页选中的数据
|
|
@@ -1089,7 +1042,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 修改 fetchGpuList 方法中的分页处理部分
|
|
|
+ // 修改 fetchGpuList 方法
|
|
|
async fetchGpuList() {
|
|
|
this.isLoading = true;
|
|
|
try {
|
|
@@ -1100,52 +1053,42 @@ export default {
|
|
|
tag_names: this.searchForm.id,
|
|
|
create_time_start: this.searchForm.createTimeRange?.[0] || "",
|
|
|
create_time_end: this.searchForm.createTimeRange?.[1] || "",
|
|
|
- update_time_start: this.searchForm.updateTimeRange?.[0] || "", // 新增
|
|
|
- update_time_end: this.searchForm.updateTimeRange?.[1] || "", // 新增
|
|
|
+ update_time_start: this.searchForm.updateTimeRange?.[0] || "",
|
|
|
+ update_time_end: this.searchForm.updateTimeRange?.[1] || "",
|
|
|
processing_status: this.searchForm.processing_status || null,
|
|
|
};
|
|
|
|
|
|
const response = await axios.post(
|
|
|
`${process.env.VUE_APP_BASE_API}/literature-data/search/`,
|
|
|
- params,
|
|
|
- {
|
|
|
- headers: {
|
|
|
- "Content-Type": "application/json",
|
|
|
- },
|
|
|
- }
|
|
|
+ params
|
|
|
);
|
|
|
|
|
|
if (response.status !== 200) return;
|
|
|
|
|
|
// 更新数据和分页信息
|
|
|
const { list, total, current_page, page_size } = response.data.data;
|
|
|
- this.gpuList = list.map((item) => {
|
|
|
+
|
|
|
+ // 处理列表数据
|
|
|
+ this.gpuList = list.map(item => {
|
|
|
const nameParts = item.name.split(".");
|
|
|
- const processedItem = {
|
|
|
+ return {
|
|
|
...item,
|
|
|
name: nameParts[0],
|
|
|
type: nameParts.length > 1 ? nameParts.pop() : "未知",
|
|
|
+ processing_status: Number(item.processing_status)
|
|
|
};
|
|
|
+ });
|
|
|
|
|
|
- // 检查处理状态,如果是处理中且没有设置轮询,则开始轮询
|
|
|
- if (
|
|
|
- processedItem.processing_status === 1 &&
|
|
|
- !this.pollingTimers[processedItem.id]
|
|
|
- ) {
|
|
|
- this.startPolling(processedItem.id);
|
|
|
- }
|
|
|
- // 如果状态不是处理中,但存在轮询,则停止轮询
|
|
|
- else if (
|
|
|
- processedItem.processing_status !== 1 &&
|
|
|
- this.pollingTimers[processedItem.id]
|
|
|
- ) {
|
|
|
- this.stopPolling(processedItem.id);
|
|
|
- }
|
|
|
+ // 获取需要查询详细状态的文献ID(处理中和处理失败的)
|
|
|
+ const needStatusCheckIds = this.gpuList
|
|
|
+ .filter(item => [1, 3, 5].includes(Number(item.processing_status)))
|
|
|
+ .map(item => item.id);
|
|
|
|
|
|
- return processedItem;
|
|
|
- });
|
|
|
+ if (needStatusCheckIds.length > 0) {
|
|
|
+ await this.fetchBatchStatus(needStatusCheckIds);
|
|
|
+ }
|
|
|
|
|
|
- // 确保这些值都是数字类型
|
|
|
+ // 更新分页信息
|
|
|
this.total = parseInt(total);
|
|
|
this.currentPage = parseInt(current_page);
|
|
|
this.pageSize = parseInt(page_size);
|
|
@@ -1156,6 +1099,39 @@ export default {
|
|
|
this.isLoading = false;
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ // 修改批量获取状态的方法
|
|
|
+ async fetchBatchStatus(ids) {
|
|
|
+ try {
|
|
|
+ const statusPromises = ids.map(id => literResult(id));
|
|
|
+ const responses = await Promise.allSettled(statusPromises);
|
|
|
+
|
|
|
+ responses.forEach((response, index) => {
|
|
|
+ if (response.status === 'fulfilled' && response.value.status === 200) {
|
|
|
+ const id = ids[index];
|
|
|
+ const item = this.gpuList.find(item => item.id === id);
|
|
|
+ if (item) {
|
|
|
+ const literatureInfo = response.value.data.data.literature_info;
|
|
|
+ const status = Number(literatureInfo.processing_status);
|
|
|
+
|
|
|
+ // 只更新处理中和处理失败的状态信息
|
|
|
+ if ([1, 3, 5].includes(status)) {
|
|
|
+ this.$set(item, "processing_status", status);
|
|
|
+ this.$set(item, "progress_msg", literatureInfo.status_description);
|
|
|
+
|
|
|
+ // 如果状态是处理中,启动轮询
|
|
|
+ if (status === 1 || status === 5) {
|
|
|
+ this.startPolling(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.error("批量获取状态失败:", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 新增:开始轮询
|
|
|
startPolling(id) {
|
|
|
if (this.pollingTimers[id]) return;
|
|
@@ -1166,20 +1142,13 @@ export default {
|
|
|
if (response.status === 200) {
|
|
|
const item = this.gpuList.find((item) => item.id === id);
|
|
|
if (item) {
|
|
|
- // 使用接口返回的状态数据
|
|
|
- const newStatus = Number(
|
|
|
- response.data.data.literature_info.processing_status
|
|
|
- );
|
|
|
-
|
|
|
- /*进度 const newProgress = Number(
|
|
|
- response.data.data.progress_info.calculated_progress.percentage
|
|
|
- ); */
|
|
|
- const newProgressMsg =
|
|
|
- response.data.data.literature_info.status_description;
|
|
|
+ // 获取状态信息
|
|
|
+ const literatureInfo = response.data.data.literature_info;
|
|
|
+ const newStatus = Number(literatureInfo.processing_status);
|
|
|
+ const newProgressMsg = literatureInfo.status_description;
|
|
|
|
|
|
// 更新状态相关数据
|
|
|
this.$set(item, "processing_status", newStatus);
|
|
|
- /* this.$set(item, "progress", newProgress); */
|
|
|
this.$set(item, "progress_msg", newProgressMsg);
|
|
|
|
|
|
// 根据状态处理结果
|
|
@@ -1188,9 +1157,11 @@ export default {
|
|
|
this.$message.success("处理成功");
|
|
|
this.stopPolling(id);
|
|
|
await this.fetchGpuList();
|
|
|
- } else if (newStatus === 4) {
|
|
|
- // 处理失败
|
|
|
- this.$message.error(newProgressMsg || "处理失败");
|
|
|
+ } else if (newStatus === 3) {
|
|
|
+ // 处理失败 - 保存失败原因
|
|
|
+ const failureReason = literatureInfo.status_description || "处理失败";
|
|
|
+ this.$set(item, "progress_msg", failureReason);
|
|
|
+ this.$message.error(failureReason);
|
|
|
this.stopPolling(id);
|
|
|
} else if (newStatus === 1 || newStatus === 5) {
|
|
|
// 继续轮询
|
|
@@ -1252,6 +1223,7 @@ export default {
|
|
|
name: row.name,
|
|
|
tag: JSON.stringify(row.tags),
|
|
|
identifier: row.identifier,
|
|
|
+ type:row.type
|
|
|
},
|
|
|
});
|
|
|
// 这里可以添加详情处理逻辑
|