Browse Source

去重

release_1.3.0
deartibers 3 years ago
parent
commit
1b10eba24f
  1. 124
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx

124
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<filterGroup[k].filters.length){
cantopublish=false
Toast.error({
content: '标签组名称不能重复,请修改',
duration: 3,
})
}
}
}
if(cantopublish){
let mirrordata = {
mirrorId: mirrorId,
template: template,
title: headerName,
showHeader: showHeader,
publish: publish,
tree: treeData,
filterGroup: filterGroup
}
dispatch(openness.putMirror(mirrordata)).then((res) => {
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) => {
<div style={{ marginLeft: 20, color: 'rgba(0,0,0,0.65)' }}>
{
editNum == item.num ? (
<Input value={item.name} onBlur={() => { setEditNum(1000) }} onChange={(value) => toEditscreen(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'></Input>
<Input value={item.name} onBlur={() => { toChangeScreen(item.num, item.name) }} onChange={(value) => toEditscreen(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'></Input>
) : (item.name)
}
</div>
@ -1068,7 +1140,7 @@ const MirroringDetail = (props) => {
<div style={{ color: 'rgba(0,0,0,0.65)' }}>
{
labelEditNum == item.num ? (
<Input value={item.name} onBlur={() => { setLabelEditNum(1000) }} onChange={(value) => toEditLabel(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'></Input>
<Input value={item.name} onBlur={() => { toChangeLabel(item.num, item.name, addLabelNum) }} onChange={(value) => toEditLabel(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'></Input>
) : (item.name)
}
</div>
@ -1121,6 +1193,7 @@ const MirroringDetail = (props) => {
width={610}
onCancel={() => {
setComingVisible(false)
history.goBack()
}}
okText="确定"
cancelText="取消"
@ -1131,17 +1204,28 @@ const MirroringDetail = (props) => {
<Modal
title="提醒"
visible={backVisible}
onOk={() => {
topublish(false)
setBackVisible(false)
}}
width={610}
onCancel={() => {
setBackVisible(false)
}}
okText="确定"
cancelText="取消"
// okText=""
// cancelText=""
closeOnEsc={true}
footer={
<div>
<Button type="primary" onClick={() => {
history.goBack()
}}>
取消
</Button>
<Button theme='solid' type="primary" onClick={() => {
topublish(false)
setBackVisible(false)
}}>
确定
</Button>
</div>
}
>
是否保存修改~
</Modal>

Loading…
Cancel
Save