From 4b20be4b7aac64d90094c2ea9a0fe4128b21eeab Mon Sep 17 00:00:00 2001
From: yueliuli <1628111725@qq.com>
Date: Wed, 22 Apr 2026 15:47:00 +0800
Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E6=82=A3=E5=88=97=E8=A1=A8=20-=20?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E4=BD=93=E6=A0=87=E7=AD=BE=20-=20?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=8F=AF=E5=8C=BA=E5=88=86=E9=9A=90=E6=82=A3?=
=?UTF-8?q?=E7=AD=89=E7=BA=A7=20=E6=97=B6=E9=97=B4=E7=BA=BF=20-=20?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=B6=E9=97=B4=E7=BA=BF=E6=93=8D=E4=BD=9C?=
=?UTF-8?q?=E8=AF=B4=E6=98=8E=20-=20=E9=9A=90=E6=82=A3=E6=8C=89=E9=92=AE?=
=?UTF-8?q?=E5=8F=AF=E5=8C=BA=E5=88=86=E9=9A=90=E6=82=A3=E7=AD=89=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components.d.ts | 1 +
src/components/hazard_inspect/ItemList.vue | 9 +-
.../hazard_inspect/timeline/timeline.css | 24 +-
.../hazard_inspect/timeline/timeline.ts | 76 +-
.../hazard_inspect/timeline/timeline.vue | 20 +-
src/main.ts | 8 +-
src/pages/index.vue | 5 +-
src/pages/nav/edit2.html | 864 ------------------
.../nav/hazardCheck/HazardCheckResult.vue | 78 +-
src/pages/nav/hazardCheck/index.vue | 2 +-
10 files changed, 160 insertions(+), 927 deletions(-)
delete mode 100644 src/pages/nav/edit2.html
diff --git a/src/components.d.ts b/src/components.d.ts
index 70b49c8..8419878 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -48,6 +48,7 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
+ ElTooltip: typeof import('element-plus/es')['ElTooltip']
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
ItemList: typeof import('./components/hazard_inspect/ItemList.vue')['default']
Left_bar: typeof import('./components/hazard_inspect/left_bar.vue')['default']
diff --git a/src/components/hazard_inspect/ItemList.vue b/src/components/hazard_inspect/ItemList.vue
index a45bc8c..ac2be16 100644
--- a/src/components/hazard_inspect/ItemList.vue
+++ b/src/components/hazard_inspect/ItemList.vue
@@ -41,8 +41,15 @@ function handleItemClick(item: string, index: number) {
{{ index + 1 }}
+
+ {{ (item as number[])[1] }}
+
+
+ {{ (item as number[])[1] }}
+
+
- {{ item }}
+ {{ (item as number[])[2] }}
diff --git a/src/components/hazard_inspect/timeline/timeline.css b/src/components/hazard_inspect/timeline/timeline.css
index f6b55fb..0e95490 100644
--- a/src/components/hazard_inspect/timeline/timeline.css
+++ b/src/components/hazard_inspect/timeline/timeline.css
@@ -15,9 +15,15 @@
padding: 0 8px;
}
+.timeline-title-container {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ color: var(--ep-text-color-secondary);
+}
+
.timeline-title {
font-size: 12px;
- color: var(--ep-text-color-secondary);
}
.timeline-zoom-controls {
@@ -168,17 +174,29 @@
align-items: center;
justify-content: center;
border-radius: 4px;
- background-color: var(--ep-color-primary);
+ /* background-color: var(--ep-color-primary); */
color: #fff;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s;
}
-.hazard-block:hover {
+.hazard-block.primary {
+ background-color: var(--ep-color-primary);
+}
+
+.hazard-block.primary:hover {
background-color: color-mix(in srgb, var(--ep-color-primary) 80%, transparent);
}
+.hazard-block.danger {
+ background-color: var(--ep-color-danger);
+}
+
+.hazard-block.danger:hover {
+ background-color: color-mix(in srgb, var(--ep-color-danger) 80%, transparent);
+}
+
.timeline-container::-webkit-scrollbar {
width: 6px;
height: 6px;
diff --git a/src/components/hazard_inspect/timeline/timeline.ts b/src/components/hazard_inspect/timeline/timeline.ts
index 17b959a..58720fb 100644
--- a/src/components/hazard_inspect/timeline/timeline.ts
+++ b/src/components/hazard_inspect/timeline/timeline.ts
@@ -1,10 +1,17 @@
+import type { Action } from 'element-plus'
import type { ComputedRef, Ref } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
import { computed, nextTick, ref, watch } from 'vue'
+export interface HazardData {
+ ranges: number[]
+ level: number
+}
+
export interface TimelineProps {
currentFrame: number
totalFrames: number
- hazardRanges: Record
+ hazardRanges: Record
}
export interface TimelineEmits {
@@ -23,14 +30,15 @@ export interface HazardItem {
id: string
start: number
end: number
- ranges: number[][]
+ ranges: number[]
}
export interface HazardRow {
id: string
start: number
end: number
- ranges: number[][]
+ ranges: number[]
+ level: number
}
export function useTimeline(
@@ -152,36 +160,44 @@ export function useTimeline(
const trackRows: ComputedRef = computed(() => {
const ranges = props.hazardRanges
const sortedHazards = Object.entries(ranges)
- .map(([id, frames]) => ({
- id,
- ranges: frames.reduce((acc, _, i) => {
- if (i % 2 === 0) {
- acc.push([frames[i], frames[i + 1]])
+ .map(([id, frames]) => {
+ // 处理旧数据结构:[start, end, level]
+ if (Array.isArray(frames)) {
+ return {
+ id,
+ level: frames[2] || 0, // 从第三个元素获取level
+ ranges: [[frames[0], frames[1]]], // 前两个元素是范围
}
- return acc
- }, []),
- }))
+ }
+ // 处理新数据结构:{ ranges: number[][], level: number }
+ return {
+ id,
+ level: frames.level || 0,
+ ranges: frames.ranges,
+ }
+ })
.sort((a, b) => {
- const aStart = a.ranges[0]?.[0] || 0
- const bStart = b.ranges[0]?.[0] || 0
- return aStart - bStart
+ const aStart = a.ranges[0] || 0
+ const bStart = b.ranges[0] || 0
+ return (aStart as number) - (bStart as number)
})
const rows: HazardRow[][] = []
sortedHazards.forEach((hazard) => {
let assigned = false
for (let i = 0; i < rows.length; i++) {
- const canPlace = hazard.ranges.every(([start, end]) => {
+ const canPlace = hazard.ranges.every((start) => {
return rows[i].every((existing) => {
- return end <= existing.start || start >= existing.end
+ return (start as number) <= (existing.start as number) || (start as number) >= (existing.end as number)
})
})
if (canPlace) {
rows[i].push({
id: hazard.id,
- start: hazard.ranges[0][0],
- end: hazard.ranges[0][1],
- ranges: hazard.ranges,
+ start: hazard.ranges[0] as number,
+ end: hazard.ranges[1] as number,
+ ranges: hazard.ranges.map(range => range as number),
+ level: hazard.level || 0,
})
assigned = true
break
@@ -190,9 +206,10 @@ export function useTimeline(
if (!assigned) {
rows.push([{
id: hazard.id,
- start: hazard.ranges[0][0],
- end: hazard.ranges[0][1],
- ranges: hazard.ranges,
+ start: hazard.ranges[0] as number,
+ end: hazard.ranges[1] as number,
+ ranges: hazard.ranges.map(range => range as number),
+ level: hazard.level || 0,
}])
}
})
@@ -364,6 +381,20 @@ export function useTimeline(
window.removeEventListener('mouseup', handleMouseUp)
}
+ const openMessageBox = (message: string, title: string) => {
+ ElMessageBox.alert(message, title, {
+ // if you want to disable its autofocus
+ // autofocus: false,
+ confirmButtonText: '确认',
+ // callback: (action: Action) => {
+ // ElMessage({
+ // type: 'info',
+ // message: `action: ${action}`,
+ // })
+ // },
+ })
+ }
+
return {
pxPerFrame,
minPxPerFrame,
@@ -388,5 +419,6 @@ export function useTimeline(
handlePlayheadDrag,
initMounted,
initUnmounted,
+ openMessageBox,
}
}
diff --git a/src/components/hazard_inspect/timeline/timeline.vue b/src/components/hazard_inspect/timeline/timeline.vue
index 196b630..4df7ba3 100644
--- a/src/components/hazard_inspect/timeline/timeline.vue
+++ b/src/components/hazard_inspect/timeline/timeline.vue
@@ -1,8 +1,9 @@
-
-
-
-
-
-
-
-
-
- ProVision
- | 视频标注编辑器
-
-
-
-
-
- 系统就绪
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 00:00 /
- 00:10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-