|
@@ -1,8 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="cameraTreeWrapper">
|
|
<div class="cameraTreeWrapper">
|
|
|
- <!-- <div class="cameraTreeTitle">
|
|
|
|
|
- <span style="color: black">场景树</span>
|
|
|
|
|
- </div> -->
|
|
|
|
|
<div class="cameraTreeInputWrapper">
|
|
<div class="cameraTreeInputWrapper">
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="filterText"
|
|
v-model="filterText"
|
|
@@ -29,7 +26,7 @@
|
|
|
<div
|
|
<div
|
|
|
class="treeNode"
|
|
class="treeNode"
|
|
|
:class="{
|
|
:class="{
|
|
|
- selectedCamera: isSelected(data.id),
|
|
|
|
|
|
|
+ selectedCamera: isSelected(node, data.id),
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
|
<div v-if="data.nodeType === CameraTreeNodeType.camera" class="icons">
|
|
<div v-if="data.nodeType === CameraTreeNodeType.camera" class="icons">
|
|
@@ -58,11 +55,11 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ElInput, ElTree, ElScrollbar } from 'element-plus';
|
|
import { ElInput, ElTree, ElScrollbar } from 'element-plus';
|
|
|
import { onMounted, ref, watch } from 'vue';
|
|
import { onMounted, ref, watch } from 'vue';
|
|
|
|
|
+ import { storeToRefs } from 'pinia';
|
|
|
import { VideoCamera, WarningFilled, Search } from '@element-plus/icons-vue';
|
|
import { VideoCamera, WarningFilled, Search } from '@element-plus/icons-vue';
|
|
|
import { CameraTreeNodeType, getCameraTree } from '@/api/camera/camera-preview';
|
|
import { CameraTreeNodeType, getCameraTree } from '@/api/camera/camera-preview';
|
|
|
import { useCameraGroupList } from '@/store/modules/useCameraGroupList';
|
|
import { useCameraGroupList } from '@/store/modules/useCameraGroupList';
|
|
|
import type { CameraGroupType } from '@/views/disaster/monitor/splitScreenRetrieval/type';
|
|
import type { CameraGroupType } from '@/views/disaster/monitor/splitScreenRetrieval/type';
|
|
|
- import { getVideoRenderUrlKey } from '../../utils';
|
|
|
|
|
import Thumbnail from '@/components/thumbnail/Thumbnail.vue';
|
|
import Thumbnail from '@/components/thumbnail/Thumbnail.vue';
|
|
|
|
|
|
|
|
interface Tree {
|
|
interface Tree {
|
|
@@ -82,16 +79,15 @@
|
|
|
const treeEmptyText = ref('');
|
|
const treeEmptyText = ref('');
|
|
|
const props = defineProps<{ cameraGroup: CameraGroupType }>();
|
|
const props = defineProps<{ cameraGroup: CameraGroupType }>();
|
|
|
|
|
|
|
|
- const { addCameraIntoGroup, deleteCameraFromGroup } = useCameraGroupList();
|
|
|
|
|
|
|
+ const { cameraInPlay, playingGroup, totalRound } = storeToRefs(useCameraGroupList());
|
|
|
|
|
+ const { addCameraIntoGroup, deleteCameraFromGroup, deleteCameraInPlaylist, getValidateCameraNum, restartPlay } =
|
|
|
|
|
+ useCameraGroupList();
|
|
|
|
|
|
|
|
- const isSelected = (id: number) => {
|
|
|
|
|
- return props.cameraGroup.children.find((x) => x.id === id);
|
|
|
|
|
|
|
+ const isSelected = (nodeData, id: number) => {
|
|
|
|
|
+ return props.cameraGroup.children.find((x) => x.id === id && nodeData.data.nodeType === CameraTreeNodeType.camera);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleClickCamera = (nodeData) => {
|
|
const handleClickCamera = (nodeData) => {
|
|
|
- // // 如果点击的不是摄像头或是已失效相机
|
|
|
|
|
- // if (nodeData.nodeType !== CameraTreeNodeType.camera || nodeData.disable)
|
|
|
|
|
-
|
|
|
|
|
// 如果点击的不是摄像头
|
|
// 如果点击的不是摄像头
|
|
|
if (nodeData.nodeType !== CameraTreeNodeType.camera) return;
|
|
if (nodeData.nodeType !== CameraTreeNodeType.camera) return;
|
|
|
|
|
|
|
@@ -99,17 +95,25 @@
|
|
|
|
|
|
|
|
// 如果该摄像头在分组里,则从分组移除该摄像头,否则添加该摄像头进分组
|
|
// 如果该摄像头在分组里,则从分组移除该摄像头,否则添加该摄像头进分组
|
|
|
if (cameraInGroup) {
|
|
if (cameraInGroup) {
|
|
|
- deleteCameraFromGroup(props.cameraGroup, cameraInGroup);
|
|
|
|
|
|
|
+ cameraInPlay.value.includes(cameraInGroup)
|
|
|
|
|
+ ? deleteCameraInPlaylist(props.cameraGroup, cameraInGroup)
|
|
|
|
|
+ : deleteCameraFromGroup(props.cameraGroup, cameraInGroup);
|
|
|
} else {
|
|
} else {
|
|
|
const camera = {
|
|
const camera = {
|
|
|
code: nodeData.code,
|
|
code: nodeData.code,
|
|
|
name: nodeData.name,
|
|
name: nodeData.name,
|
|
|
- url: nodeData[getVideoRenderUrlKey()],
|
|
|
|
|
|
|
+ url: nodeData.pushStreamDTO.videoUrls?.pushstreamIp || '',
|
|
|
id: nodeData.id,
|
|
id: nodeData.id,
|
|
|
cameraGroupDetailId: -1,
|
|
cameraGroupDetailId: -1,
|
|
|
imageUrl: '',
|
|
imageUrl: '',
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
addCameraIntoGroup(props.cameraGroup.id, camera);
|
|
addCameraIntoGroup(props.cameraGroup.id, camera);
|
|
|
|
|
+
|
|
|
|
|
+ // 如果往正在轮播的分组添加相机,且该分组的有效相机数未能填满宫格数,则刷新当前播放的画面
|
|
|
|
|
+ if (props.cameraGroup.id === playingGroup.value?.id && getValidateCameraNum() >= 0 && totalRound.value <= 1) {
|
|
|
|
|
+ restartPlay();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|