Browse Source

Merge branch 'dev_trial' of https://gitea.free-sun.vip/free-sun/FS-IOT into dev_trial

pull/3/head
yuan_yi 2 years ago
parent
commit
1efb405f19
  1. 292
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
  2. 3
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.less
  3. 192
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
  4. 262
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx
  5. 224
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/ipcCamera.jsx
  6. 182
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx

292
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx

@ -1,20 +1,21 @@
import React, { useState ,useRef} from 'react'
import React, { useState ,useRef,useEffect} from 'react'
import { connect } from "react-redux";
import { Modal,Form,Row,Col,Spin,Notification,Button } from '@douyinfe/semi-ui';
import { Modal,Spin } from '@douyinfe/semi-ui';
import { IconChevronLeft,IconChevronRight } from '@douyinfe/semi-icons';
import FluoriteCamera from "./fluoriteCamera";
import NvrCamera from './nvrCamera';
import IpcCamera from './ipcCamera';
import CascadeCamera from './cascadeCamera';
import "./cameraModal.less";
function cameraModal(props){
const { TextArea } = Form;
const {modalName,visible,close}=props
const form = useRef();
// const [visible, setVisible] = useState(false);//
const fluoriteRef = useRef();
const ipcRef = useRef();
const cascadeRef = useRef();
const [isloading,setloading] = useState(false);//loading
const [loadingTip,setloadingTip] = useState('获取中...请稍后...');//loading tip
const [step,setstep] = useState(0)//
const [okText,setokText] = useState('确定')//oktext
const [cancelText,setcancelText] = useState('取消')//text
const [cloud,setcloud] = useState('')//
const [voice,setvoice] = useState('')//
const opts ={//
title:'Hi',
content:'添加成功',
@ -44,67 +45,103 @@ function cameraModal(props){
text:'通过GB/T28181协议级联的平台摄像头,常用于平台对接推送'
},
]
const [showcameraList,setcameraList]=useState(cameraList.slice(0,3));
const [showcameraList,setcameraList]=useState(cameraList.slice(0,3));//
function handleOk() {//
if(step==0){
form.current.validate()
.then(values=>{//
setloading(true);
setTimeout(() => {
setloadingTip('...接受成功')
setTimeout(()=>{
setloadingTip('已完成')
setTimeout(() => {
setstep(1);
setokText('确认');
setcancelText('上一步');
setloading(false);
}, 2000);
}, 2000)
}, 2000);
})
.catch(errors=>{//
console.log('errors',errors);
})
}
else{
Notification.success(opts)
// setVisible(false);
close();
if(clickNum==1){
console.log('1111111111111');
}else if(clickNum==2){
console.log('22222222222222');
}else if(clickNum==3){
console.log('33333333333333');
}else if(clickNum==4){
console.log('44444444444444');
}
// Notification.success(opts)
// close();
}
function handleAfterClose(){//
setstep(0);
setokText('测试校验');
setcancelText('取消');
}
function handleCancel() {//
if(step==0){
// setVisible(false);
close();
}
else{
setstep(0);
setokText('测试校验');
setcancelText('取消');
}
}
function handleLocation(){//
window.open('https://lbs.amap.com/tools/picker','_blank')
close();
}
function handleChoose(id){//
setclickNum(id);
}
function turnLift(){
function turnLift(){//
setcameraList(cameraList.slice(0,3))
}
function turnRight(){
function turnRight(){//
setcameraList(cameraList.slice(1,4))
}
function onReset(){
if(clickNum==1){
fluoriteRef.current.resetFluoriteCamera()
}else if(clickNum==3){
ipcRef.current.resetIpcCamera()
}else if(clickNum==4){
}
}
function toTest(){
if(clickNum==1){
fluoriteRef.current.fluoriteCameraForm().then(values=>{//
console.log('111111111',values);
})
.catch(errors=>{//
console.log('errors',errors);
})
}else if(clickNum==3){
ipcRef.current.ipcCameraForm().then(values=>{//
console.log('111111111',values);
})
.catch(errors=>{//
console.log('errors',errors);
})
}else if(clickNum==4){
cascadeRef.current.cascadeCameraForm()
.then(values=>{//
let chooseList=[]
let nvrCameraList=[{
id:10,
name:'南昌县1',
number:'111111111111111111',
support:false,
change:false,
},{
id:20,
name:'南昌县2',
number:'222222222222222222',
support:false,
change:false,
},{
id:30,
name:'南昌县3',
number:'333333333333333333',
support:false,
change:false,
},{
id:40,
name:'南昌县4',
number:'444444444444444444',
support:false,
change:false,
}]
cascadeRef.current.setNVRcameraList(nvrCameraList)
for (let index = 0; index < nvrCameraList.length; index++) {
chooseList.push(nvrCameraList[index].id)
}
cascadeRef.current.setNvrCheckList(chooseList)
cascadeRef.current.setIsAllChoose(true)
})
.catch(errors=>{//
console.log('errors',errors);
})
}
}
return (
<>
{/* <div onClick={showDialog}>{modalName=='add'?'添加NVR':'修改'}</div> */}
<Modal
title={modalName=='add'?'添加摄像头':'修改摄像头'}
okText={okText}
@ -164,9 +201,9 @@ function cameraModal(props){
onClick={turnRight}/>
</div>
</div>
<div style={{marginLeft:'-24px',marginRight:'-24px',marginTop:48,display:'flex',alignItems: 'center',justifyContent: 'space-between'}}>
<div style={{height:30,marginLeft:'-24px',marginRight:'-24px',marginTop:48,display:'flex',alignItems: 'center',justifyContent: 'space-between'}}>
<div style={{marginLeft:29,color:'#1859C1',fontSize:14,fontWeight:500}}>配置属性</div>
<div style={{display:'flex',marginRight:43,}}>
{clickNum!==2?<div style={{display:'flex',marginRight:43,}}>
<div style={{
height:30,
width:64,
@ -178,7 +215,7 @@ function cameraModal(props){
alignItems: 'center',
cursor: "pointer",
marginRight:16
}}>
}} onClick={onReset}>
<img src="/assets/images/background/Reset.png" alt="1" style={{marginRight:4}}/>
重置
</div>
@ -192,145 +229,20 @@ function cameraModal(props){
justifyContent: 'center',
alignItems: 'center',
cursor: "pointer",
}}>
}} onClick={toTest}>
<img src="/assets/images/background/test.png" alt="1" style={{marginRight:4}} />
测试
</div>
</div>
</div>:''}
</div>
<div>
<Form
labelPosition='left'
labelAlign='left'
labelWidth= '115px'
onValueChange={values=>console.log(values)}
getFormApi={formApi => form.current = formApi}>
<Row>
<Col span={12}>
<Form.Input field='UserName' label='设备名称:' initValue={''} placeholder='请输入设备名称、常用项目或位置定义' style={{ width:307 }}
rules={[
{ required: true, message: '请输入设备名称' }
]}/>
</Col>
<Col span={12}>
<Form.RadioGroup
label="云台支持:"
field='role'
type='pureCard'
direction='horizontal'
style={{padding:0}}
rules={[
{ required: true, message: '请选择云台支持' }
]}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setcloud('yes')
}
else{
setcloud('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='cloud' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{cloud=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='cloud' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{cloud=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
</Col>
<Col span={12}>
<Form.Input field='Use11rName11' label='设备厂家:' placeholder='请选择设备厂家' style={{ width:307 }}/>
</Col>
<Col span={12}>
<div style={{display:'flex'}}>
<Form.Select label="内存:" field='business2' placeholder='未安装' style={{ width:92 }}>
<Form.Select.Option value="abc">Semi</Form.Select.Option>
<Form.Select.Option value="ulikeCam">轻颜相机</Form.Select.Option>
<Form.Select.Option value="toutiao">今日头条</Form.Select.Option>
</Form.Select>
<div style={{marginLeft:18}}>
<Form.RadioGroup
labelWidth= '76px'
label="语音支持:"
field='role2'
type='pureCard'
direction='horizontal'
style={{padding:0}}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setvoice('yes')
}
else{
setvoice('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='voice' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{voice=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='voice' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{voice=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
</div>
</div>
</Col>
<Col span={12}>
<div style={{display:'flex'}}>
<Form.Input field='Use11rName1312' label='安装位置:' placeholder='请输入或拾取高德经纬度坐标' style={{ width:270 }}
rules={[
{ required: true, message: '请输入或拾取高德经纬度坐标' }
]}/>
<div style={{
width:32,
height:32,
background:"#1859C1",
marginLeft:4,
display:'flex',
justifyContent: 'center',
alignItems: 'center',
cursor: "pointer",
marginTop:12,
borderRadius: 3+'px'}}
onClick={handleLocation}>
<img src="../../../assets/images/background/location.png" width={16} height={20}/>
</div>
</div>
<div>
<Form.Input field='UserName11' label='设备编号接入:' initValue={''} placeholder='请输入设备编号' style={{ width:307 }}/>
</div>
</Col>
<Col span={12}>
<TextArea
style={{ width:320, height: 90 }}
field='description'
label='RTMP地址接入:'
placeholder='请输入RTMP地址接入'
/>
</Col>
</Row>
</Form>
{clickNum==1?
<FluoriteCamera cRef={fluoriteRef}/>
:clickNum==2?
<NvrCamera/>
:clickNum==3?
<IpcCamera aRef={ipcRef} />
:<CascadeCamera dRef={cascadeRef}/>}
</div>
</Spin>
</Modal>

3
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.less

@ -3,4 +3,7 @@
}
.semi-radio-cardRadioGroup_checked .voice{
color: #1859C1;
}
.semi-radio-cardRadioGroup_checked .switching{
color: #1859C1;
}

192
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx

@ -0,0 +1,192 @@
import React, { useState ,useRef,useEffect,useImperativeHandle} from 'react'
import { connect } from "react-redux";
import { Form,Row,Col,CheckboxGroup, Checkbox,Radio,Input } from '@douyinfe/semi-ui';
import { IconEdit,IconPlayCircle } from '@douyinfe/semi-icons';
import "./cameraModal.less";
function cascadeCamera({dRef}){
const form = useRef();
const [memoryList,setMemoryList] = useState([
{
id:1,
value:'8g'
},{
id:2,
value:'16g'
},{
id:3,
value:'32g'
},{
id:4,
value:'64g'
},{
id:5,
value:'128g'
},{
id:6,
value:'256g'
},{
id:7,
value:'>256g'
}
])//
const [nvrCheckList, setNvrCheckList] = useState([]);//nvr
const [NVRcameraList,setNVRcameraList]=useState([])//nvr
const [isAllChoose,setIsAllChoose]=useState(false)//
const [equipmentNum,setEquipmentNum]=useState('')//nvr
function NvrChangeName(e,index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].change=true
setNVRcameraList(NvrchangeList)
e.stopPropagation()
}
function nvronBlur(index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].change=false
setNVRcameraList(NvrchangeList)
}
function inputchange(e,index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].name=e
setNVRcameraList(NvrchangeList)
}
function toggle(e,index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].support=e.target.checked
setNVRcameraList(NvrchangeList)
e.stopPropagation()
}
function allChoose(e){///
let chooseList=[]
if(NVRcameraList.length==nvrCheckList.length){
setNvrCheckList([])
setIsAllChoose(false)
}
else{
for (let index = 0; index < NVRcameraList.length; index++) {
chooseList.push(NVRcameraList[index].id)
}
setNvrCheckList(chooseList)
setIsAllChoose(true)
}
}
function playVideo(e) {//nvr
console.log('22222222222222222');
e.stopPropagation()
}
useImperativeHandle(dRef,() => ({//
//
cascadeCameraForm : form.current.validate,
resetCascadeCamera : form.current.reset,
setNVRcameraList : setNVRcameraList,
setNvrCheckList : setNvrCheckList,
setIsAllChoose : setIsAllChoose,
}))
return (
<>
<Form
allowEmpty
labelPosition='left'
labelAlign='left'
labelWidth= '115px'
onValueChange={values=>{console.log(values);setEquipmentNum(values.equipmentNum)}}
getFormApi={formApi => form.current = formApi}>
<Row>
<Col span={12}>
<Form.Input field='foreignDomainName' label='外域名称:' initValue={''} placeholder='请输入外域名称' style={{ width:307 }}
rules={[
{ required: true, message: '请输入外域名称' }
]}/>
</Col>
<Col span={12}>
<Form.Select label="级联方式:" field='cascadeMode' placeholder='请选择级联方式' style={{ width:307 }}
rules={[
{ required: true, message: '请选择输入级联方式' }
]}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
</Col>
<Col span={12}>
<Form.Select label="SIP编号:" field='sipNum' placeholder='请选择SIP编号' style={{ width:307 }}
rules={[
{ required: true, message: '请选择SIP编号' }
]}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
</Col>
<Col span={24}>
{NVRcameraList.length>0?<div style={{display: 'flex',alignItems: 'center',justifyContent: 'flex-end',marginRight:19}}>
<Radio
checked={isAllChoose}
mode="advanced"
onChange={e=>allChoose(e)}
aria-label="全选">
全选
</Radio>
</div>:''}
</Col>
</Row>
<Row>
<CheckboxGroup type='pureCard' direction='vertical' aria-label="视频流获取"
value={nvrCheckList}
onChange={(nvrCheck) => {
setNvrCheckList(nvrCheck);
console.log('11111111111',nvrCheck);
if(NVRcameraList.length==nvrCheck.length){
setIsAllChoose(true)
}
else{
setIsAllChoose(false)
}
}}>
{NVRcameraList.length>0?NVRcameraList.map((item,index)=>(
<Col key={index} span={12} style={{display:'flex',justifyContent:'center',marginTop:12}}>
<Checkbox value={item.id}
extra={
<div>
<div style={{display:'flex',alignItems:'center',justifyContent:'space-between',height:30}}>
<div>通道名称{item.change?<Input autofocus style={{width:100}} value={item.name} onChange={e=>inputchange(e,index)} onBlur={()=>nvronBlur(index)}></Input>:item.name}</div>
<div style={{display:'flex',alignItems:'center'}}>
<IconEdit
style={{fontSize:16,marginLeft:18,cursor: "pointer",color:'#1859C1'}}
onClick={e=>NvrChangeName(e,index)}/>
</div>
</div>
<div style={{marginTop:8,width:246}}>设备编号{item.number}</div>
<div style={{marginTop:12,display:'flex',justifyContent:'space-between',alignItems:'center'}}>
<IconPlayCircle size='extra-large' style={{color:'#1859C1',}} onClick={e=>playVideo(e)}/>
<Radio
checked={item.support}
mode="advanced"
onChange={e=>toggle(e,index)}
aria-label="单选"
>
云台支持
</Radio>
</div>
</div>
}
style={{width:280,border:'1px solid #F9F9F9',}}>
</Checkbox>
</Col>
)):''}
</CheckboxGroup>
</Row>
</Form>
</>
);
}
function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data,
};
}
export default connect(mapStateToProps)(cascadeCamera);

