视频树数据

This commit is contained in:
2025-12-26 01:14:12 +08:00
parent a7f2ed7c8a
commit 5f52ac4956
6 changed files with 26 additions and 46 deletions

View File

@@ -8,7 +8,7 @@
@node-click="handleNodeClick">
<template v-slot="{ node, data }">
<!-- <img src="@/assets/images/livePreview/icon-monitor.png" alt=""> -->
<span :class="(!data.sourceType && treeType === 'UAV') ? 'offline': ''">{{ node.label }}</span>
<span :class="(data.sourceType!=='2' && treeType === 'UAV') ? 'offline': ''">{{ node.label }}</span>
</template>
</el-tree>
</div>
@@ -29,34 +29,11 @@ const refresh = (type) => {
if(type === 'CCTV') {
const params = {}
findVideoLevelList(params).then(res => {
if (res.success) {
const data = res.result.records
const groupedData = {}
data.forEach(item => {
const belong = item.videoBelong
if (!groupedData[belong]) {
groupedData[belong] = []
}
groupedData[belong].push(item)
})
// 转换为树形结构
const result = Object.keys(groupedData).map(belong => {
const children = groupedData[belong]
if (children.length === 1) {
// 只有一个子元素,直接返回该子元素
return children[0]
}
// 有多个子元素,返回分组节点
return {
videoName: belong,
longitude: children[0].longitude,
latitude: children[0].latitude,
children: children
}
})
tableData.value = result
}
const arr = []
Object.keys(res.data).forEach(i => {
arr.push({ videoName: i, children: res.data[i] })
})
tableData.value = arr
})
}else if(type === 'UAV') {
const params = {
@@ -97,10 +74,10 @@ const refresh = (type) => {
}
const handleNodeClick = (data, node) => {
if(!data.sourceType) {
return false
}
if(!data.children || data.children.length === 0) {
if(treeType.value === 'UAV' && !data.sourceType) {
return false
}
emit('handle', node.data)
}
}