diff --git a/static/js/app.js b/static/js/app.js index 570088a..b915c97 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -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'); } } diff --git a/templates/index.html b/templates/index.html index c3fe40c..90debf5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,6 +13,9 @@

参数数据自动化管理系统

+ + 处理监控 +