262
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx

@ -0,0 +1,262 @@
import React, { useState ,useRef,useEffect,useImperativeHandle} from 'react'
import { connect } from "react-redux";
import { Form,Row,Col} from '@douyinfe/semi-ui';
import "./cameraModal.less";
function fluoriteCamera({cRef}){
const { TextArea } = Form;
const form = useRef();
const [cloud,setcloud] = useState('')//
const [voice,setvoice] = useState('')//
const [switching,setSwitching] = useState('')//
const [memoryList,setMemoryList] = useState([
{
id:1,
value:'8g'
},{
id:2,
value:'16g'
},{
id:3,
value:'32g'
},{
id:4,
value:'64g'
},{
id:5,
value:'128g'
},{
id:6,
value:'256g'
},{
id:7,
value:'>256g'
}
])//
function handleLocation(){//
window.open('https://lbs.amap.com/tools/picker','_blank')
}
function positionForm(val){//
let zz = /^(-?\d+)(\.\d+)?$/
if(!val){
return '请输入或拾取高德经纬度坐标'
}
else if(val.split(',').length!=2){
return '请输入格式为116.354169,39.835452的经纬度坐标'
}
else if(!zz.test(val.split(',')[0])){
return '只能填写数字'
}
else if(!zz.test(val.split(',')[1])){
return '只能填写数字'
}
else{
return ''
}
}
useImperativeHandle(cRef,() => ({//
//
fluoriteCameraForm : form.current.validate,
resetFluoriteCamera : form.current.reset
}))
return (
<>
<Form
labelPosition='left'
labelAlign='left'
labelWidth= '115px'
onValueChange={values=>console.log(values)}
getFormApi={formApi => form.current = formApi}>
<Row>
<Col span={12}>
{/* 设备名称 */}
<Form.Input field='UserName' label='设备名称:' initValue={''} placeholder='请输入设备名称、常用项目或位置定义' style={{ width:307 }}
rules={[
{ required: true, message: '请输入设备名称' }
]}/>
{/* 高清切换 */}
<Form.RadioGroup
label="高清切换:"
field='hdSwitching'
type='pureCard'
direction='horizontal'
style={{padding:0,paddingTop:1,paddingBottom:1}}
rules={[
{ required: true, message: '请选择高清切换' }
]}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setSwitching('yes')
}
else{
setSwitching('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='switching' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{switching=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='switching' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{switching=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
{/* 安装位置 */}
<div style={{display:'flex'}}>
<Form.Input field='Use11rName1312' label='安装位置:' placeholder='请输入或拾取高德经纬度坐标' style={{ width:270 }}
validate={positionForm}
rules={[
{ required: true, message: '请输入或拾取高德经纬度坐标' }
]}/>
<div style={{
width:32,
height:32,
background:"#1859C1",
marginLeft:4,
display:'flex',
justifyContent: 'center',
alignItems: 'center',
cursor: "pointer",
marginTop:12,
borderRadius: 3+'px'}}
onClick={handleLocation}>
<img src="../../../assets/images/background/location.png" width={16} height={20}/>
</div>
</div>
{/* 设备类型 */}
<div style={{display:'flex',}}>
<div>
<Form.Select label="设备类型:" field='business23' placeholder='请选择摄像头类型' style={{ width:160 }}
rules={[
{ required: true, message: '请选择摄像头类型' }
]}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
</div>
<div style={{marginLeft:7}}>
<Form.Select noLabel='true' field='business244' placeholder='请选择能力' style={{ width:140 }}
rules={[
{ required: true, message: '请选择能力' }
]}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
</div>
</div>
</Col>
<Col span={12}>
{/* 云台支持 */}
<Form.RadioGroup
label="云台支持:"
field='role'
type='pureCard'
direction='horizontal'
style={{padding:0,paddingTop:1,paddingBottom:1}}
rules={[
{ required: true, message: '请选择云台支持' }
]}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setcloud('yes')
}
else{
setcloud('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='cloud' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{cloud=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='cloud' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{cloud=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
{/* 内存 */}
<div style={{display:'flex'}}>
<Form.Select label="内存:" field='business2' placeholder='未安装' style={{ width:92 }}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
{/* 语音支持 */}
<div style={{marginLeft:18}}>
<Form.RadioGroup
labelWidth= '76px'
label="语音支持:"
field='role2'
type='pureCard'
direction='horizontal'
style={{padding:0,paddingTop:1,paddingBottom:1}}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setvoice('yes')
}
else{
setvoice('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='voice' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{voice=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='voice' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{voice=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
</div>
</div>
{/* RTMP地址接入 */}
<TextArea
style={{ width:320, height: 90 }}
field='description'
label='RTMP地址接入:'
placeholder='请输入RTMP地址接入'
/>
</Col>
</Row>
</Form>
</>
);
}
function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data,
};
}
export default connect(mapStateToProps)(fluoriteCamera);

224
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/ipcCamera.jsx

@ -0,0 +1,224 @@
import React, { useState ,useRef,useEffect,useImperativeHandle} from 'react'
import { connect } from "react-redux";
import { Form,Row,Col } from '@douyinfe/semi-ui';
import "./cameraModal.less";
function ipcCamera({aRef}){
const { TextArea } = Form;
const form = useRef();
const [cloud,setcloud] = useState('')//
const [voice,setvoice] = useState('')//
const [memoryList,setMemoryList] = useState([
{
id:1,
value:'8g'
},{
id:2,
value:'16g'
},{
id:3,
value:'32g'
},{
id:4,
value:'64g'
},{
id:5,
value:'128g'
},{
id:6,
value:'256g'
},{
id:7,
value:'>256g'
}
])//
function handleLocation(){//
window.open('https://lbs.amap.com/tools/picker','_blank')
}
function positionForm(val){//
let zz = /^(-?\d+)(\.\d+)?$/
if(!val){
return '请输入或拾取高德经纬度坐标'
}
else if(val.split(',').length!=2){
return '请输入格式为116.354169,39.835452的经纬度坐标'
}
else if(!zz.test(val.split(',')[0])){
return '只能填写数字'
}
else if(!zz.test(val.split(',')[1])){
return '只能填写数字'
}
else{
return ''
}
}
useImperativeHandle(aRef,() => ({//
//
ipcCameraForm : form.current.validate,
resetIpcCamera : form.current.reset
}))
return (
<>
<Form
labelPosition='left'
labelAlign='left'
labelWidth= '115px'
onValueChange={values=>console.log(values)}
getFormApi={formApi => form.current = formApi}>
<Row>
<Col span={12}>
<Form.Input field='UserName' label='设备名称:' initValue={''} placeholder='请输入设备名称、常用项目或位置定义' style={{ width:307 }}
rules={[
{ required: true, message: '请输入设备名称' }
]}/>
<Form.Input field='Use11rName11' label='设备厂家:' placeholder='请选择设备厂家' style={{ width:307 }}/>
<div style={{display:'flex'}}>
<Form.Input field='Use11rName1312' label='安装位置:' placeholder='请输入或拾取高德经纬度坐标' style={{ width:270 }}
validate={positionForm}
rules={[
{ required: true, message: '请输入或拾取高德经纬度坐标' }
]}/>
<div style={{
width:32,
height:32,
background:"#1859C1",
marginLeft:4,
display:'flex',
justifyContent: 'center',
alignItems: 'center',
cursor: "pointer",
marginTop:12,
borderRadius: 3+'px'}}
onClick={handleLocation}>
<img src="../../../assets/images/background/location.png" width={16} height={20}/>
</div>
</div>
<div>
<Form.Input field='UserName11' label='设备编号接入:' initValue={''} placeholder='请输入设备编号' style={{ width:307 }}/>
</div>
</Col>
<Col span={12}>
<Form.RadioGroup
label="云台支持:"
field='role'
type='pureCard'
direction='horizontal'
style={{padding:0,paddingTop:1,paddingBottom:1}}
rules={[
{ required: true, message: '请选择云台支持' }
]}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setcloud('yes')
}
else{
setcloud('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='cloud' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{cloud=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='cloud' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{cloud=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
<div style={{display:'flex'}}>
<Form.Select label="内存:" field='business2' placeholder='未安装' style={{ width:92 }}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
<div style={{marginLeft:18}}>
<Form.RadioGroup
labelWidth= '76px'
label="语音支持:"
field='role2'
type='pureCard'
direction='horizontal'
style={{padding:0}}
onChange={(checked) => {
console.log(checked.target.value);
if(checked.target.value=='yes'){
setvoice('yes')
}
else{
setvoice('no')
}
}}>
<Form.Radio value="yes" style={{width:58,height:30,padding:0,margin:0,background:'#F9F9F9'}}>
<div className='voice' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
支持
</div>
{voice=='yes'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
<Form.Radio value="no" style={{width:58,height:30,padding:0,margin:0,marginLeft:18,background:'#F9F9F9'}}>
<div className='voice' style={{width:58,height:30,textAlign:'center',lineHeight:'30px'}}>
不支持
</div>
{voice=='no'?<div style={{position: 'absolute', top: '-2px', right: '-1px'}}>
<img src="/assets/images/background/formchoose.png" alt="1" />
</div>:''}
</Form.Radio>
</Form.RadioGroup>
</div>
</div>
<TextArea
style={{ width:320, height: 90 }}
field='description'
label='RTMP地址接入:'
placeholder='请输入RTMP地址接入'
/>
</Col>
<Col span={18}>
<div style={{display:'flex',}}>
<div>
<Form.Select label="设备类型:" field='business23' placeholder='请选择摄像头类型' style={{ width:160 }}
rules={[
{ required: true, message: '请选择摄像头类型' }
]}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
</div>
<div style={{marginLeft:7}}>
<Form.Select noLabel='true' field='business244' placeholder='请选择能力' style={{ width:140 }}
rules={[
{ required: true, message: '请选择能力' }
]}>
{memoryList.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.value}</Form.Select.Option>
))}
</Form.Select>
</div>
</div>
</Col>
</Row>
</Form>
</>
);
}
function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data,
};
}
export default connect(mapStateToProps)(ipcCamera);

