diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js index b237b42..f446611 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js @@ -9,7 +9,7 @@ async function edit (ctx) { const { userId } = ctx.fs.api const data = ctx.request.body const timeNow = moment() - const { mirrorId, tree = [], filterGroup = [], listOpen = false } = data + const { mirrorId, tree = [], filterGroup = [], listOpen = false ,check=[] } = data let mirrorId_ = mirrorId if (mirrorId_) { @@ -18,7 +18,8 @@ async function edit (ctx) { updateTime: timeNow.format(), title: data.title, showHeader: Boolean(data.showHeader), - listOpen:listOpen + listOpen:listOpen, + check:check } if (data.publish) { upData.publish = true @@ -64,7 +65,8 @@ async function edit (ctx) { showHeader: Boolean(data.showHeader), publish: false, mid: timeNow.format(`ssmmHHDDMMYY${Math.floor(Math.random() * 89 + 10)}`), - listOpen: listOpen + listOpen: listOpen, + check:check } if (data.publish) { createData.publish = true diff --git a/code/VideoAccess-VCMP/api/app/lib/models/mirror.js b/code/VideoAccess-VCMP/api/app/lib/models/mirror.js index 909a4f5..bd94733 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/mirror.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/mirror.js @@ -87,6 +87,15 @@ module.exports = dc => { field: "publish", autoIncrement: false }, + check: { + type: DataTypes.ARRAY(DataTypes.INTEGER), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "check", + autoIncrement: false + }, mid: { type: DataTypes.STRING, allowNull: false, diff --git a/code/VideoAccess-VCMP/script/1.6.3.1/achema/1.update_mirror.sql b/code/VideoAccess-VCMP/script/1.6.3.1/achema/1.update_mirror.sql index 36596ec..201546e 100644 --- a/code/VideoAccess-VCMP/script/1.6.3.1/achema/1.update_mirror.sql +++ b/code/VideoAccess-VCMP/script/1.6.3.1/achema/1.update_mirror.sql @@ -1,4 +1,10 @@ alter table mirror add list_open boolean; -comment on column mirror.list_open is '镜像大屏列表是否折叠'; \ No newline at end of file +comment on column mirror.list_open is '镜像大屏列表是否折叠'; + + +alter table mirror + add "check" integer[]; + +comment on column mirror."check" is '分组勾选'; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx index 94787bf..b1d7879 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx @@ -12,22 +12,18 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => { // console.log(videoObj); useEffect(() => { - // const resize_ = async () => { - // try { - // let video = document.getElementById('video' + videoObj.key) - // if (video) { - // await setVideoWidth(video.clientWidth) - // await setVideoHeight(video.clientHeight) - // } - // } catch (error) { - // console.error(error) - // } - // } - // resize_() - // window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发 - // return () => { - // window.removeEventListener('resize', resize_); - // } + + const resize_ = async () => { + try { + let video = document.getElementById('video' + videoObj.key) + if (video) { + await setVideoWidth(video.clientWidth) + await setVideoHeight(video.clientHeight) + } + } catch (error) { + console.error(error) + } + } const div = document.getElementById('rearProjection'); @@ -42,7 +38,14 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => { }; document.addEventListener('fullscreenchange', handleFullscreenChange); + resize_() + + window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发 + return () => { + + window.removeEventListener('resize', resize_); + document.removeEventListener('fullscreenchange', handleFullscreenChange); }; }, []) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx index 3b4db65..4c37451 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx @@ -8,7 +8,7 @@ import PerfectScrollbar from "perfect-scrollbar"; let timing let projectScrollbar; -const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, showHeader, listOpen }) => { +const VideoScreen = ({ treeData, filterGroup, videoPlay, template, treeValue, headerName, showHeader, listOpen }) => { // console.log('视频信息', treeData); // console.log('筛选组', filterGroup); // console.log(headerName); @@ -112,9 +112,9 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s let values = treeData.map(v => v.value) videoData(treeData, values) setLefTtree(treeData) - setLeftValue(treeData.map(v => v.value)) + setLeftValue(treeValue) api.current?.reset() - }, [treeData, filterGroup]) + }, [treeValue,treeData, filterGroup]) useEffect(() => { diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx index d47412e..1f3b1ed 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx @@ -18,6 +18,7 @@ const CallService = (props) => { const [videoPlay, setVideoPlay] = useState(true) //视频预览 const [listOpen, setlistOpen] = useState(false)//是否展开列表 const [loading, setLoading] = useState(false) + const [treeValue, setTreeValue] = useState([]) useEffect(async () => { @@ -40,6 +41,58 @@ const CallService = (props) => { setlistOpen(data.listOpen || false) setFilterGroup(filterGrouplist) setTemplate(data.template) + + if (data?.check?.length > 0) { + let checks = data?.check + let vlaue = [] + data?.tree?.map(f => { + if (f.children?.length > 0) { //1 + f.children?.map(d => { + if (checks.includes(d.cameraId)) { + vlaue.push(d.key); + } else if (d.children?.length > 0) { //2 + d.children?.map(s => { + if (checks.includes(s.cameraId)) { + vlaue.push(s.key); + } else if (s.children?.length > 0) { + s.children?.map(g => { //3 + if (checks.includes(g.cameraId)) { + vlaue.push(g.key); + } + }) + } + }) + } + }) + } + }) + setTreeValue(vlaue) + } else { + let vlaue = [] + data?.tree?.map(f => { + if (f.children?.length > 0) { //1 + f.children?.map(d => { + if (d.cameraId) { + vlaue.push(d.key); + } else if (d.children?.length > 0) { //2 + d.children?.map(s => { + if (s.cameraId) { + vlaue.push(s.key); + } else if (s.children?.length > 0) { + s.children?.map(g => { //3 + if (g.cameraId) { + vlaue.push(g.key); + } + }) + } + }) + } + }) + } + }) + console.log(vlaue); + setTreeValue(vlaue) + } } else { dispatch(push('/noMatch')) Notification.error({ @@ -57,6 +110,7 @@ const CallService = (props) => { {treeData && loading ? { - let mytreeData = res + +let checksScrollbar + +export const tree = (res) => { + let mytreeData = [...res] for (let i = 0; i < mytreeData.length; i++) {//第一层 - mytreeData[i].value = mytreeData[i].key - for (let j = 0; j < mytreeData[i].children.length; j++) {//第二层 - mytreeData[i].children[j].value = mytreeData[i].children[j].key - if (mytreeData[i].children[j].camera) { - if (mytreeData[i].children[j].camera.type == 'yingshi') { - mytreeData[i].children[j].camera.content = mytreeData[i].children[j].camera.cameraRemarks.map(v => v.remark), - mytreeData[i].children[j].camera.yingshiToken = mytreeData[i].children[j].camera.secretYingshi.token + mytreeData[i].value = mytreeData[i].key + for (let j = 0; j < mytreeData[i].children.length; j++) {//第二层 + mytreeData[i].children[j].value = mytreeData[i].children[j].key + if (mytreeData[i].children[j].camera) { + if (mytreeData[i].children[j].camera.type == 'yingshi') { + mytreeData[i].children[j].camera.content = mytreeData[i].children[j].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].camera.yingshiToken = mytreeData[i].children[j].camera.secretYingshi.token + } + else { + mytreeData[i].children[j].camera.content = mytreeData[i].children[j].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].camera.yingshiToken = null + } + } + else { + for (let k = 0; k < mytreeData[i].children[j].children.length; k++) {//第三层 + mytreeData[i].children[j].children[k].value = mytreeData[i].children[j].children[k].key + if (mytreeData[i].children[j].children[k].camera) { + if (mytreeData[i].children[j].children[k].camera.type == 'yingshi') { + mytreeData[i].children[j].children[k].camera.content = mytreeData[i].children[j].children[k].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].camera.yingshiToken = mytreeData[i].children[j].children[k].camera.secretYingshi.token + } + else { + mytreeData[i].children[j].children[k].camera.content = mytreeData[i].children[j].children[k].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].camera.yingshiToken = null + } } else { - mytreeData[i].children[j].camera.content = mytreeData[i].children[j].camera.cameraRemarks.map(v => v.remark), - mytreeData[i].children[j].camera.yingshiToken = null - } - } - else { - for (let k = 0; k < mytreeData[i].children[j].children.length; k++) {//第三层 - mytreeData[i].children[j].children[k].value = mytreeData[i].children[j].children[k].key - if (mytreeData[i].children[j].children[k].camera) { - if (mytreeData[i].children[j].children[k].camera.type == 'yingshi') { - mytreeData[i].children[j].children[k].camera.content = mytreeData[i].children[j].children[k].camera.cameraRemarks.map(v => v.remark), - mytreeData[i].children[j].children[k].camera.yingshiToken = mytreeData[i].children[j].children[k].camera.secretYingshi.token - } - else { - mytreeData[i].children[j].children[k].camera.content = mytreeData[i].children[j].children[k].camera.cameraRemarks.map(v => v.remark), - mytreeData[i].children[j].children[k].camera.yingshiToken = null - } - } - else { - for (let l = 0; l < mytreeData[i].children[j].children[k].children.length; l++) { - mytreeData[i].children[j].children[k].children[l].value = mytreeData[i].children[j].children[k].children[l].key - if (mytreeData[i].children[j].children[k].children[l].camera) { - if (mytreeData[i].children[j].children[k].children[l].camera.type == 'yingshi') { - mytreeData[i].children[j].children[k].children[l].camera.content = mytreeData[i].children[j].children[k].children[l].camera.cameraRemarks.map(v => v.remark), - mytreeData[i].children[j].children[k].children[l].camera.yingshiToken = mytreeData[i].children[j].children[k].children[l].camera.secretYingshi.token - } - else { - mytreeData[i].children[j].children[k].children[l].camera.content = mytreeData[i].children[j].children[k].children[l].camera.cameraRemarks.map(v => v.remark), - mytreeData[i].children[j].children[k].children[l].camera.yingshiToken = null - } - } - } - } + for (let l = 0; l < mytreeData[i].children[j].children[k].children.length; l++) { + mytreeData[i].children[j].children[k].children[l].value = mytreeData[i].children[j].children[k].children[l].key + if (mytreeData[i].children[j].children[k].children[l].camera) { + if (mytreeData[i].children[j].children[k].children[l].camera.type == 'yingshi') { + mytreeData[i].children[j].children[k].children[l].camera.content = mytreeData[i].children[j].children[k].children[l].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].children[l].camera.yingshiToken = mytreeData[i].children[j].children[k].children[l].camera.secretYingshi.token + } + else { + mytreeData[i].children[j].children[k].children[l].camera.content = mytreeData[i].children[j].children[k].children[l].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].children[l].camera.yingshiToken = null + } + } + } } - } - } + } + } + } } return mytreeData } const MirroringDetail = (props) => { - const { history, dispatch, actions, user, loading, StatusPushList } = props; - const { openness } = actions; - useEffect(() => { - let search = props.location.search - let result = search.slice(1) - let searcharr = result.split('&') - if (searcharr.length == 1) { - setTemplate(searcharr[0].split('=')[1])//主题颜色 - } - else { - setTemplate(searcharr[0].split('=')[1])//主题颜色 - dispatch(openness.getMirrorDetail(searcharr[1].split('=')[1])).then((res) => { - let filterGrouplist = res.payload.data.filterGroup - for (let i = 0; i < filterGrouplist.length; i++) { - filterGrouplist[i].num = i - if (filterGrouplist[i].filters.length > 0) { - for (let j = 0; j < filterGrouplist[i].filters.length; j++) { - filterGrouplist[i].filters[j].num = j + const { history, dispatch, actions, user, loading, StatusPushList } = props; + const { openness } = actions; + useEffect(() => { + let search = props.location.search + let result = search.slice(1) + let searcharr = result.split('&') + if (searcharr.length == 1) { + setTemplate(searcharr[0].split('=')[1])//主题颜色 + } + else { + setTemplate(searcharr[0].split('=')[1])//主题颜色 + dispatch(openness.getMirrorDetail(searcharr[1].split('=')[1])).then((res) => { + let filterGrouplist = res.payload.data.filterGroup + for (let i = 0; i < filterGrouplist.length; i++) { + filterGrouplist[i].num = i + if (filterGrouplist[i].filters.length > 0) { + for (let j = 0; j < filterGrouplist[i].filters.length; j++) { + filterGrouplist[i].filters[j].num = j + } + } + } + setFilterGroup(filterGrouplist); + setMirrorId(res.payload.data.id);//id + setShowHeader(res.payload.data.showHeader); + setlistOpen(res.payload.data.listOpen || false) + setHeaderName(res.payload.data.title); + + let mytreeDatas = tree(res.payload.data.tree) + setTreeData(mytreeDatas); + + if (res.payload.data?.check?.length > 0) { + setCheckResult(res.payload.data.check) + let checks = res.payload.data.check + let vlaue = [] + mytreeDatas?.map(f => { + if (f.children?.length > 0) { //1 + f.children?.map(d => { + if (checks.includes(d.cameraId)) { + vlaue.push(d.key); + } else if (d.children?.length > 0) { //2 + d.children?.map(s => { + if (checks.includes(s.cameraId)) { + vlaue.push(s.key); + } else if (s.children?.length > 0) { + s.children?.map(g => { //3 + if (checks.includes(g.cameraId)) { + vlaue.push(g.key); + } + }) + } + }) + } + }) + } + }) + setTreeValue(vlaue) + } else { + let data = [] + let vlaue = [] + mytreeDatas?.map(f => { + if (f.children?.length > 0) { //1 + f.children?.map(d => { + if (d.cameraId) { + data.push(d.cameraId); + vlaue.push(d.key); + } else if (d.children?.length > 0) { //2 + d.children?.map(s => { + if (s.cameraId) { + data.push(s.cameraId); + vlaue.push(s.key); + } else if (s.children?.length > 0) { + s.children?.map(g => { //3 + if (g.cameraId) { + data.push(g.cameraId); + vlaue.push(g.key); + } + }) + } + }) } - } - } - setFilterGroup(filterGrouplist); - setMirrorId(res.payload.data.id);//id - setShowHeader(res.payload.data.showHeader); - setlistOpen(res.payload.data.listOpen||false) - setHeaderName(res.payload.data.title); - - let mytreeDatas= tree(res.payload.data.tree) - setTreeData(mytreeDatas); - }) - } - equipmentGetCamera(); - }, []); - const [hasModify, sethasModify] = useState(false)//有没有进行修改 - const [showHeader, setShowHeader] = useState(false)//是否展示头部 - const [listOpen, setlistOpen] = useState(false)//是否展开列表 - - const [mirrorId, setMirrorId] = useState(null)//id - const [backVisible, setBackVisible] = useState(false)//返回上一页是否修改过 + }) + } + }) + setTreeValue(vlaue) + setCheckResult(data) + } + }) + } + equipmentGetCamera(); - const [template, setTemplate] = useState('')//主题颜色 - const [chooseNum, setChooseNum] = useState(0);//当前选择tab - const [chooseList, setChooseList] = useState(['节点', '样式', '功能']); - const [editKey, setEditKey] = useState('') - const [editNum, setEditNum] = useState(1000) - const [labelEditNum, setLabelEditNum] = useState(1000) - const [comingVisible, setComingVisible] = useState(false) - const [treeData, setTreeData] = useState([//树形控件数据 - { - label: '主要节点1', - value: '0', - key: '0', - }, - ]); - const [indeterminate, setIndeterminate] = useState(false);//全选 - const [checkAll, setCheckall] = useState(false);//全选是否 - const [plainOptions, setPlainOptions] = useState([]);//摄像头选择 - const [checkedList, setCheckedList] = useState([]);//选中的摄像头列表 - const [mykeyword, setMykeyword] = useState('');//摄像头搜索 - const [allCameraList, setAllCameraList] = useState([])//所有的摄像头 - const [labelCameraList, setLabelCameraList] = useState([])//标签组的摄像头 - const [showCameraList, setShowCameraList] = useState([])//展示的摄像头列表 - const [saveShowList, setSaveShowList] = useState([])//展示的摄像头列表 - const [addCamera, setAddCamera] = useState(false);//添加视频弹框 - const [addCameraKey, setAddCameraKey] = useState('');//添加视频弹框 - const [addScreen, setAddScreen] = useState(false)//筛选项设置弹框 - const [addLabel, setAddLabel] = useState(false)//标签组设置弹框 - const [filterGroup, setFilterGroup] = useState([])//筛选项数据 - const [addLabelNum, setAddLabelNum] = useState(0)//标签组添加 - const [headerName, setHeaderName] = useState('我的镜像服务01');//添加视频弹框 - const [editHeaderName, setEditHeaderName] = useState(false)//是否设置头部名称 - const [videoPlay, setVideoPlay] = useState(false);//视频预览 - function changeHeaderName () {//修改头部名称 - setEditHeaderName(true) - } - function onCheckAllChange (e) {//全选 - if (e.target.checked) { - let mycheckList = [] - for (let i = 0; i < showCameraList.length; i++) { - mycheckList.push(showCameraList[i].value) + }, []); + + useEffect(() => { + if (groupChecked) { + const dom = document.getElementById("checkss"); + if (dom && checksScrollbar) { + checksScrollbar.update(); + } + } + }) + + const [hasModify, sethasModify] = useState(false)//有没有进行修改 + const [showHeader, setShowHeader] = useState(false)//是否展示头部 + const [listOpen, setlistOpen] = useState(false)//是否展开列表 + const [groupChecked, setGroupChecked] = useState(false)//是否展开分组勾选 + const [checkResult, setCheckResult] = useState([])//分组勾选摄像头id + const [treeValue, setTreeValue] = useState([]) + + const [mirrorId, setMirrorId] = useState(null)//id + const [backVisible, setBackVisible] = useState(false)//返回上一页是否修改过 + + + const [template, setTemplate] = useState('')//主题颜色 + const [chooseNum, setChooseNum] = useState(0);//当前选择tab + const [chooseList, setChooseList] = useState(['节点', '样式', '功能']); + const [editKey, setEditKey] = useState('') + const [editNum, setEditNum] = useState(1000) + const [labelEditNum, setLabelEditNum] = useState(1000) + + const [comingVisible, setComingVisible] = useState(false) + const [treeData, setTreeData] = useState([//树形控件数据 + { + label: '主要节点1', + value: '0', + key: '0', + }, + ]); + const [indeterminate, setIndeterminate] = useState(false);//全选 + const [checkAll, setCheckall] = useState(false);//全选是否 + const [plainOptions, setPlainOptions] = useState([]);//摄像头选择 + const [checkedList, setCheckedList] = useState([]);//选中的摄像头列表 + const [mykeyword, setMykeyword] = useState('');//摄像头搜索 + const [allCameraList, setAllCameraList] = useState([])//所有的摄像头 + const [labelCameraList, setLabelCameraList] = useState([])//标签组的摄像头 + const [showCameraList, setShowCameraList] = useState([])//展示的摄像头列表 + const [saveShowList, setSaveShowList] = useState([])//展示的摄像头列表 + const [addCamera, setAddCamera] = useState(false);//添加视频弹框 + const [addCameraKey, setAddCameraKey] = useState('');//添加视频弹框 + const [addScreen, setAddScreen] = useState(false)//筛选项设置弹框 + const [addLabel, setAddLabel] = useState(false)//标签组设置弹框 + const [filterGroup, setFilterGroup] = useState([])//筛选项数据 + const [addLabelNum, setAddLabelNum] = useState(0)//标签组添加 + const [headerName, setHeaderName] = useState('我的镜像服务01');//添加视频弹框 + const [editHeaderName, setEditHeaderName] = useState(false)//是否设置头部名称 + const [videoPlay, setVideoPlay] = useState(false);//视频预览 + + + + function changeHeaderName () {//修改头部名称 + setEditHeaderName(true) + } + function onCheckAllChange (e) {//全选 + if (e.target.checked) { + let mycheckList = [] + for (let i = 0; i < showCameraList.length; i++) { + mycheckList.push(showCameraList[i].value) + } + setCheckedList(mycheckList) + } + else { + setCheckedList([]) + } + setIndeterminate(false); + setCheckall(e.target.checked); + } + function equipmentGetCamera () {//查询摄像头 + dispatch(openness.getCameraListAll()).then((res) => { + let resList = res.payload.data + let optionsList = [] + for (let i = 0; i < resList.length; i++) { + if (resList[i].type == 'yingshi') { + optionsList.push({ + label: resList[i].name, + value: resList[i].id, + extra: 'DID:' + (resList[i].gbCamera.did || ''), + did: resList[i].gbCamera.did || '', + id: resList[i].id, + channelNo: resList[i].channelNo, + content: resList[i].cameraRemarks.map(v => v.remark), + serialNo: resList[i].serialNo, + type: resList[i].type, + yingshiToken: resList[i].secretYingshi.token + }) } - setCheckedList(mycheckList) - } - else { - setCheckedList([]) - } - setIndeterminate(false); - setCheckall(e.target.checked); - } - function equipmentGetCamera () {//查询摄像头 - dispatch(openness.getCameraListAll()).then((res) => { - let resList = res.payload.data - let optionsList = [] - for (let i = 0; i < resList.length; i++) { - if (resList[i].type == 'yingshi') { - optionsList.push({ - label: resList[i].name, - value: resList[i].id, - extra: 'DID:' + (resList[i].gbCamera.did || ''), - did: resList[i].gbCamera.did || '', - id: resList[i].id, - channelNo: resList[i].channelNo, - content: resList[i].cameraRemarks.map(v => v.remark), - serialNo: resList[i].serialNo, - type: resList[i].type, - yingshiToken: resList[i].secretYingshi.token - }) - } - else { - optionsList.push({ - label: resList[i].name, - value: resList[i].id, - extra: 'DID:' + (resList[i].gbCamera?.did || ''), - did: resList[i].gbCamera?.did || '', - id: resList[i].id, - channelNo: resList[i].channelNo, - content: resList[i].cameraRemarks.map(v => v.remark), - serialNo: resList[i].serialNo, - type: resList[i].type, - yingshiToken: null - }) - } + else { + optionsList.push({ + label: resList[i].name, + value: resList[i].id, + extra: 'DID:' + (resList[i].gbCamera?.did || ''), + did: resList[i].gbCamera?.did || '', + id: resList[i].id, + channelNo: resList[i].channelNo, + content: resList[i].cameraRemarks.map(v => v.remark), + serialNo: resList[i].serialNo, + type: resList[i].type, + yingshiToken: null + }) } - setAllCameraList(optionsList) - setShowCameraList(optionsList) - setPlainOptions(optionsList) - }); - } - function onChange (checkedList) {//摄像头选择 - setCheckedList(checkedList); - setIndeterminate(!!checkedList.length && checkedList.length < showCameraList.length); - setCheckall(checkedList.length === showCameraList.length); - } - function topublish (publish) {//编辑镜像信息 - 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) { - filterGroupnum++ - } + } + setAllCameraList(optionsList) + setShowCameraList(optionsList) + setPlainOptions(optionsList) + }); + } + function onChange (checkedList) {//摄像头选择 + setCheckedList(checkedList); + setIndeterminate(!!checkedList.length && checkedList.length < showCameraList.length); + setCheckall(checkedList.length === showCameraList.length); + } + function topublish (publish) {//编辑镜像信息 + 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) { + filterGroupnum++ } - } - if (filterGroupnum > filterGroup.length) { - cantopublish = false - let opts = { - content: '筛选项名称不能重复,请修改', - duration: 3, - }; - Toast.error(opts) - } else { - for (let k = 0; k < filterGroup.length; k++) { - 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 < filterGroup[k].filters.length) { - cantopublish = false - Toast.error({ - content: '标签组名称不能重复,请修改', - duration: 3, - }) - } + } + } + if (filterGroupnum > filterGroup.length) { + cantopublish = false + let opts = { + content: '筛选项名称不能重复,请修改', + duration: 3, + }; + Toast.error(opts) + } else { + for (let k = 0; k < filterGroup.length; k++) { + let filtersarr = [] + for (let l = 0; l < filterGroup[k].filters.length; l++) { + filtersarr.push(filterGroup[k].filters[l].name) } - } - if (cantopublish) { - let mirrordata = { - mirrorId: mirrorId, - template: template, - title: headerName, - showHeader: showHeader, - publish: publish, - tree: treeData, - filterGroup: filterGroup, - listOpen:listOpen + if (Array.from(new Set(filtersarr)).length < filterGroup[k].filters.length) { + cantopublish = false + Toast.error({ + content: '标签组名称不能重复,请修改', + duration: 3, + }) } - dispatch(openness.putMirror(mirrordata)).then((res) => { - if (res.success) { - sethasModify(false) - Notification.success({ - content: publish?'发布完成':'保存完成', - duration: 3, - }) - } - }) - } - } - function nodeDelete (item) {//删除树状子节点 - let mainData = JSON.parse(JSON.stringify(treeData)) - let nodeKeyArr = item.key.split('-') - if (nodeKeyArr.length == 1) { - mainData.splice( - mainData.indexOf(mainData.find(function (element) { - return element.key === item.key - })), 1) - } else if (nodeKeyArr.length == 2) { - for (let index = 0; index < mainData.length; index++) { - if (mainData[index].children) { - for (let j = 0; j < mainData[index].children.length; j++) { - if (item.key == mainData[index].children[j].key) { - mainData[index].children.splice(j, 1) - } - } - } + } + } + if (cantopublish) { + let mirrordata = { + mirrorId: mirrorId, + template: template, + title: headerName, + showHeader: showHeader, + publish: publish, + tree: treeData, + filterGroup: filterGroup, + listOpen: listOpen, + check: checkResult + } + dispatch(openness.putMirror(mirrordata)).then((res) => { + if (res.success) { + sethasModify(false) + Notification.success({ + content: publish ? '发布完成' : '保存完成', + duration: 3, + }) + } + }) + } + } + function nodeDelete (item) {//删除树状子节点 + let mainData = JSON.parse(JSON.stringify(treeData)) + let nodeKeyArr = item.key.split('-') + if (nodeKeyArr.length == 1) { + mainData.splice( + mainData.indexOf(mainData.find(function (element) { + return element.key === item.key + })), 1) + } else if (nodeKeyArr.length == 2) { + for (let index = 0; index < mainData.length; index++) { + if (mainData[index].children) { + for (let j = 0; j < mainData[index].children.length; j++) { + if (item.key == mainData[index].children[j].key) { + mainData[index].children.splice(j, 1) + } + } } - } else if (nodeKeyArr.length == 3) { - for (let j = 0; j < mainData.length; j++) { - if (mainData[j].children) { - for (let i = 0; i < mainData[j].children.length; i++) { - if (mainData[j].children[i].children) { - for (let k = 0; k < mainData[j].children[i].children.length; k++) { - if (item.key == mainData[j].children[i].children[k].key) { - mainData[j].children[i].children.splice(k, 1) - } - } + } + } else if (nodeKeyArr.length == 3) { + for (let j = 0; j < mainData.length; j++) { + if (mainData[j].children) { + for (let i = 0; i < mainData[j].children.length; i++) { + if (mainData[j].children[i].children) { + for (let k = 0; k < mainData[j].children[i].children.length; k++) { + if (item.key == mainData[j].children[i].children[k].key) { + mainData[j].children[i].children.splice(k, 1) } + } + } - } - } + } } - } else if (nodeKeyArr.length == 4) { - for (let k = 0; k < mainData.length; k++) { - if (mainData[k].children) { - for (let j = 0; j < mainData[k].children.length; j++) { - if (mainData[k].children[j].children) { - for (let i = 0; i < mainData[k].children[j].children.length; i++) { - if (mainData[k].children[j].children[i].children) { - for (let w = 0; w < mainData[k].children[j].children[i].children.length; w++) { - if (item.key == mainData[k].children[j].children[i].children[w].key) { - mainData[k].children[j].children[i].children.splice(w, 1) - } - } - } - } + } + } else if (nodeKeyArr.length == 4) { + for (let k = 0; k < mainData.length; k++) { + if (mainData[k].children) { + for (let j = 0; j < mainData[k].children.length; j++) { + if (mainData[k].children[j].children) { + for (let i = 0; i < mainData[k].children[j].children.length; i++) { + if (mainData[k].children[j].children[i].children) { + for (let w = 0; w < mainData[k].children[j].children[i].children.length; w++) { + if (item.key == mainData[k].children[j].children[i].children[w].key) { + mainData[k].children[j].children[i].children.splice(w, 1) + } + } } - } - } + } + } + } } - } - sethasModify(true) - setAddCamera(false) - setTreeData(mainData) - } - function nodeAdd (item) {//添加树状子节点 - let mainData = JSON.parse(JSON.stringify(treeData)) - let nodeKeyArr = item.key.split('-') - if (nodeKeyArr.length == 1) { - for (let index = 0; index < mainData.length; index++) { - if (mainData[index].key == item.key) { - if (mainData[index].children && mainData[index].children.length > 0) { - let mainKey = mainData[index].children[mainData[index].children.length - 1].key + } + } + sethasModify(true) + setAddCamera(false) + setTreeData(mainData) + } + function nodeAdd (item) {//添加树状子节点 + let mainData = JSON.parse(JSON.stringify(treeData)) + let nodeKeyArr = item.key.split('-') + if (nodeKeyArr.length == 1) { + for (let index = 0; index < mainData.length; index++) { + if (mainData[index].key == item.key) { + if (mainData[index].children && mainData[index].children.length > 0) { + let mainKey = mainData[index].children[mainData[index].children.length - 1].key + let thekeyarr = mainKey.split('-') + mainData[index].children.push({ + label: '二级节点' + (Number(thekeyarr[1]) + 2), + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), + }) + } + else { + let mainKey = mainData[index].key + let thekeyarr = mainKey.split('-') + mainData[index].children = [{ + label: '二级节点1', + value: (Number(thekeyarr[0])) + '-0', + key: (Number(thekeyarr[0])) + '-0', + }] + } + } + } + } else if (nodeKeyArr.length == 2) { + for (let index = 0; index < mainData.length; index++) { + if (mainData[index].children) { + for (let j = 0; j < mainData[index].children.length; j++) { + if (mainData[index].children[j].key == item.key) { + if (mainData[index].children[j].children && mainData[index].children[j].children.length > 0) { + let mainKey = mainData[index].children[j].children[mainData[index].children[j].children.length - 1].key let thekeyarr = mainKey.split('-') - mainData[index].children.push({ - label: '二级节点' + (Number(thekeyarr[1]) + 2), - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), + mainData[index].children[j].children.push({ + label: '三级节点' + (Number(thekeyarr[2]) + 2), + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), }) - } - else { - let mainKey = mainData[index].key + } + else { + let mainKey = mainData[index].children[j].key let thekeyarr = mainKey.split('-') - mainData[index].children = [{ - label: '二级节点1', - value: (Number(thekeyarr[0])) + '-0', - key: (Number(thekeyarr[0])) + '-0', + mainData[index].children[j].children = [{ + label: '三级节点1', + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', }] - } - } - } - } else if (nodeKeyArr.length == 2) { - for (let index = 0; index < mainData.length; index++) { - if (mainData[index].children) { - for (let j = 0; j < mainData[index].children.length; j++) { - if (mainData[index].children[j].key == item.key) { - if (mainData[index].children[j].children && mainData[index].children[j].children.length > 0) { - let mainKey = mainData[index].children[j].children[mainData[index].children[j].children.length - 1].key - let thekeyarr = mainKey.split('-') - mainData[index].children[j].children.push({ - label: '三级节点' + (Number(thekeyarr[2]) + 2), - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), - }) - } - else { - let mainKey = mainData[index].children[j].key - let thekeyarr = mainKey.split('-') - mainData[index].children[j].children = [{ - label: '三级节点1', - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', - }] - } - } - } - } - } - } - sethasModify(true) - setTreeData(mainData) - } - function changeLable (value, item) {//编辑摄像头名称 - let mainData = JSON.parse(JSON.stringify(treeData)) - let nodeKeyArr = item.key.split('-') - if (nodeKeyArr.length == 1) { - for (let index = 0; index < mainData.length; index++) { - if (mainData[index].key == item.key) { - mainData[index].label = value - } + } + } + } } - } else if (nodeKeyArr.length == 2) { - for (let index = 0; index < mainData.length; index++) { - for (let j = 0; j < mainData[index].children.length; j++) { - if (mainData[index].children[j].key == item.key) { - mainData[index].children[j].label = value - } - } + } + } + sethasModify(true) + setTreeData(mainData) + } + function changeLable (value, item) {//编辑摄像头名称 + let mainData = JSON.parse(JSON.stringify(treeData)) + let nodeKeyArr = item.key.split('-') + if (nodeKeyArr.length == 1) { + for (let index = 0; index < mainData.length; index++) { + if (mainData[index].key == item.key) { + mainData[index].label = value } - } else if (nodeKeyArr.length == 3) { - for (let index = 0; index < mainData.length; index++) { - for (let j = 0; j < mainData[index].children.length; j++) { - for (let k = 0; k < mainData[index].children[j].children.length; k++) { - if (mainData[index].children[j].children[k].key == item.key) { - mainData[index].children[j].children[k].label = value - } - } - } + } + } else if (nodeKeyArr.length == 2) { + for (let index = 0; index < mainData.length; index++) { + for (let j = 0; j < mainData[index].children.length; j++) { + if (mainData[index].children[j].key == item.key) { + mainData[index].children[j].label = value + } } - } - sethasModify(true) - setTreeData(mainData) - } - function lableBlur () { - setEditKey('') - } - function cameraAdd (item) {//添加摄像头 - let myItemArr = [] - if (item.children) { - for (let q = 0; q < item.children.length; q++) { - myItemArr.push(item.children[q].cameraId) + } + } else if (nodeKeyArr.length == 3) { + for (let index = 0; index < mainData.length; index++) { + for (let j = 0; j < mainData[index].children.length; j++) { + for (let k = 0; k < mainData[index].children[j].children.length; k++) { + if (mainData[index].children[j].children[k].key == item.key) { + mainData[index].children[j].children[k].label = value + } + } } - } - let myplainOptions = JSON.parse(JSON.stringify(plainOptions)) - 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 < 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) - } - } - } - } - } - } - 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) { - myplainOptions.splice(i, 1) - } + } + } + sethasModify(true) + setTreeData(mainData) + } + function lableBlur () { + setEditKey('') + } + function cameraAdd (item) {//添加摄像头 + let myItemArr = [] + if (item.children) { + for (let q = 0; q < item.children.length; q++) { + myItemArr.push(item.children[q].cameraId) + } + } + let myplainOptions = JSON.parse(JSON.stringify(plainOptions)) + 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 < 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) } - } - } + } + } + } } - } - else if (treeData[j].children[k].cameraId) {//有没有摄像头 + } + 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].cameraId) { - if (myItemArr.indexOf(myplainOptions[i].value) == -1) { - myplainOptions.splice(i, 1) - } - } + if (myplainOptions[i].value == treeData[j].children[k].children[l].cameraId) { + if (myItemArr.indexOf(myplainOptions[i].value) == -1) { + myplainOptions.splice(i, 1) + } + } } - } - } + } + } + } + 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) { + myplainOptions.splice(i, 1) + } + } + } + } } - } - onChange(myItemArr) - setCheckedList(myItemArr) - setSaveShowList(myplainOptions) - setShowCameraList(myplainOptions) - setAddCamera(true) - setAddCameraKey(item.key) - } - const renderLabel = (label, item) => {//树状展示 - let keyArr = item.key.split('-') - return ( -
- { - keyArr.length == 1 ? ( -
-
- 设置 -
-
- { - editKey == item.key ? ( - changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'> - ) : - ( - - {label} - ) - } -
-
- ) : ( -
- { - editKey == item.key ? ( - changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'> - ) : - ( - - {label} - ) - } -
- ) - } -
- { - (!item.children || item.children.length < 1 || item.children[0].cameraId) && !item.cameraId ? ( -
cameraAdd(item)}> - 添加摄像头 -
- ) : ('') - } - { - item.cameraId ? ('') : ( -
{ setEditKey(item.key) }}> - 编辑 -
- ) - } - nodeDelete(item)}> -
- 删除 -
-
- { - (item.children && item.children.length > 0 && item.children[0].cameraId) || keyArr.length > 2 || item.cameraId ? ('') : ( -
nodeAdd(item)}> - 添加子节点 -
- ) - } -
+ } + } + onChange(myItemArr) + setCheckedList(myItemArr) + setSaveShowList(myplainOptions) + setShowCameraList(myplainOptions) + setAddCamera(true) + setAddCameraKey(item.key) + } + const renderLabel = (label, item) => {//树状展示 + let keyArr = item.key.split('-') + return ( +
+ { + keyArr.length == 1 ? ( +
+
+ 设置 +
+
+ { + editKey == item.key ? ( + changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'> + ) : + ( + + {label} + ) + } +
+
+ ) : ( +
+ { + editKey == item.key ? ( + changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'> + ) : + ( + + {label} + ) + } +
+ ) + } +
+ { + (!item.children || item.children.length < 1 || item.children[0].cameraId) && !item.cameraId ? ( +
cameraAdd(item)}> + 添加摄像头 +
+ ) : ('') + } + { + item.cameraId ? ('') : ( +
{ setEditKey(item.key) }}> + 编辑 +
+ ) + } + nodeDelete(item)}> +
+ 删除 +
+
+ { + (item.children && item.children.length > 0 && item.children[0].cameraId) || keyArr.length > 2 || item.cameraId ? ('') : ( +
nodeAdd(item)}> + 添加子节点 +
+ ) + }
- ) - }; - function toback () {//返回上一个页面 - if (hasModify) { - setBackVisible(true) - } - else { - history.goBack() - } - } - function tochange (index) {//节点样式功能切换 - setChooseNum(index); - setAddCamera(false); - setMykeyword(''); - setAddScreen(false); - setAddLabel(false); - } - function addMainNode () {//增加主要节点 - let mainData = JSON.parse(JSON.stringify(treeData)) - if (mainData.length > 0) { - let mainKey = mainData[mainData.length - 1].key - mainKey = Number(mainKey) + 2 - mainData.push({ - label: '主要节点' + mainKey, - value: String(mainKey - 1), - key: String(mainKey - 1), - }) - } - else { - mainData.push({ - label: '主要节点1', - value: '0', - key: '0', - }) - } - sethasModify(true) - setTreeData(mainData) - } - function searchCamera () {//查询摄像头 - if (mykeyword !== '') { - let myfindList = [] - for (let index = 0; index < showCameraList.length; index++) { - if (showCameraList[index].label.indexOf(mykeyword) != -1 || showCameraList[index].did.indexOf(mykeyword) != -1) { - myfindList.push(showCameraList[index]) - } +
+ ) + }; + function toback () {//返回上一个页面 + if (hasModify) { + setBackVisible(true) + } + else { + history.goBack() + } + } + function tochange (index) {//节点样式功能切换 + setChooseNum(index); + setAddCamera(false); + setMykeyword(''); + setAddScreen(false); + setAddLabel(false); + setGroupChecked(false) + } + function addMainNode () {//增加主要节点 + let mainData = JSON.parse(JSON.stringify(treeData)) + if (mainData.length > 0) { + let mainKey = mainData[mainData.length - 1].key + mainKey = Number(mainKey) + 2 + mainData.push({ + label: '主要节点' + mainKey, + value: String(mainKey - 1), + key: String(mainKey - 1), + }) + } + else { + mainData.push({ + label: '主要节点1', + value: '0', + key: '0', + }) + } + sethasModify(true) + setTreeData(mainData) + } + function searchCamera () {//查询摄像头 + if (mykeyword !== '') { + let myfindList = [] + for (let index = 0; index < showCameraList.length; index++) { + if (showCameraList[index].label.indexOf(mykeyword) != -1 || showCameraList[index].did.indexOf(mykeyword) != -1) { + myfindList.push(showCameraList[index]) } - setShowCameraList(myfindList); - } - else { - setShowCameraList(saveShowList); - } - } - function finishAdd () {//完成添加摄像头 - let mainData = JSON.parse(JSON.stringify(treeData)) - let nodeKeyArr = addCameraKey.split('-') - if (nodeKeyArr.length == 1) { - 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]) { - for (let index = 0; index < mainData.length; index++) { - if (mainData[index].key == addCameraKey) { - if (mainData[index].children && mainData[index].children.length > 0) { - let mainKey = mainData[index].children[mainData[index].children.length - 1].key - let thekeyarr = mainKey.split('-') - mainData[index].children.push({ - label: plainOptions[q].label, - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), - cameraId: plainOptions[q].value, - camera: { - channelNo: plainOptions[q].channelNo, - content: plainOptions[q].content, - serialNo: plainOptions[q].serialNo, - type: plainOptions[q].type, - yingshiToken: plainOptions[q].yingshiToken, - id: plainOptions[q].id, - } - }) - } - else { - let mainKey = mainData[index].key - let thekeyarr = mainKey.split('-') - mainData[index].children = [{ - label: plainOptions[q].label, - value: (Number(thekeyarr[0])) + '-0', - key: (Number(thekeyarr[0])) + '-0', - cameraId: plainOptions[q].value, - camera: { - channelNo: plainOptions[q].channelNo, - content: plainOptions[q].content, - serialNo: plainOptions[q].serialNo, - type: plainOptions[q].type, - yingshiToken: plainOptions[q].yingshiToken, - id: plainOptions[q].id, - } - }] - } - } + } + setShowCameraList(myfindList); + } + else { + setShowCameraList(saveShowList); + } + } + function finishAdd () {//完成添加摄像头 + let mainData = JSON.parse(JSON.stringify(treeData)) + let nodeKeyArr = addCameraKey.split('-') + if (nodeKeyArr.length == 1) { + 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]) { + for (let index = 0; index < mainData.length; index++) { + if (mainData[index].key == addCameraKey) { + if (mainData[index].children && mainData[index].children.length > 0) { + let mainKey = mainData[index].children[mainData[index].children.length - 1].key + let thekeyarr = mainKey.split('-') + mainData[index].children.push({ + label: plainOptions[q].label, + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1), + cameraId: plainOptions[q].value, + camera: { + channelNo: plainOptions[q].channelNo, + content: plainOptions[q].content, + serialNo: plainOptions[q].serialNo, + type: plainOptions[q].type, + yingshiToken: plainOptions[q].yingshiToken, + id: plainOptions[q].id, + } + }) } - } - } - } - } else if (nodeKeyArr.length == 2) { - 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]) { - for (let index = 0; index < mainData.length; index++) {//第一级 - if (mainData[index].children) {//有没有子集 - for (let j = 0; j < mainData[index].children.length; j++) {//第二级 - if (mainData[index].children[j].key == addCameraKey) { - if (mainData[index].children[j].children && mainData[index].children[j].children.length > 0) { - let mainKey = mainData[index].children[j].children[mainData[index].children[j].children.length - 1].key - let thekeyarr = mainKey.split('-') - mainData[index].children[j].children.push({ - label: plainOptions[q].label, - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), - cameraId: plainOptions[q].value, - camera: { - channelNo: plainOptions[q].channelNo, - content: plainOptions[q].content, - serialNo: plainOptions[q].serialNo, - type: plainOptions[q].type, - yingshiToken: plainOptions[q].yingshiToken, - id: plainOptions[q].id, - } - }) - } - else { - let mainKey = mainData[index].children[j].key - let thekeyarr = mainKey.split('-') - mainData[index].children[j].children = [{ - label: plainOptions[q].label, - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', - cameraId: plainOptions[q].value, - camera: { - channelNo: plainOptions[q].channelNo, - content: plainOptions[q].content, - serialNo: plainOptions[q].serialNo, - type: plainOptions[q].type, - yingshiToken: plainOptions[q].yingshiToken, - id: plainOptions[q].id, - } - }] - } - } - } - } + else { + let mainKey = mainData[index].key + let thekeyarr = mainKey.split('-') + mainData[index].children = [{ + label: plainOptions[q].label, + value: (Number(thekeyarr[0])) + '-0', + key: (Number(thekeyarr[0])) + '-0', + cameraId: plainOptions[q].value, + camera: { + channelNo: plainOptions[q].channelNo, + content: plainOptions[q].content, + serialNo: plainOptions[q].serialNo, + type: plainOptions[q].type, + yingshiToken: plainOptions[q].yingshiToken, + id: plainOptions[q].id, + } + }] } - } - } + } + } + } } - } else if (nodeKeyArr.length == 3) { - 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]) { - for (let index = 0; index < mainData.length; index++) {//第一级 - if (mainData[index].children) {//有没有子集 - for (let j = 0; j < mainData[index].children.length; j++) {//第二级 - if (mainData[index].children[j].children) {//有没有子集 - for (let k = 0; k < mainData[index].children[j].children.length; k++) {//第三级 - if (mainData[index].children[j].children[k].key == addCameraKey) { - if (mainData[index].children[j].children[k].children && mainData[index].children[j].children[k].children.length > 0) { - let mainKey = mainData[index].children[j].children[k].children[mainData[index].children[j].children[k].children.length - 1].key - let thekeyarr = mainKey.split('-') - mainData[index].children[j].children[k].children.push({ - label: plainOptions[q].label, - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-' + (Number(thekeyarr[3]) + 1), - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-' + (Number(thekeyarr[3]) + 1), - cameraId: plainOptions[q].value, - camera: { - channelNo: plainOptions[q].channelNo, - content: plainOptions[q].content, - serialNo: plainOptions[q].serialNo, - type: plainOptions[q].type, - yingshiToken: plainOptions[q].yingshiToken, - id: plainOptions[q].id, - } - }) - } - else { - let mainKey = mainData[index].children[j].children[k].key - let thekeyarr = mainKey.split('-') - mainData[index].children[j].children[k].children = [{ - label: plainOptions[q].label, - value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-0', - key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-0', - cameraId: plainOptions[q].value, - camera: { - channelNo: plainOptions[q].channelNo, - content: plainOptions[q].content, - serialNo: plainOptions[q].serialNo, - type: plainOptions[q].type, - yingshiToken: plainOptions[q].yingshiToken, - id: plainOptions[q].id, - } - }] - } - } - } + } + } else if (nodeKeyArr.length == 2) { + 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]) { + for (let index = 0; index < mainData.length; index++) {//第一级 + if (mainData[index].children) {//有没有子集 + for (let j = 0; j < mainData[index].children.length; j++) {//第二级 + if (mainData[index].children[j].key == addCameraKey) { + if (mainData[index].children[j].children && mainData[index].children[j].children.length > 0) { + let mainKey = mainData[index].children[j].children[mainData[index].children[j].children.length - 1].key + let thekeyarr = mainKey.split('-') + mainData[index].children[j].children.push({ + label: plainOptions[q].label, + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1), + cameraId: plainOptions[q].value, + camera: { + channelNo: plainOptions[q].channelNo, + content: plainOptions[q].content, + serialNo: plainOptions[q].serialNo, + type: plainOptions[q].type, + yingshiToken: plainOptions[q].yingshiToken, + id: plainOptions[q].id, } - } - } + }) + } + else { + let mainKey = mainData[index].children[j].key + let thekeyarr = mainKey.split('-') + mainData[index].children[j].children = [{ + label: plainOptions[q].label, + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0', + cameraId: plainOptions[q].value, + camera: { + channelNo: plainOptions[q].channelNo, + content: plainOptions[q].content, + serialNo: plainOptions[q].serialNo, + type: plainOptions[q].type, + yingshiToken: plainOptions[q].yingshiToken, + id: plainOptions[q].id, + } + }] + } + } } - } - } + } + } + } } - } - sethasModify(true) - setTreeData(mainData); - setAddCamera(false); - setMykeyword('') - setAddCameraKey(''); - } - function addScreenGroup () {//筛选项组设置弹框 - 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 (nodeKeyArr.length == 3) { + 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]) { + for (let index = 0; index < mainData.length; index++) {//第一级 + if (mainData[index].children) {//有没有子集 + for (let j = 0; j < mainData[index].children.length; j++) {//第二级 + if (mainData[index].children[j].children) {//有没有子集 + for (let k = 0; k < mainData[index].children[j].children.length; k++) {//第三级 + if (mainData[index].children[j].children[k].key == addCameraKey) { + if (mainData[index].children[j].children[k].children && mainData[index].children[j].children[k].children.length > 0) { + let mainKey = mainData[index].children[j].children[k].children[mainData[index].children[j].children[k].children.length - 1].key + let thekeyarr = mainKey.split('-') + mainData[index].children[j].children[k].children.push({ + label: plainOptions[q].label, + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-' + (Number(thekeyarr[3]) + 1), + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-' + (Number(thekeyarr[3]) + 1), + cameraId: plainOptions[q].value, + camera: { + channelNo: plainOptions[q].channelNo, + content: plainOptions[q].content, + serialNo: plainOptions[q].serialNo, + type: plainOptions[q].type, + yingshiToken: plainOptions[q].yingshiToken, + id: plainOptions[q].id, + } + }) } - } - } - 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 { + let mainKey = mainData[index].children[j].children[k].key + let thekeyarr = mainKey.split('-') + mainData[index].children[j].children[k].children = [{ + label: plainOptions[q].label, + value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-0', + key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2])) + '-0', + cameraId: plainOptions[q].value, + camera: { + channelNo: plainOptions[q].channelNo, + content: plainOptions[q].content, + serialNo: plainOptions[q].serialNo, + type: plainOptions[q].type, + yingshiToken: plainOptions[q].yingshiToken, + id: plainOptions[q].id, + } + }] } - } - } - } - } - 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]) - } + } + } + sethasModify(true) + setTreeData(mainData); + setAddCamera(false); + setMykeyword('') + setAddCameraKey(''); + } + function addScreenGroup () {//筛选项组设置弹框 + setAddScreen(true) + setGroupChecked(false) + } + 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]) + } + } + } } - } - myFilterGroupList[i].filters[j].cameraIds = newArr - } - } - } - setFilterGroup(myFilterGroupList) - setLabelCameraList(myAllCameraList) - setAddLabelNum(index) - setAddLabel(true) - } - function toAddScreen () {//添加筛选项 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - if (filterGroupList.length == 0) { - filterGroupList.push({ - name: '我的筛选项组0', - num: 0, - forbidden: true, - filters: [] - }) - } - else if (filterGroupList.length < 5) { - filterGroupList.push({ - name: '我的筛选项组' + (filterGroupList[filterGroupList.length - 1].num + 1), - num: filterGroupList[filterGroupList.length - 1].num + 1, - forbidden: true, - filters: [] - }) - } - sethasModify(true) - setFilterGroup(filterGroupList) - } - function toChangeScreen (num, name) {//筛选项去重 - let samenum = 0 - for (let i = 0; i < filterGroup.length; i++) { - if (filterGroup[i].name == name) { - samenum++ + } + 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]) + } + } + } } - } - if (samenum > 1) { - let opts = { - content: '筛选项名称不能重复,请修改', - duration: 3, - }; - Toast.error(opts) - setEditNum(num) - } - else { - setEditNum(1000) - } - } - function toChangeLabel (num, name, index) {//标签组去重 - let samenum = 0 - for (let i = 0; i < filterGroup[index].filters.length; i++) { - if (filterGroup[index].filters[i].name == name) { - samenum++ + } + } + 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 } - } - if (samenum > 1) { - let opts = { - content: '标签组名称不能重复,请修改', - duration: 3, - }; - Toast.error(opts) - setLabelEditNum(num) - } - else { - setLabelEditNum(1000) - } - } - function switchOnChange (val, index) {//筛选项是否禁用 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - filterGroupList[index].forbidden = val - setFilterGroup(filterGroupList) - sethasModify(true) - } - function screenDel (index) {//筛选项删除 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - filterGroupList.splice(index, 1) - setFilterGroup(filterGroupList) - sethasModify(true) - } - function toEditscreen (val, index) {//编辑筛选项名称 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - filterGroupList[index].name = val - setFilterGroup(filterGroupList) - sethasModify(true) - } - function toAddLabel () {//添加标签组 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - if (filterGroupList[addLabelNum].filters.length == 0) { - filterGroupList[addLabelNum].filters.push({ - name: '标签组0', - num: 0, - cameraIds: [] - }) - } - else { - filterGroupList[addLabelNum].filters.push({ - name: '标签组' + (filterGroupList[addLabelNum].filters[filterGroupList[addLabelNum].filters.length - 1].num + 1), - num: filterGroupList[addLabelNum].filters[filterGroupList[addLabelNum].filters.length - 1].num + 1, - cameraIds: [] - }) - } - sethasModify(true) - setFilterGroup(filterGroupList) - } - function labelDel (index) {//标签组删除 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - filterGroupList[addLabelNum].filters.splice(index, 1) - setFilterGroup(filterGroupList) - sethasModify(true) - } - function addFiltersCamera (val, index) {//标签组添加摄像头 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - filterGroupList[addLabelNum].filters[index].cameraIds = val - setFilterGroup(filterGroupList) - sethasModify(true) - } - function toEditLabel (val, index) {//标签组名称修改 - let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) - filterGroupList[addLabelNum].filters[index].name = val - setFilterGroup(filterGroupList) - sethasModify(true) - } - return ( -
-
-
-
+ } + } + setFilterGroup(myFilterGroupList) + setLabelCameraList(myAllCameraList) + setAddLabelNum(index) + setAddLabel(true) + } + function toAddScreen () {//添加筛选项 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + if (filterGroupList.length == 0) { + filterGroupList.push({ + name: '我的筛选项组0', + num: 0, + forbidden: true, + filters: [] + }) + } + else if (filterGroupList.length < 5) { + filterGroupList.push({ + name: '我的筛选项组' + (filterGroupList[filterGroupList.length - 1].num + 1), + num: filterGroupList[filterGroupList.length - 1].num + 1, + forbidden: true, + filters: [] + }) + } + sethasModify(true) + setFilterGroup(filterGroupList) + } + function toChangeScreen (num, name) {//筛选项去重 + let samenum = 0 + for (let i = 0; i < filterGroup.length; i++) { + if (filterGroup[i].name == name) { + samenum++ + } + } + if (samenum > 1) { + let opts = { + content: '筛选项名称不能重复,请修改', + duration: 3, + }; + Toast.error(opts) + setEditNum(num) + } + else { + setEditNum(1000) + } + } + function toChangeLabel (num, name, index) {//标签组去重 + let samenum = 0 + for (let i = 0; i < filterGroup[index].filters.length; i++) { + if (filterGroup[index].filters[i].name == name) { + samenum++ + } + } + if (samenum > 1) { + let opts = { + content: '标签组名称不能重复,请修改', + duration: 3, + }; + Toast.error(opts) + setLabelEditNum(num) + } + else { + setLabelEditNum(1000) + } + } + function switchOnChange (val, index) {//筛选项是否禁用 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + filterGroupList[index].forbidden = val + setFilterGroup(filterGroupList) + sethasModify(true) + } + function screenDel (index) {//筛选项删除 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + filterGroupList.splice(index, 1) + setFilterGroup(filterGroupList) + sethasModify(true) + } + function toEditscreen (val, index) {//编辑筛选项名称 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + filterGroupList[index].name = val + setFilterGroup(filterGroupList) + sethasModify(true) + } + function toAddLabel () {//添加标签组 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + if (filterGroupList[addLabelNum].filters.length == 0) { + filterGroupList[addLabelNum].filters.push({ + name: '标签组0', + num: 0, + cameraIds: [] + }) + } + else { + filterGroupList[addLabelNum].filters.push({ + name: '标签组' + (filterGroupList[addLabelNum].filters[filterGroupList[addLabelNum].filters.length - 1].num + 1), + num: filterGroupList[addLabelNum].filters[filterGroupList[addLabelNum].filters.length - 1].num + 1, + cameraIds: [] + }) + } + sethasModify(true) + setFilterGroup(filterGroupList) + } + function labelDel (index) {//标签组删除 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + filterGroupList[addLabelNum].filters.splice(index, 1) + setFilterGroup(filterGroupList) + sethasModify(true) + } + function addFiltersCamera (val, index) {//标签组添加摄像头 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + filterGroupList[addLabelNum].filters[index].cameraIds = val + setFilterGroup(filterGroupList) + sethasModify(true) + } + function toEditLabel (val, index) {//标签组名称修改 + let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) + filterGroupList[addLabelNum].filters[index].name = val + setFilterGroup(filterGroupList) + sethasModify(true) + } + return ( +
+
+
+
+ 设置 +
+ { + editHeaderName ? ( +
+ { setEditHeaderName(false) }} onChange={(value) => { setHeaderName(value); sethasModify(true) }} style={{ width: 200, color: 'rgba(255,255,255,0.9)', background: 'rgba(0,0,0,0.2)' }} maxLength={20} className='inputpadding'> +
+ ) : ( +
+ {headerName} +
+ ) + } +
+ 设置 +
+
+
+
{ setVideoPlay(!videoPlay) }}> + 设置 +
+
{ hasModify ? topublish(false) : '' }}> + 设置 +
+
{ topublish(true) }}> + 设置 +
+
+
+
+
+
+ {chooseList.map((item, index) => { + return ( +
tochange(index)} > + {item} +
+ ) + })} +
+ {/* 节点 */} +
+
+
设置 -
- { - editHeaderName ? ( -
- { setEditHeaderName(false) }} onChange={(value) => { setHeaderName(value); sethasModify(true) }} style={{ width: 200, color: 'rgba(255,255,255,0.9)', background: 'rgba(0,0,0,0.2)' }} maxLength={20} className='inputpadding'> -
- ) : ( -
- {headerName} -
- ) - } -
- 设置 +
+ 增加主要节点 +
+
+ +
+ {/* 添加视频 */} + {addCamera ? ( +
+
+
添加视频
+
{ setAddCamera(false); setAddCameraKey(''); setMykeyword('') }}> + 设置 +
+
+
+
+
摄像头名称
+
+ { setMykeyword(value) }} + placeholder="摄像头名称或DID" + showClear> + +
+
+ 设置 +
+
+
+
+ + 全选 + +
+
+ 完成 +
+
+
+
+ -
-
-
-
{ setVideoPlay(!videoPlay) }}> +
+
+ ) : ('')} + {/* 样式 */} +
+
+
header
+
{ setShowHeader(v); sethasModify(true) }} size="small" aria-label="是否有头部">
+
+
+
列表默认展开
+
+ { + setlistOpen(v) + sethasModify(true) + }} size="small" aria-label=""> +
+
+
{ setComingVisible(true) }}> +
自定义样式
+
设置 -
-
{ hasModify ? topublish(false) : '' }}> +
+
+
+ {/* 功能 */} +
+
+
+ 筛选项组 +
+
设置 -
-
{ topublish(true) }}> +
+
+
{ + setGroupChecked(true) + setAddScreen(false) + setAddLabel(false) + setTimeout(() => { + checksScrollbar = new PerfectScrollbar("#checkss", { + suppressScrollX: true, + }); + }, 200); + + }}> +
+ 分组勾选 +
+
设置 -
-
-
-
-
-
- {chooseList.map((item, index) => { - return ( -
tochange(index)} > - {item} -
- ) - })} -
- {/* 节点 */} -
-
-
- 设置 -
-
- 增加主要节点 -
-
- -
- {/* 添加视频 */} - {addCamera ? ( -
-
-
添加视频
-
{ setAddCamera(false); setAddCameraKey(''); setMykeyword('') }}> - 设置 -
-
-
-
-
摄像头名称
-
- { setMykeyword(value) }} - placeholder="摄像头名称或DID" - showClear> - -
-
- 设置 -
-
-
-
- - 全选 - -
-
- 完成 -
-
-
-
- -
-
- ) : ('')} - {/* 样式 */} -
-
-
header
-
{ setShowHeader(v); sethasModify(true) }} size="small" aria-label="是否有头部">
+
+
+
+ {addScreen ? ( +
+
+
+
筛选项组设置
+
+ {filterGroup.length}/5 +
-
-
列表默认展开
-
- { - setlistOpen(v) - sethasModify(true) - }} size="small" aria-label=""> -
+
{ setAddScreen(false); setAddLabel(false) }}> + 设置
-
{ setComingVisible(true) }}> -
自定义样式
-
- 设置 -
+
+
+
+ 设置
-
- {/* 功能 */} -
-
-
- 筛选项组 -
-
- 设置 -
+
+ 添加筛选项
-
- {addScreen ? ( -
-
-
-
筛选项组设置
-
- {filterGroup.length}/5 +
+
+ { + filterGroup.map((item, index) => { + return ( +
+
+
+ { + editNum == item.num ? ( + { toChangeScreen(item.num, item.name) }} onChange={(value) => { toEditscreen(value, index) }} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> + ) : (item.name) + } +
+
{ setEditNum(item.num) }}> + 设置 +
+ screenDel(index)}> +
+ 设置 +
+
+
{ addLabelGroup(index) }}> + 设置 +
-
-
{ setAddScreen(false); setAddLabel(false); }}> - 设置 -
-
-
-
- 设置 -
-
- 添加筛选项 -
-
-
- { - filterGroup.map((item, index) => { - return ( -
-
-
- { - editNum == item.num ? ( - { toChangeScreen(item.num, item.name) }} onChange={(value) => { toEditscreen(value, index) }} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> - ) : (item.name) - } -
-
{ setEditNum(item.num) }}> - 设置 -
- screenDel(index)}> -
- 设置 -
-
-
{ addLabelGroup(index) }}> - 设置 -
-
-
- switchOnChange(v, index)} size="small" aria-label="是否禁用"> -
-
- ) - })} -
+
+ switchOnChange(v, index)} size="small" aria-label="是否禁用"> +
+
+ ) + })} +
+
+ ) : ('')} + {groupChecked ? ( +
+
+
分组勾选设置
+
{ + setGroupChecked(false) + }}> + 设置
- ) : ('')} - {addLabel ? ( -
-
-
标签组设置
-
{ setAddLabel(false); }}> - 设置 -
-
-
-
- 设置 -
-
- 添加标签组 -
-
-
- { - filterGroup[addLabelNum].filters.map((item, index) => { - return ( -
-
-
- { - labelEditNum == item.num ? ( - { toChangeLabel(item.num, item.name, addLabelNum) }} onChange={(value) => { toEditLabel(value, index) }} style={{ width: 120 }} maxLength={6} className='inputpadding' size='small'> - ) : (item.name) - } -
-
{ setLabelEditNum(item.num) }}> - 设置 -
-
{ labelDel(index) }}> - 设置 -
-
-
- -
-
- ) +
+
+ { + sethasModify(true) + setTreeValue(e) + let cameraId = [] + treeData?.map(f => { + if (f.children?.length > 0) { //1 + f.children?.map(d => { + if (e.includes(d.value) && d.cameraId) { + cameraId.push(d.cameraId); + } else if (d.children?.length > 0) { //2 + d.children?.map(s => { + if (e.includes(s.value) && s.cameraId) { + cameraId.push(s.cameraId); + } else if (s.children?.length > 0) { + s.children?.map(g => { //3 + if (e.includes(g.value) && g.cameraId) { + cameraId.push(g.cameraId); + } + }) + } + }) + } }) - } + } + }) + setCheckResult(cameraId) + }} + onSelect={(e) => { + // console.log(e); + }} + style={{ color: '#FFFFFF' }} + /> -
+
+
+ ) : ('')} + {addLabel ? ( +
+
+
标签组设置
+
{ setAddLabel(false); }}> + 设置 +
+
+
+
+ 设置
- ) : ('') - } -
-
- -
+
+ 添加标签组 +
+
+
+ { + filterGroup[addLabelNum].filters.map((item, index) => { + return ( +
+
+
+ { + labelEditNum == item.num ? ( + { toChangeLabel(item.num, item.name, addLabelNum) }} onChange={(value) => { toEditLabel(value, index) }} style={{ width: 120 }} maxLength={6} className='inputpadding' size='small'> + ) : (item.name) + } +
+
{ setLabelEditNum(item.num) }}> + 设置 +
+
{ labelDel(index) }}> + 设置 +
+
+
+ +
+
+ ) + }) + } + +
+
+ ) : ('') + }
- { - setComingVisible(false) - }} - width={610} - onCancel={() => { - setComingVisible(false) - }} - okText="确定" - cancelText="取消" - closeOnEsc={true} - > - 开发中,敬请期待~ - - { - setBackVisible(false) - }} - // okText="确定" - // cancelText="取消" - closeOnEsc={true} - footer={ -
- - -
- } - > - 是否保存修改?~ -
-
- ) +
+ +
+
+ { + setComingVisible(false) + }} + width={610} + onCancel={() => { + setComingVisible(false) + }} + okText="确定" + cancelText="取消" + closeOnEsc={true} + > + 开发中,敬请期待~ + + { + setBackVisible(false) + }} + // okText="确定" + // cancelText="取消" + closeOnEsc={true} + footer={ +
+ + +
+ } + > + 是否保存修改?~ +
+
+ ) } function mapStateToProps (state) { - const { auth, global } = state; - return { - user: auth.user, - actions: global.actions, - }; + const { auth, global } = state; + return { + user: auth.user, + actions: global.actions, + }; } export default connect(mapStateToProps)(MirroringDetail);