Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1712fb0756 | ||
|
|
d18e80016b |
@@ -180,6 +180,52 @@
|
||||
50% { transform: scale(1.1); }
|
||||
}
|
||||
|
||||
/* 步骤简要数值 */
|
||||
.steps-summary {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 12px 15px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.step-summary-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 4px 10px;
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.step-summary-item.completed {
|
||||
background: #d1fae5;
|
||||
}
|
||||
|
||||
.step-summary-item.running {
|
||||
background: #e0e7ff;
|
||||
}
|
||||
|
||||
.step-summary-item.failed {
|
||||
background: #fee2e2;
|
||||
}
|
||||
|
||||
.step-summary-item.skipped {
|
||||
background: #f3f4f6;
|
||||
}
|
||||
|
||||
.step-summary-label {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.step-summary-value {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 操作按钮 */
|
||||
.process-actions {
|
||||
display: flex;
|
||||
|
||||
+13
-8
@@ -396,30 +396,35 @@ async function processProduct(productName, category, subcategory) {
|
||||
return;
|
||||
}
|
||||
|
||||
showToast('正在启动处理...', '');
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/api/products/process`, {
|
||||
const response = await fetch(`${API_BASE}/api/process/start`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
product_name: productName,
|
||||
category: category,
|
||||
subcategory: subcategory
|
||||
category: category || '',
|
||||
subcategory: subcategory || ''
|
||||
})
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
showToast(data.message, 'success');
|
||||
if (data.new_products && data.new_products.length > 0) {
|
||||
showToast(`发现 ${data.new_products.length} 个新产品`, 'success');
|
||||
}
|
||||
showToast('处理流程已启动', 'success');
|
||||
// 跳转到处理监控页面
|
||||
setTimeout(() => {
|
||||
window.location.href = '/process';
|
||||
}, 1000);
|
||||
} else {
|
||||
showToast('处理失败: ' + data.error || data.message, 'error');
|
||||
const errorMsg = data.error || data.message || '未知错误';
|
||||
showToast('处理失败: ' + errorMsg, 'error');
|
||||
}
|
||||
|
||||
refreshData();
|
||||
} catch (error) {
|
||||
console.error('处理产品失败:', error);
|
||||
showToast('处理产品失败', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
+76
-2
@@ -133,15 +133,23 @@ function displayActiveProcesses(sessions) {
|
||||
function renderStepsProgress(steps, currentStep) {
|
||||
const totalSteps = 6;
|
||||
const stepStatuses = {};
|
||||
const stepDataMap = {};
|
||||
|
||||
// 构建步骤状态映射
|
||||
// 构建步骤状态和数据映射
|
||||
steps.forEach(s => {
|
||||
stepStatuses[s.step_number] = s.step_status;
|
||||
if (s.step_data) {
|
||||
try {
|
||||
stepDataMap[s.step_number] = typeof s.step_data === 'string' ? JSON.parse(s.step_data) : s.step_data;
|
||||
} catch (e) {
|
||||
stepDataMap[s.step_number] = s.step_data;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const stepNames = ['搜索内容库', '搜索互联网', '抓取网页', '提取数据', '填充字段', '提交审核'];
|
||||
|
||||
let html = '';
|
||||
let html = '<div class="steps-progress">';
|
||||
for (let i = 1; i <= totalSteps; i++) {
|
||||
const status = stepStatuses[i] || (i > currentStep ? 'pending' : '');
|
||||
let className = '';
|
||||
@@ -158,6 +166,72 @@ function renderStepsProgress(steps, currentStep) {
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
html += '</div>';
|
||||
|
||||
// 添加简要数值显示
|
||||
html += '<div class="steps-summary">';
|
||||
|
||||
// 步骤1:内容库搜索结果数
|
||||
if (stepDataMap[1]) {
|
||||
const count = stepDataMap[1].count || 0;
|
||||
const status = stepStatuses[1];
|
||||
html += `<div class="step-summary-item ${status || ''}">
|
||||
<span class="step-summary-label">内容库:</span>
|
||||
<span class="step-summary-value">${count} 篇</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 步骤2:互联网搜索结果数
|
||||
if (stepDataMap[2]) {
|
||||
const count = stepDataMap[2].count || 0;
|
||||
const status = stepStatuses[2];
|
||||
html += `<div class="step-summary-item ${status || ''}">
|
||||
<span class="step-summary-label">互联网:</span>
|
||||
<span class="step-summary-value">${count} 条</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 步骤3:抓取成功数
|
||||
if (stepDataMap[3]) {
|
||||
const count = stepDataMap[3].count || 0;
|
||||
const status = stepStatuses[3];
|
||||
html += `<div class="step-summary-item ${status || ''}">
|
||||
<span class="step-summary-label">抓取成功:</span>
|
||||
<span class="step-summary-value">${count} 个</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 步骤4:提取状态
|
||||
if (stepDataMap[4]) {
|
||||
const hasData = stepDataMap[4].has_data || stepDataMap[4].extracted;
|
||||
const status = stepStatuses[4];
|
||||
html += `<div class="step-summary-item ${status || ''}">
|
||||
<span class="step-summary-label">数据提取:</span>
|
||||
<span class="step-summary-value">${hasData ? '成功' : '无数据'}</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 步骤5:填充状态
|
||||
if (stepDataMap[5]) {
|
||||
const filled = stepDataMap[5].filled;
|
||||
const status = stepStatuses[5];
|
||||
html += `<div class="step-summary-item ${status || ''}">
|
||||
<span class="step-summary-label">字段填充:</span>
|
||||
<span class="step-summary-value">${filled ? '完成' : '失败'}</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 步骤6:审核ID
|
||||
if (stepDataMap[6]) {
|
||||
const reviewId = stepDataMap[6].review_id;
|
||||
const status = stepStatuses[6];
|
||||
html += `<div class="step-summary-item ${status || ''}">
|
||||
<span class="step-summary-label">审核ID:</span>
|
||||
<span class="step-summary-value">${reviewId || '-'}</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<header class="header">
|
||||
<h1><i class="ri-robot-line"></i> 参数数据自动化管理系统</h1>
|
||||
<div class="header-actions">
|
||||
<a href="/process" class="btn btn-primary">
|
||||
<i class="ri-cpu-line"></i> 处理监控
|
||||
</a>
|
||||
<button onclick="refreshData()" class="btn btn-secondary">
|
||||
<i class="ri-refresh-line"></i> 刷新数据
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user