对话列表新增点击跳转到对应时间点

This commit is contained in:
yueliuli 2026-04-24 10:29:17 +08:00
parent ee208d5b16
commit 63e77ebbc0
2 changed files with 12 additions and 8 deletions

View File

@ -18,7 +18,7 @@ const props = defineProps({
const emit = defineEmits(['click']) const emit = defineEmits(['click'])
// //
function handleItemClick(item: string, index: number) { function handleItemClick(item: any[], index: number) {
emit('click', item, index) emit('click', item, index)
} }
</script> </script>
@ -39,7 +39,7 @@ function handleItemClick(item: string, index: number) {
<el-row v-for="(item, index) in props.data" :key="index"> <el-row v-for="(item, index) in props.data" :key="index">
<!-- 无物体类型标签 隐患等级体颜色显示在编号标签上 --> <!-- 无物体类型标签 隐患等级体颜色显示在编号标签上 -->
<!-- 0为隐患等级 1为隐患描述 --> <!-- 0为隐患等级 1为隐患描述 -->
<el-button class="message-btn" text @click="handleItemClick(item as string, index)"> <el-button class="message-btn" text @click="handleItemClick(item as any[], index)">
<div class="flex flex-col items-start"> <div class="flex flex-col items-start">
<div class="flex flex-row gap-2"> <div class="flex flex-row gap-2">
<el-text class="item-text" type="info" size="small"> <el-text class="item-text" type="info" size="small">

View File

@ -105,7 +105,7 @@ const totalFrames = computed(() => {
function handleTimelineHazardClick(hazardId: string) { function handleTimelineHazardClick(hazardId: string) {
selectedHazard.value = Number(hazardId) selectedHazard.value = Number(hazardId)
handleJumpToTimePoint(Number(hazardId)) handleJumpToHazard(Number(hazardId))
} }
function handleFrameChange(frame: number) { function handleFrameChange(frame: number) {
@ -197,15 +197,19 @@ function getData() {
function handleHazardClick(item: string, index: number) { function handleHazardClick(item: string, index: number) {
selectedHazard.value = index selectedHazard.value = index
handleJumpToTimePoint(selectedHazard.value) handleJumpToHazard(selectedHazard.value)
} }
// //
function handleJumpToTimePoint(index: number) { function handleJumpToHazard(index: number) {
const seconds = data.value.隐患数据[index].跳转时间点 const seconds = data.value.隐患数据[index].跳转时间点
// //
// console.log(`: ${seconds}`) // console.log(`: ${seconds}`)
handleJumpToTimePoint(seconds)
}
function handleJumpToTimePoint(seconds: number) {
// 0 // 0
if (Number.isNaN(seconds) || seconds < 0) if (Number.isNaN(seconds) || seconds < 0)
return return
@ -297,7 +301,7 @@ onMounted(() => {
if (data.value.隐患列表.length > 0) { if (data.value.隐患列表.length > 0) {
selectedHazard.value = 0 selectedHazard.value = 0
handleJumpToTimePoint(0) handleJumpToHazard(0)
} }
}) })
} }
@ -379,7 +383,7 @@ onMounted(() => {
<div class="py-1" /> <div class="py-1" />
</template> </template>
<el-row> <el-row>
<el-button style="width: 100%;" @click="handleJumpToTimePoint(selectedHazard)"> <el-button style="width: 100%;" @click="handleJumpToHazard(selectedHazard)">
跳转到隐患时间点 跳转到隐患时间点
</el-button> </el-button>
</el-row> </el-row>
@ -391,7 +395,7 @@ onMounted(() => {
</el-col> </el-col>
</el-row> </el-row>
<el-row style="flex: 1; overflow-y: auto; border-top: 1px solid var(--ep-border-color);"> <el-row style="flex: 1; overflow-y: auto; border-top: 1px solid var(--ep-border-color);">
<SubtitleList title="对话" :data="data.对话列表" /> <SubtitleList title="对话" :data="data.对话列表" @click="(item: any[]) => handleJumpToTimePoint(Number(item[0]))" />
</el-row> </el-row>
<!-- <el-row class="px-1 py-1"> <!-- <el-row class="px-1 py-1">
<el-button> <el-button>