This commit is contained in:
2025-10-30 16:52:22 +08:00
parent edec1cbc08
commit 1acc3f7a9a
2 changed files with 40 additions and 2 deletions

View File

@@ -43,3 +43,11 @@ export function listItems(taskId) {
})
}
// 手动重试任务
export function retryTask(taskId) {
return request({
url: '/jarvis/batchPublish/task/retry/' + taskId,
method: 'post'
})
}

View File

@@ -546,9 +546,11 @@
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" width="160"/>
<el-table-column label="操作" width="100" align="center">
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="viewTaskDetail(scope.row)">查看详情</el-button>
<el-divider direction="vertical"></el-divider>
<el-button type="text" size="small" @click="onRetryTask(scope.row)">重试未执行</el-button>
</template>
</el-table-column>
</el-table>
@@ -655,7 +657,7 @@
</template>
<script>
import { parseLineReport, batchPublish, listTasks, getTask, listItems } from "@/api/jarvis/batchPublish";
import { parseLineReport, batchPublish, listTasks, getTask, listItems, retryTask } from "@/api/jarvis/batchPublish";
import { getERPAccounts, getUsernames, getProvinces, getCities, getAreas, getCategories } from "@/api/system/jdorder";
import Pagination from "@/components/Pagination";
@@ -1266,6 +1268,34 @@ export default {
this.$modal.msgError("加载任务详情失败");
}
},
// 触发后端重试该任务的未执行明细
async onRetryTask(task) {
try {
await this.$confirm(`确定要重试任务【${task.taskName || task.id}】的未执行明细吗?`, '提示', { type: 'warning' });
} catch {
return;
}
try {
const res = await retryTask(task.id);
if (res.code === 200) {
this.$modal.msgSuccess('已触发重试');
// 刷新历史列表
this.loadHistory();
// 若详情正在显示当前任务,刷新明细
if (this.detailVisible && this.currentTask && this.currentTask.id === task.id) {
const res2 = await listItems(task.id);
if (res2.code === 200) {
this.taskItems = res2.data || [];
}
}
} else {
this.$modal.msgError(res.msg || '触发重试失败');
}
} catch (e) {
this.$modal.msgError('触发重试失败');
}
},
// 解析目标账号
parseTargetAccounts(jsonStr) {