From 1b10eba24f4f98d2d1f09c807e9faf1dfb953bda Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Mon, 29 Aug 2022 14:40:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openness/containers/mirroringDetail.jsx | 124 +++++++++++++++--- 1 file changed, 104 insertions(+), 20 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 9912178..3f400e3 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,8 +1,9 @@ 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 } 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'; const MirroringDetail = (props) => { @@ -183,18 +184,51 @@ const MirroringDetail = (props) => { setCheckall(checkedList.length === showCameraList.length); } function topublish (publish) {//编辑镜像信息 - let mirrordata = { - mirrorId: mirrorId, - template: template, - title: headerName, - showHeader: showHeader, - publish: publish, - tree: treeData, - filterGroup: filterGroup + 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 { + history.goBack() + }) } - dispatch(openness.putMirror(mirrordata)).then((res) => { - history.goBack() - }) } function nodeDelete (item) {//删除树状子节点 let mainData = JSON.parse(JSON.stringify(treeData)) @@ -723,6 +757,44 @@ const MirroringDetail = (props) => { 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 @@ -1000,7 +1072,7 @@ const MirroringDetail = (props) => {
{ editNum == item.num ? ( - { setEditNum(1000) }} onChange={(value) => toEditscreen(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> + { toChangeScreen(item.num, item.name) }} onChange={(value) => toEditscreen(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> ) : (item.name) }
@@ -1068,7 +1140,7 @@ const MirroringDetail = (props) => {
{ labelEditNum == item.num ? ( - { setLabelEditNum(1000) }} onChange={(value) => toEditLabel(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> + { toChangeLabel(item.num, item.name, addLabelNum) }} onChange={(value) => toEditLabel(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> ) : (item.name) }
@@ -1121,6 +1193,7 @@ const MirroringDetail = (props) => { width={610} onCancel={() => { setComingVisible(false) + history.goBack() }} okText="确定" cancelText="取消" @@ -1131,17 +1204,28 @@ const MirroringDetail = (props) => { { - topublish(false) - setBackVisible(false) - }} width={610} onCancel={() => { setBackVisible(false) }} - okText="确定" - cancelText="取消" + // okText="确定" + // cancelText="取消" closeOnEsc={true} + footer={ +
+ + +
+ } > 是否保存修改?~