From bc33278e47367cfd12423eac5df43a666a556cf5 Mon Sep 17 00:00:00 2001 From: cjw <792430652@qq.com> Date: Mon, 16 Feb 2026 15:59:25 +0800 Subject: [PATCH] deving --- static/history.js | 46 ++++++++++++++++++++-- static/style.css | 45 ++++++++++++++++++++++ templates/result.html | 84 ++++++++++++++++++++++++++--------------- templates/snapshot.html | 84 ++++++++++++++++++++++++++--------------- 4 files changed, 196 insertions(+), 63 deletions(-) diff --git a/static/history.js b/static/history.js index 801b2e3..013e0a1 100644 --- a/static/history.js +++ b/static/history.js @@ -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) { diff --git a/static/style.css b/static/style.css index d99990f..57d6150 100644 --- a/static/style.css +++ b/static/style.css @@ -173,6 +173,51 @@ body { gap: 12px; } +.key-info-categories { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 20px; + margin-bottom: 20px; +} + +.category-section { + background: #f8f9fa; + border-radius: 10px; + padding: 20px; + border-left: 4px solid #3498db; + box-shadow: 0 4px 6px rgba(0,0,0,0.1); +} + +.category-section:nth-child(1) { + border-left-color: #e74c3c; +} + +.category-section:nth-child(2) { + border-left-color: #27ae60; +} + +.category-section:nth-child(3) { + border-left-color: #f39c12; +} + +.category-title { + font-size: 1.2em; + font-weight: bold; + margin-bottom: 15px; + color: #2c3e50; + display: flex; + align-items: center; + gap: 8px; + padding-bottom: 10px; + border-bottom: 2px solid rgba(0,0,0,0.1); +} + +.category-content { + display: flex; + flex-direction: column; + gap: 12px; +} + .data-item { background: white; padding: 20px; diff --git a/templates/result.html b/templates/result.html index 3334766..9eaedda 100644 --- a/templates/result.html +++ b/templates/result.html @@ -329,38 +329,62 @@ const geoChars = cavityKeyInfo.geometric_characteristics || {}; return ` -
-
-
收缩率
-
${metadata.shrinkage_rate !== undefined ? metadata.shrinkage_rate : 'N/A'}
+
+ +
+
🔧 模具参数
+
+
+
收缩率
+
${metadata.shrinkage_rate !== undefined ? metadata.shrinkage_rate : 'N/A'}
+
+
+
拔模角
+
${metadata.draft_angle !== undefined ? metadata.draft_angle + '°' : 'N/A'}
+
+
+
型腔材料
+
${manufacturingInfo.mold_material || 'N/A'}
+
+
-
-
拔模角
-
${metadata.draft_angle !== undefined ? metadata.draft_angle + '°' : 'N/A'}
+ + +
+
📐 几何特性
+
+
+
产品体积
+
${geoChars.product_volume || 'N/A'}
+
+
+
产品重量
+
${geoChars.product_weight || 'N/A'}
+
+
+
壁厚范围
+
${geoChars.wall_thickness_range || 'N/A'}
+
+
-
-
分型线长度
-
${manufacturingInfo.parting_line_length || 'N/A'}
-
-
-
产品体积
-
${geoChars.product_volume || 'N/A'}
-
-
-
产品重量
-
${geoChars.product_weight || 'N/A'}
-
-
-
壁厚范围
-
${geoChars.wall_thickness_range || 'N/A'}
-
-
-
型腔材料
-
${manufacturingInfo.mold_material || 'N/A'}
-
-
-
预估周期
-
${manufacturingInfo.estimated_cycle_time || 'N/A'}
+ + +
+
🏭 制造要求
+
+
+
分型线长度
+
${manufacturingInfo.parting_line_length || 'N/A'}
+
+
+
预估周期
+
${manufacturingInfo.estimated_cycle_time || 'N/A'}
+
+
+
制造精度
+
${manufacturingInfo.manufacturing_tolerance || 'N/A'}
+
+
`; diff --git a/templates/snapshot.html b/templates/snapshot.html index 1329fc6..1db6fbd 100644 --- a/templates/snapshot.html +++ b/templates/snapshot.html @@ -343,38 +343,62 @@ const geoChars = cavityKeyInfo.geometric_characteristics || {}; return ` -
-
-
收缩率
-
${metadata.shrinkage_rate !== undefined ? metadata.shrinkage_rate : 'N/A'}
+
+ +
+
🔧 模具参数
+
+
+
收缩率
+
${metadata.shrinkage_rate !== undefined ? metadata.shrinkage_rate : 'N/A'}
+
+
+
拔模角
+
${metadata.draft_angle !== undefined ? metadata.draft_angle + '°' : 'N/A'}
+
+
+
型腔材料
+
${manufacturingInfo.mold_material || 'N/A'}
+
+
-
-
拔模角
-
${metadata.draft_angle !== undefined ? metadata.draft_angle + '°' : 'N/A'}
+ + +
+
📐 几何特性
+
+
+
产品体积
+
${geoChars.product_volume || 'N/A'}
+
+
+
产品重量
+
${geoChars.product_weight || 'N/A'}
+
+
+
壁厚范围
+
${geoChars.wall_thickness_range || 'N/A'}
+
+
-
-
分型线长度
-
${manufacturingInfo.parting_line_length || 'N/A'}
-
-
-
产品体积
-
${geoChars.product_volume || 'N/A'}
-
-
-
产品重量
-
${geoChars.product_weight || 'N/A'}
-
-
-
壁厚范围
-
${geoChars.wall_thickness_range || 'N/A'}
-
-
-
型腔材料
-
${manufacturingInfo.mold_material || 'N/A'}
-
-
-
预估周期
-
${manufacturingInfo.estimated_cycle_time || 'N/A'}
+ + +
+
🏭 制造要求
+
+
+
分型线长度
+
${manufacturingInfo.parting_line_length || 'N/A'}
+
+
+
预估周期
+
${manufacturingInfo.estimated_cycle_time || 'N/A'}
+
+
+
制造精度
+
${manufacturingInfo.manufacturing_tolerance || 'N/A'}
+
+
`;