From a479033da93c746fd7c5a577b76e32b5c2f66a63 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Wed, 31 Aug 2022 15:48:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openness/containers/mirroringDetail.jsx | 126 +++++++++++++----- 1 file changed, 94 insertions(+), 32 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx index 57c96fe..c79d24c 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState, useRef } from 'react'; import { connect } from 'react-redux'; import '../style.less' -import { Tree, Popconfirm, Typography, Input, Switch, Modal, Checkbox, CheckboxGroup, Select, Toast,Button } from "@douyinfe/semi-ui" +import { Tree, Popconfirm, Typography, Input, Switch, Modal, Checkbox, CheckboxGroup, Select, Toast, Button } from "@douyinfe/semi-ui" import VideoScreen from '../components/videoScreen'; import { set } from 'nprogress'; @@ -110,7 +110,8 @@ const MirroringDetail = (props) => { const [plainOptions, setPlainOptions] = useState([]);//摄像头选择 const [checkedList, setCheckedList] = useState([]);//选中的摄像头列表 const [mykeyword, setMykeyword] = useState('');//摄像头搜索 - const [allCameraList, setAllCameraList] = useState([])//标签组的摄像头列表 + const [allCameraList, setAllCameraList] = useState([])//所有的摄像头 + const [labelCameraList, setLabelCameraList] = useState([])//标签组的摄像头 const [showCameraList, setShowCameraList] = useState([])//展示的摄像头列表 const [saveShowList, setSaveShowList] = useState([])//展示的摄像头列表 const [addCamera, setAddCamera] = useState(false);//添加视频弹框 @@ -184,30 +185,30 @@ const MirroringDetail = (props) => { setCheckall(checkedList.length === showCameraList.length); } function topublish (publish) {//编辑镜像信息 - let filterGroupnum=0 - let cantopublish=true + let filterGroupnum = 0 + let cantopublish = true for (let i = 0; i < filterGroup.length; i++) { for (let j = 0; j < filterGroup.length; j++) { - if(filterGroup[i].name==filterGroup[j].name){ + if (filterGroup[i].name == filterGroup[j].name) { filterGroupnum++ } } } - if(filterGroupnum>filterGroup.length){ - cantopublish=false + if (filterGroupnum > filterGroup.length) { + cantopublish = false let opts = { content: '筛选项名称不能重复,请修改', duration: 3, }; Toast.error(opts) - }else{ + } else { for (let k = 0; k < filterGroup.length; k++) { - let filtersarr=[] + let filtersarr = [] for (let l = 0; l < filterGroup[k].filters.length; l++) { filtersarr.push(filterGroup[k].filters[l].name) } - if(Array.from(new Set(filtersarr)).length { } } } - if(cantopublish){ + if (cantopublish) { let mirrordata = { mirrorId: mirrorId, template: template, @@ -378,8 +379,8 @@ const MirroringDetail = (props) => { setEditKey('') } function cameraAdd (item) {//添加摄像头 - let myItemArr=[] - if(item.children){ + let myItemArr = [] + if (item.children) { for (let q = 0; q < item.children.length; q++) { myItemArr.push(item.children[q].cameraId) } @@ -395,9 +396,9 @@ const MirroringDetail = (props) => { if (treeData[j].children[k].children[l].children[p].cameraId) { for (let i = 0; i < myplainOptions.length; i++) { if (myplainOptions[i].value == treeData[j].children[k].children[l].children[p].cameraId) { - if(myItemArr.indexOf(myplainOptions[i].value)==-1){ - myplainOptions.splice(i, 1) - } + if (myItemArr.indexOf(myplainOptions[i].value) == -1) { + myplainOptions.splice(i, 1) + } } } } @@ -406,7 +407,7 @@ const MirroringDetail = (props) => { else if (treeData[j].children[k].children[l].cameraId) {//有没有摄像头 for (let i = 0; i < myplainOptions.length; i++) { if (myplainOptions[i].value == treeData[j].children[k].children[l].cameraId) { - if(myItemArr.indexOf(myplainOptions[i].value)==-1){ + if (myItemArr.indexOf(myplainOptions[i].value) == -1) { myplainOptions.splice(i, 1) } } @@ -417,7 +418,7 @@ const MirroringDetail = (props) => { else if (treeData[j].children[k].cameraId) {//有没有摄像头 for (let i = 0; i < myplainOptions.length; i++) { if (myplainOptions[i].value == treeData[j].children[k].cameraId) { - if(myItemArr.indexOf(myplainOptions[i].value)==-1){ + if (myItemArr.indexOf(myplainOptions[i].value) == -1) { myplainOptions.splice(i, 1) } } @@ -583,7 +584,7 @@ const MirroringDetail = (props) => { let mainData = JSON.parse(JSON.stringify(treeData)) let nodeKeyArr = addCameraKey.split('-') if (nodeKeyArr.length == 1) { - mainData[nodeKeyArr[0]].children=[] + mainData[nodeKeyArr[0]].children = [] for (let q = 0; q < plainOptions.length; q++) { for (let w = 0; w < checkedList.length; w++) { if (plainOptions[q].value == checkedList[w]) { @@ -631,7 +632,7 @@ const MirroringDetail = (props) => { } } } else if (nodeKeyArr.length == 2) { - mainData[nodeKeyArr[0]].children[nodeKeyArr[1]].children=[] + mainData[nodeKeyArr[0]].children[nodeKeyArr[1]].children = [] for (let q = 0; q < plainOptions.length; q++) { for (let w = 0; w < checkedList.length; w++) { if (plainOptions[q].value == checkedList[w]) { @@ -683,7 +684,7 @@ const MirroringDetail = (props) => { } } } else if (nodeKeyArr.length == 3) { - mainData[nodeKeyArr[0]].children[nodeKeyArr[1]].children[nodeKeyArr[2]].children=[] + mainData[nodeKeyArr[0]].children[nodeKeyArr[1]].children[nodeKeyArr[2]].children = [] for (let q = 0; q < plainOptions.length; q++) { for (let w = 0; w < checkedList.length; w++) { if (plainOptions[q].value == checkedList[w]) { @@ -749,6 +750,61 @@ const MirroringDetail = (props) => { setAddScreen(true) } function addLabelGroup (index) {//标签组弹框 + let myAllCameraList=[] + for (let j = 0; j < treeData.length; j++) {//第一级 + if (treeData[j].children) {//有没有子集 + for (let k = 0; k < treeData[j].children.length; k++) {//第二级 + if (treeData[j].children[k].children) {//有没有子集 + for (let l = 0; l < treeData[j].children[k].children.length; l++) {//第三级 + if (treeData[j].children[k].children[l].children) {//有没有子集 + for (let p = 0; p < treeData[j].children[k].children[l].children.length; p++) {//第四级 + if (treeData[j].children[k].children[l].children[p].cameraId) { + for (let i = 0; i < allCameraList.length; i++) { + if (allCameraList[i].id == treeData[j].children[k].children[l].children[p].cameraId) { + myAllCameraList.push(allCameraList[i]) + } + } + } + } + } + else if (treeData[j].children[k].children[l].cameraId) {//有没有摄像头 + for (let i = 0; i < allCameraList.length; i++) { + if (allCameraList[i].value == treeData[j].children[k].children[l].cameraId) { + myAllCameraList.push(allCameraList[i]) + } + } + } + } + } + else if (treeData[j].children[k].cameraId) {//有没有摄像头 + for (let i = 0; i < allCameraList.length; i++) { + if (allCameraList[i].value == treeData[j].children[k].cameraId) { + myAllCameraList.push(allCameraList[i]) + } + } + } + } + } + } + let myFilterGroupList=JSON.parse(JSON.stringify(filterGroup)) + for (let i = 0; i < myFilterGroupList.length; i++) { + if(myFilterGroupList[i].filters){ + for (let j = 0; j < myFilterGroupList[i].filters.length; j++) { + let idArr=JSON.parse(JSON.stringify(myFilterGroupList[i].filters[j].cameraIds)) + let newArr=[] + for (let k = 0; k < idArr.length; k++) { + for (let l = 0; l < myAllCameraList.length; l++) { + if(idArr[k]==myAllCameraList[l].id){ + newArr.push(idArr[k]) + } + } + } + myFilterGroupList[i].filters[j].cameraIds=newArr + } + } + } + setFilterGroup(myFilterGroupList) + setLabelCameraList(myAllCameraList) setAddLabelNum(index) setAddLabel(true) } @@ -1022,7 +1078,7 @@ const MirroringDetail = (props) => {
header
-
setShowHeader(v)} size="small" aria-label="是否有头部">
+
{setShowHeader(v);sethasModify(true)}} size="small" aria-label="是否有头部">
{ setComingVisible(true) }}>
自定义样式
@@ -1099,13 +1155,20 @@ const MirroringDetail = (props) => { style={{ width: '100%' }} />
-
{ screenDel(index) }}> - 设置 -
+ screenDel(index)}> +
+ 设置 +
+
{ addLabelGroup(index) }}> {