feat: 算法升级、整车配准集成与性能分析文档
算法更新: delivery v1.2.1、平整度v1.5、测距v2.2、整车配准v1.3 适配器: vehicle-registration 新增、各算法 manifest 和 adapter 更新 后端: taskCadFiles/source 字段迁移、derivedPointClouds 注册、取消任务联动 前端: ElapsedTime 时长显示、两步算法流程、canRun 逻辑修复 文档: 新增5份算法性能分析报告
This commit is contained in:
@@ -1,8 +1,46 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { trpc } from '@/lib/trpc';
|
||||
import { BarChart2, Ruler, Zap, Play, Trash2, ChevronDown, ChevronRight, RefreshCw, Flame, Box, Layers, Crosshair, Cpu } from 'lucide-react';
|
||||
import { BarChart2, Ruler, Zap, Play, Trash2, ChevronDown, ChevronRight, RefreshCw, Flame, Box, Layers, Crosshair, Cpu, Timer } from 'lucide-react';
|
||||
import GenericResultView, { type Overlay3D } from './GenericResultView';
|
||||
|
||||
/** 将毫秒数格式化为可读时长,如 2m 34s / 47s / 1h 5m */
|
||||
function fmtDuration(ms: number): string {
|
||||
const s = Math.floor(ms / 1000);
|
||||
if (s < 60) return `${s}s`;
|
||||
const m = Math.floor(s / 60);
|
||||
if (m < 60) return `${m}m ${s % 60}s`;
|
||||
return `${Math.floor(m / 60)}h ${m % 60}m`;
|
||||
}
|
||||
|
||||
/** 运行中的任务:实时更新计时;已结束:显示静态 updatedAt - createdAt */
|
||||
function ElapsedTime({ status, createdAt, updatedAt }: {
|
||||
status: string;
|
||||
createdAt: string | Date;
|
||||
updatedAt: string | Date;
|
||||
}) {
|
||||
const start = new Date(createdAt).getTime();
|
||||
const end = new Date(updatedAt).getTime();
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
|
||||
useEffect(() => {
|
||||
if (status !== 'processing' && status !== 'pending') return;
|
||||
const id = setInterval(() => setNow(Date.now()), 1000);
|
||||
return () => clearInterval(id);
|
||||
}, [status]);
|
||||
|
||||
const ms = (status === 'processing' || status === 'pending')
|
||||
? now - start
|
||||
: end - start;
|
||||
|
||||
if (ms < 500) return null;
|
||||
return (
|
||||
<span className="flex items-center gap-0.5 text-[9px] tabular-nums text-muted-foreground flex-shrink-0" title="执行时长">
|
||||
<Timer className="w-2.5 h-2.5" />
|
||||
{fmtDuration(ms)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
interface Props {
|
||||
taskId: number;
|
||||
onReplay?: (resultId: number) => void;
|
||||
@@ -245,6 +283,7 @@ export default function AnalysisPanel({ taskId, onReplay, onViewSmoothHeatmap, o
|
||||
r.status === 'error' ? 'bg-red-900/40 text-red-400' :
|
||||
'bg-secondary text-muted-foreground'
|
||||
}`}>{r.status}</span>
|
||||
<ElapsedTime status={r.status} createdAt={r.createdAt} updatedAt={r.updatedAt} />
|
||||
{r.status === 'processing' &&
|
||||
(r.type === 'smooth_heatmap' || r.type === 'assembly_inspection' || r.type === 'obj_deviation' || r.type === 'plugin') &&
|
||||
(() => {
|
||||
|
||||
Reference in New Issue
Block a user