deving
This commit is contained in:
+43
-3
@@ -146,9 +146,49 @@ async function toggleFileRecords(filename) {
|
||||
}
|
||||
}
|
||||
|
||||
function viewRecordDetails(taskId) {
|
||||
// 跳转到详细结果页面
|
||||
window.location.href = `/result/${taskId}`;
|
||||
async function viewRecordDetails(taskId) {
|
||||
// 先检查任务状态,如果数据不完整,提示用户重新分析
|
||||
try {
|
||||
const response = await fetch(`/status/${taskId}`);
|
||||
if (response.ok) {
|
||||
const task = await response.json();
|
||||
if (task.status === 'completed' && task.key_info) {
|
||||
// 数据完整,跳转到结果页面
|
||||
window.location.href = `/result/${taskId}`;
|
||||
} else {
|
||||
// 数据不完整,提示用户重新分析
|
||||
if (confirm('该历史记录的分析数据不完整,是否重新分析?')) {
|
||||
// 重新分析逻辑
|
||||
await reanalyzeTask(taskId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 任务不存在或无法访问,跳转到结果页面尝试显示
|
||||
window.location.href = `/result/${taskId}`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('检查任务状态失败:', error);
|
||||
// 出错时直接跳转
|
||||
window.location.href = `/result/${taskId}`;
|
||||
}
|
||||
}
|
||||
|
||||
async function reanalyzeTask(taskId) {
|
||||
try {
|
||||
const response = await fetch(`/api/reanalyze/${taskId}`, {
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
alert('重新分析任务已启动,请稍后查看结果');
|
||||
// 跳转到分析状态页面
|
||||
window.location.href = `/status/${taskId}`;
|
||||
} else {
|
||||
throw new Error('重新分析失败');
|
||||
}
|
||||
} catch (error) {
|
||||
alert(`重新分析失败: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusText(status) {
|
||||
|
||||
Reference in New Issue
Block a user