182
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx

@ -0,0 +1,182 @@
import React, { useState ,useRef,useEffect,useImperativeHandle} from 'react'
import { connect } from "react-redux";
import { Form,Row,Col,Button,CheckboxGroup, Checkbox,Radio,Input } from '@douyinfe/semi-ui';
import { IconEdit,IconPlayCircle } from '@douyinfe/semi-icons';
import "./cameraModal.less";
function nvrCamera({cRef}){
const form = useRef();
const [nvrCheckList, setNvrCheckList] = useState([]);//nvr
const [NVRcameraList,setNVRcameraList]=useState([])//nvr
const [isAllChoose,setIsAllChoose]=useState(false)//
const [equipmentNum,setEquipmentNum]=useState('')//nvr
function NvrChangeName(e,index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].change=true
setNVRcameraList(NvrchangeList)
e.stopPropagation()
}
function nvronBlur(index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].change=false
setNVRcameraList(NvrchangeList)
}
function inputchange(e,index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].name=e
setNVRcameraList(NvrchangeList)
}
function toggle(e,index){//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList))
NvrchangeList[index].support=e.target.checked
setNVRcameraList(NvrchangeList)
e.stopPropagation()
}
function getVideoList(){
form.current.validate().then(values=>{//
let chooseList=[]
let nvrCameraList=[{
id:10,
name:'南昌县1',
number:'111111111111111111',
support:false,
change:false,
},{
id:20,
name:'南昌县2',
number:'222222222222222222',
support:false,
change:false,
},{
id:30,
name:'南昌县3',
number:'333333333333333333',
support:false,
change:false,
},{
id:40,
name:'南昌县4',
number:'444444444444444444',
support:false,
change:false,
}]
setNVRcameraList(nvrCameraList)
for (let index = 0; index < nvrCameraList.length; index++) {
chooseList.push(nvrCameraList[index].id)
}
setNvrCheckList(chooseList)
setIsAllChoose(true)
})
.catch(errors=>{//
console.log('errors',errors);
})
}
function allChoose(e){///
let chooseList=[]
if(NVRcameraList.length==nvrCheckList.length){
setNvrCheckList([])
setIsAllChoose(false)
}
else{
for (let index = 0; index < NVRcameraList.length; index++) {
chooseList.push(NVRcameraList[index].id)
}
setNvrCheckList(chooseList)
setIsAllChoose(true)
}
}
function playVideo(e) {//nvr
console.log('22222222222222222');
e.stopPropagation()
}
// useImperativeHandle(cRef,() => ({//
// //aa
// getDate : form.current.validate,
// // resetFluoriteCamera : form.current.reset
// }))
return (
<>
<Form
allowEmpty
labelPosition='left'
labelAlign='left'
labelWidth= '115px'
onValueChange={values=>{setEquipmentNum(values.equipmentNum)}}
getFormApi={formApi => form.current = formApi}>
<div style={{display:'flex'}}>
<Form.Input field='equipmentNum' maxLength='39' label='设备编号:' initValue={''} placeholder='请输入设备编号' style={{ width:307 }}
rules={[
{ required: true, message: '请输入设备编号' },
{ pattern: '^[A-Za-z0-9]+$', message: '只能输入数字或者字母' }
]}/>
<Button disabled={!equipmentNum.length>0} theme='solid' type='primary' onClick={()=>{getVideoList()}} style={{ marginLeft: 8,marginTop:12 }}>视频流获取</Button>
{NVRcameraList.length>0?<div style={{display: 'flex',alignItems: 'center',marginLeft: 211}}>
<Radio
checked={isAllChoose}
mode="advanced"
onChange={e=>allChoose(e)}
aria-label="全选">
全选
</Radio>
</div>:''}
</div>
<Row>
<CheckboxGroup type='pureCard' direction='vertical' aria-label="视频流获取"
value={nvrCheckList}
onChange={(nvrCheck) => {
setNvrCheckList(nvrCheck);
// console.log('11111111111',nvrCheck);
if(NVRcameraList.length==nvrCheck.length){
setIsAllChoose(true)
}
else{
setIsAllChoose(false)
}
}}>
{NVRcameraList.length>0?NVRcameraList.map((item,index)=>(
<Col key={index} span={12} style={{display:'flex',justifyContent:'center',marginTop:12}}>
<Checkbox value={item.id}
extra={
<div>
<div style={{display:'flex',alignItems:'center',justifyContent:'space-between',height:30}}>
<div>通道名称{item.change?<Input autofocus style={{width:100}} value={item.name} onChange={e=>inputchange(e,index)} onBlur={()=>nvronBlur(index)}></Input>:item.name}</div>
<div style={{display:'flex',alignItems:'center'}}>
<IconEdit
style={{fontSize:16,marginLeft:18,cursor: "pointer",color:'#1859C1'}}
onClick={e=>NvrChangeName(e,index)}/>
</div>
</div>
<div style={{marginTop:8,width:246}}>设备编号{item.number}</div>
<div style={{marginTop:12,display:'flex',justifyContent:'space-between',alignItems:'center'}}>
<IconPlayCircle size='extra-large' style={{color:'#1859C1',}} onClick={e=>playVideo(e)}/>
<Radio
checked={item.support}
mode="advanced"
onChange={e=>toggle(e,index)}
aria-label="单选"
>
云台支持
</Radio>
</div>
</div>
}
style={{width:280,border:'1px solid #F9F9F9',}}>
</Checkbox>
</Col>
)):''}
</CheckboxGroup>
</Row>
</Form>
</>
);
}
function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data,
};
}
export default connect(mapStateToProps)(nvrCamera);
Loading…
Cancel
Save