This commit is contained in:
cjw
2026-02-16 16:30:29 +08:00
parent 49d6e0376a
commit 8d65142d17
5 changed files with 41 additions and 15 deletions
+7 -7
View File
@@ -147,8 +147,8 @@ async def get_status(task_id: str, db_session: AsyncSession = Depends(get_db_ses
"status": task.status,
"progress": task.progress,
"current_step": task.current_step,
"upload_time": task.created_time.isoformat() if task.created_time else "",
"completed_at": task.completed_time.isoformat() if task.completed_time else "",
"upload_time": task.created_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.created_time else "",
"completed_at": task.completed_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.completed_time else "",
"error": task.error_message if task.error_message else ""
}
@@ -205,7 +205,7 @@ async def get_file_history(db_session: AsyncSession = Depends(get_db_session)):
file_groups[filename].append({
"task_id": task.task_id,
"filename": filename,
"upload_time": task.created_time.isoformat() if task.created_time else "",
"upload_time": task.created_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.created_time else "",
"status": task.status,
"file_size": stp_file.file_size
})
@@ -260,9 +260,9 @@ async def get_file_records(filename: str, db_session: AsyncSession = Depends(get
"task_id": task.task_id,
"filename": stp_file.original_filename,
"file_size": stp_file.file_size,
"upload_time": task.created_time.isoformat() if task.created_time else "",
"upload_time": task.created_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.created_time else "",
"status": task.status,
"completed_at": task.completed_time.isoformat() if task.completed_time else ""
"completed_at": task.completed_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.completed_time else ""
})
# 按上传时间排序(最新的在前)
@@ -380,8 +380,8 @@ async def result_page(request: Request, task_id: str, db_session: AsyncSession =
"status": task.status,
"progress": task.progress,
"current_step": task.current_step,
"upload_time": task.created_time.isoformat() if task.created_time else "",
"completed_at": task.completed_time.isoformat() if task.completed_time else "",
"upload_time": task.created_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.created_time else "",
"completed_at": task.completed_time.astimezone().strftime('%Y-%m-%d %H:%M:%S') if task.completed_time else "",
"error": task.error_message if task.error_message else ""
}
+10 -4
View File
@@ -56,8 +56,8 @@ function displayFileList(files) {
<div class="file-info">
<div class="file-name">📄 ${file.filename}</div>
<div class="file-meta">
总记录: ${file.record_count} 条 |
最后上传: ${new Date(file.last_upload).toLocaleString()}
总记录: ${file.record_count} 条 |
最后上传: ${formatDateTime(file.last_upload)}
</div>
</div>
<button class="expand-btn" onclick="event.stopPropagation(); toggleFileRecords('${file.filename}')">
@@ -110,7 +110,7 @@ async function toggleFileRecords(filename) {
<div class="record-item" onclick="viewRecordDetails('${record.task_id}')">
<div class="record-header">
<div class="record-time">
📅 ${new Date(record.upload_time).toLocaleString()}
📅 ${formatDateTime(record.upload_time)}
</div>
<div class="record-status status-${record.status}">
${getStatusText(record.status)}
@@ -120,7 +120,7 @@ async function toggleFileRecords(filename) {
<div>文件大小: ${formatFileSize(record.file_size)}</div>
<div>任务ID: ${record.task_id}</div>
<div>状态: ${record.status}</div>
${record.completed_at ? `<div>完成时间: ${new Date(record.completed_at).toLocaleTimeString()}</div>` : ''}
${record.completed_at ? `<div>完成时间: ${formatDateTime(record.completed_at)}</div>` : ''}
</div>
</div>
`).join('');
@@ -186,6 +186,12 @@ function formatFileSize(bytes) {
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
function formatDateTime(dateString) {
if (!dateString) return 'N/A';
// 后端已经返回格式化的时间字符串,直接返回
return dateString;
}
// 跳转到上传页面
async function goToUpload() {
try {
+22 -2
View File
@@ -173,11 +173,31 @@ body {
gap: 12px;
}
/* 关键工艺参数三列布局 - 使用最高优先级 */
.key-info-categories {
display: grid !important;
grid-template-columns: repeat(3, 1fr) !important;
gap: 20px;
margin-bottom: 20px;
gap: 20px !important;
margin-bottom: 20px !important;
width: 100% !important;
}
/* 确保所有子元素正确布局 */
.key-info-categories > .category-section {
display: flex !important;
flex-direction: column !important;
}
.key-info-categories > .category-section .category-content {
display: flex !important;
flex-direction: column !important;
gap: 12px !important;
}
/* 覆盖 result.html 内联样式 */
.result-section .key-info-categories {
display: grid !important;
grid-template-columns: repeat(3, 1fr) !important;
}
.data-grid {
+1 -1
View File
@@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分析结果 - STP文件几何分析工具</title>
<link rel="stylesheet" href="/static/style.css?v=10">
<link rel="stylesheet" href="/static/style.css?v=12">
<style>
.result-container {
max-width: 1200px;
+1 -1
View File
@@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分析结果快照 - STP文件几何分析工具</title>
<link rel="stylesheet" href="/static/style.css?v=10">
<link rel="stylesheet" href="/static/style.css?v=12">
<style>
.snapshot-container {
max-width: 1200px;