Browse Source

萤石云摄像头和IPC摄像头的添加,摄像头删除

release_0.0.2
wenlele 3 years ago
parent
commit
205f8f177e
  1. 57
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js
  2. 12
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js
  3. 558
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
  4. 574
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx
  5. 484
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/ipcCamera.jsx
  6. 13
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx
  7. 39
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
  8. 14
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
  9. 49
      code/VideoAccess-VCMP/web/client/src/utils/webapi.js

57
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js

@ -24,11 +24,23 @@ export function putForbidden(data, forbidden) {
actionType: "PUT_FORBIDDEN", actionType: "PUT_FORBIDDEN",
data, data,
url: `${ApiTable.putForbidden}`, url: `${ApiTable.putForbidden}`,
msg: { option: forbidden ? "启用":"禁用" }, //禁用摄像头 msg: { option: forbidden ? "启用" : "禁用" }, //禁用摄像头
reducer: {}, reducer: {},
}); });
} }
export function delCamera(query) {
return (dispatch) =>
basicAction({
type: "del",
dispatch: dispatch,
actionType: "DEL_CAMERA",
query,
url: `${ApiTable.delCamera}`,
msg: { option: "删除摄像头" }, //删除摄像头
reducer: {},
});
}
export function getCameraDetails(orgId) { export function getCameraDetails(orgId) {
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({
@ -40,6 +52,19 @@ export function getCameraDetails(orgId) {
reducer: { name: "nvrDetails" }, reducer: { name: "nvrDetails" },
}); });
} }
export function getCameraKind() {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_CAMERA_KIND",
url: `${ApiTable.getCameraKind}`,
msg: { option: "" }, //获取摄像头种类列表
reducer: { name: "CameraKind" },
});
}
export function getAbility() { export function getAbility() {
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({
@ -47,7 +72,33 @@ export function getAbility() {
dispatch: dispatch, dispatch: dispatch,
actionType: "GET_ABILITY", actionType: "GET_ABILITY",
url: `${ApiTable.getAbility}`, url: `${ApiTable.getAbility}`,
msg: { option: "获取摄像头能力列表" }, msg: { option: "" }, //获取摄像头能力列表
reducer: { name: "equipmentWarehouseCamera" }, reducer: { name: "CameraAbility" },
});
}
export function postCameraYingshi(data) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data,
actionType: "POST_CAMERA_YINGSHI",
url: `${ApiTable.postCameraYingshi}`,
msg: { option: "" }, //创建萤石摄像头
reducer: { name: "" },
});
}
export function postCameraIpc(data) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data,
actionType: "POST_CAMERA_IPC",
url: `${ApiTable.postCameraIpc}`,
msg: { option: "" }, //创建IPC摄像头
reducer: { name: "" },
}); });
} }

12
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js

@ -77,3 +77,15 @@ export function getVender() {
reducer: { name: "vender" }, reducer: { name: "vender" },
}); });
} }
export function getExport() {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_EXPORT",
url: `${ApiTable.getExport}`,
msg: { option: "导出" }, //导出
reducer: { name: "" },
});
}

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

@ -1,244 +1,447 @@
import React, { useState ,useRef,useEffect} from 'react' import React, { useState, useRef, useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Modal,Spin } from '@douyinfe/semi-ui'; import { Modal, Spin } from "@douyinfe/semi-ui";
import { IconChevronLeft,IconChevronRight } from '@douyinfe/semi-icons'; import { IconChevronLeft, IconChevronRight } from "@douyinfe/semi-icons";
import FluoriteCamera from "./fluoriteCamera"; import FluoriteCamera from "./fluoriteCamera";
import NvrCamera from './nvrCamera'; import NvrCamera from "./nvrCamera";
import IpcCamera from './ipcCamera'; import IpcCamera from "./ipcCamera";
import CascadeCamera from './cascadeCamera'; import CascadeCamera from "./cascadeCamera";
import "./cameraModal.less"; import "./cameraModal.less";
function cameraModal(props){
const {modalName,visible,close}=props function cameraModal(props) {
const {
dispatch,
actions,
modalName,
visible,
close,
venderList,
CameraKind,
CameraAbility,
cameraData, //
} = props;
const { equipmentWarehouse } = actions;
const fluoriteRef = useRef(); const fluoriteRef = useRef();
const ipcRef = useRef(); const ipcRef = useRef();
const cascadeRef = useRef(); const cascadeRef = useRef();
const [isloading,setloading] = useState(false);//loading const [isloading, setloading] = useState(false); //loading
const [loadingTip,setloadingTip] = useState('获取中...请稍后...');//loading tip const [loadingTip, setloadingTip] = useState("获取中...请稍后..."); //loading tip
const [okText,setokText] = useState('确定')//oktext const [okText, setokText] = useState("确定"); //oktext
const [cancelText,setcancelText] = useState('取消')//text const [cancelText, setcancelText] = useState("取消"); //text
const [clickNum,setclickNum] = useState(1);// const [clickNum, setclickNum] = useState(
const cameraList=[// cameraData.type == "yingshi"
? 1
: cameraData.type == "ipc"
? 3
: cameraData.type == "nvr"
? 2
: cameraData.type == "cascade"
? 4
: 1
); //
useEffect(() => {
dispatch(equipmentWarehouse.getCameraKind());
dispatch(equipmentWarehouse.getAbility());
}, []);
const cameraList = [
//
{
id: 1,
img: "/assets/images/background/ysy.png",
title: "萤石云平台摄像头",
text: "通过萤石云平台rtmp地址配置完成推流的平台摄像头。",
},
{
id: 3,
img: "/assets/images/background/ipc.png",
title: "IPC网络摄像头",
text: "通过网络与监控设备直连完成视频流推送的摄像头设备",
},
{ {
id:1, id: 4,
img:'/assets/images/background/ysy.png', img: "/assets/images/background/cascade.png",
title:'萤石云平台摄像头', title: "级联摄像头",
text:'通过萤石云平台rtmp地址配置完成推流的平台摄像头。' text: "通过GB/T28181协议级联的平台摄像头,常用于平台对接推送",
},{
id:3,
img:'/assets/images/background/ipc.png',
title:'IPC网络摄像头',
text:'通过网络与监控设备直连完成视频流推送的摄像头设备'
},{
id:4,
img:'/assets/images/background/cascade.png',
title:'级联摄像头',
text:'通过GB/T28181协议级联的平台摄像头,常用于平台对接推送'
},{
id:2,
img:'/assets/images/background/nvr.png',
title:'NVR摄像头',
text:'通过连接NVR(网络硬盘录像机)进行视频流推送的摄像头'
}, },
] {
const [showcameraList,setcameraList]=useState(cameraList.slice(0,3));// id: 2,
function handleOk() {// img: "/assets/images/background/nvr.png",
if(clickNum==1){ title: "NVR摄像头",
console.log('1111111111111'); text: "通过连接NVR(网络硬盘录像机)进行视频流推送的摄像头",
}else if(clickNum==2){ },
console.log('22222222222222'); ];
}else if(clickNum==3){ const [showcameraList, setcameraList] = useState(cameraList.slice(0, 3)); //
console.log('33333333333333'); function handleOk() {
}else if(clickNum==4){ //
console.log('44444444444444'); if (clickNum == 1) {
//
fluoriteRef.current.fluoriteCameraForm().then((values) => {
values = JSON.parse(JSON.stringify(values));
values.longitude = values.position.split(",")[0];
values.latitude = values.position.split(",")[1];
delete values.position;
if (cameraData.id) {
values.id = cameraData.id;
} }
// close(); dispatch(equipmentWarehouse.postCameraYingshi(values)).then((res) => {
if (res.success) {
onReset();
} }
function handleAfterClose(){// });
});
} else if (clickNum == 2) {
console.log("22222222222222");
close();
} else if (clickNum == 3) {
//IPC
ipcRef.current.ipcCameraForm().then((values) => {
values = JSON.parse(JSON.stringify(values));
values.longitude = values.position.split(",")[0];
values.latitude = values.position.split(",")[1];
delete values.position;
if (cameraData.id) {
values.id = cameraData.id;
}
console.log(values);
dispatch(equipmentWarehouse.postCameraIpc(values)).then((res) => {
if (res.success) {
onReset();
} }
function handleCancel() {// });
});
} else if (clickNum == 4) {
console.log("44444444444444");
close(); close();
} }
function handleChoose(id){// }
function handleAfterClose() {
//
}
function handleCancel() {
onReset();
//
}
function handleChoose(id) {
//
setclickNum(id); setclickNum(id);
} }
function turnLift(){// function turnLift() {
setcameraList(cameraList.slice(0,3)) //
setcameraList(cameraList.slice(0, 3));
} }
function turnRight(){// function turnRight() {
setcameraList(cameraList.slice(1,4)) //
setcameraList(cameraList.slice(1, 4));
} }
function onReset(){ function onReset() {
if(clickNum==1){ if (clickNum == 1) {
fluoriteRef.current.resetFluoriteCamera(); fluoriteRef.current.resetFluoriteCamera();
fluoriteRef.current.toempty(); fluoriteRef.current.toempty();
}else if(clickNum==3){ close();
} else if (clickNum == 3) {
ipcRef.current.resetIpcCamera(); ipcRef.current.resetIpcCamera();
ipcRef.current.toempty(); ipcRef.current.toempty();
}else if(clickNum==4){ close();
} else if (clickNum == 4) {
close();
} }
close();
} }
function toTest(){ function toTest() {
if(clickNum==1){ if (clickNum == 1) {
fluoriteRef.current.fluoriteCameraForm().then(values=>{// fluoriteRef.current
console.log('111111111',values); .fluoriteCameraForm()
}) .then((values) => {
.catch(errors=>{// //
console.log('errors',errors); console.log("111111111", values);
})
}else if(clickNum==3){
ipcRef.current.ipcCameraForm().then(values=>{//
console.log('111111111',values);
}) })
.catch(errors=>{// .catch((errors) => {
console.log('errors',errors); //
console.log("errors", errors);
});
} else if (clickNum == 3) {
ipcRef.current
.ipcCameraForm()
.then((values) => {
//
console.log("111111111", values);
}) })
}else if(clickNum==4){ .catch((errors) => {
cascadeRef.current.cascadeCameraForm() //
.then(values=>{// console.log("errors", errors);
let chooseList=[] });
let nvrCameraList=[{ } else if (clickNum == 4) {
id:10, cascadeRef.current
name:'南昌县1', .cascadeCameraForm()
number:'111111111111111111', .then((values) => {
support:false, //
change:false, let chooseList = [];
},{ let nvrCameraList = [
id:20, {
name:'南昌县2', id: 10,
number:'222222222222222222', name: "南昌县1",
support:false, number: "111111111111111111",
change:false, support: false,
},{ change: false,
id:30, },
name:'南昌县3', {
number:'333333333333333333', id: 20,
support:false, name: "南昌县2",
change:false, number: "222222222222222222",
},{ support: false,
id:40, change: false,
name:'南昌县4', },
number:'444444444444444444', {
support:false, id: 30,
change:false, name: "南昌县3",
}] number: "333333333333333333",
cascadeRef.current.setNVRcameraList(nvrCameraList) 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++) { for (let index = 0; index < nvrCameraList.length; index++) {
chooseList.push(nvrCameraList[index].id) chooseList.push(nvrCameraList[index].id);
} }
cascadeRef.current.setNvrCheckList(chooseList) cascadeRef.current.setNvrCheckList(chooseList);
cascadeRef.current.setIsAllChoose(true) cascadeRef.current.setIsAllChoose(true);
})
.catch(errors=>{//
console.log('errors',errors);
}) })
.catch((errors) => {
//
console.log("errors", errors);
});
} }
} }
return ( return (
<> <>
<Modal <Modal
title={modalName=='add'?'添加摄像头':'修改摄像头'} title={modalName == "add" ? "添加摄像头" : "修改摄像头"}
okText={okText} okText={okText}
cancelText={cancelText} // cancelText={cancelText} //
visible={visible} visible={visible}
onOk={handleOk} onOk={handleOk}
width={921} width={966}
afterClose={handleAfterClose} afterClose={handleAfterClose}
onCancel={handleCancel} onCancel={handleCancel}
> >
<Spin tip={loadingTip} spinning={isloading}> <Spin tip={loadingTip} spinning={isloading}>
<div style={{marginLeft:'-24px',marginRight:'-24px',marginTop:8}}> <div
<div style={{marginLeft:29,color:'#1859C1',fontSize:14,fontWeight:500}}>接入类型</div> style={{ marginLeft: "-24px", marginRight: "-24px", marginTop: 8 }}
<div style={{marginTop:5,display:'flex',alignItems:'center',justifyContent:'space-between'}}> >
<div
style={{
marginLeft: 29,
color: "#1859C1",
fontSize: 14,
fontWeight: 500,
}}
>
接入类型
</div>
<div
style={{
marginTop: 5,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
}}
>
<IconChevronLeft <IconChevronLeft
style={{color:'rgba(0, 0, 0, 0.45)',fontSize:16,marginLeft:29,cursor: "pointer",}} style={{
onClick={turnLift}/> color: "rgba(0, 0, 0, 0.45)",
fontSize: 16,
marginLeft: 29,
cursor: "pointer",
}}
onClick={turnLift}
/>
<div <div
style={{display:'flex',alignItems:'center',height:146}}> style={{ display: "flex", alignItems: "center", height: 146 }}
{showcameraList.map((item,index)=>( >
{showcameraList.map((item, index) => (
<div <div
key={item.id} key={item.id}
style={{ style={{
width:266, width: 266,
height:146, height: 146,
marginRight:12, marginRight: 12,
border:clickNum===item.id?'1px solid #1859C1':'1px solid #F9F9F9', border:
borderRadius:3, clickNum === item.id
display: 'flex', ? "1px solid #1859C1"
flexDirection: 'column', : "1px solid #F9F9F9",
alignItems: 'center', borderRadius: 3,
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer", cursor: "pointer",
position: 'relative'}} position: "relative",
onClick={()=>handleChoose(item.id)}> }}
onClick={() => handleChoose(item.id)}
>
<div
style={{
marginTop: 5,
height: 65,
width: 116,
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<img src={item.img} alt="设置" />
</div>
<div
style={{
marginTop: 2,
fontSize: 14,
color: "rgba(0, 0, 0, 0.85)",
}}
>
{item.title}
</div>
<div
style={{
width: 210,
height: 34,
marginTop: 9,
fontSize: 12,
color: "rgba(0, 0, 0, 0.45)",
textAlign: "center",
}}
>
{item.text}
</div>
{clickNum === item.id ? (
<div <div
style={{marginTop:5, style={{
height:65, position: "absolute",
width:116, top: "-3px",
display: 'flex', right: "-5px",
justifyContent: 'center', }}
alignItems: 'center'}}> >
<img <img
src={item.img} src="/assets/images/background/topchoose.png"
alt="设置" alt="1"
/> />
</div> </div>
<div style={{marginTop:2,fontSize:14,color:'rgba(0, 0, 0, 0.85)',}}>{item.title}</div> ) : (
<div style={{width:210,height:34,marginTop:9,fontSize:12,color:'rgba(0, 0, 0, 0.45)',textAlign:'center'}}>{item.text}</div> ""
{clickNum===item.id?<div style={{ position: 'absolute', top: '-3px', right: '-5px'}}> )}
<img src="/assets/images/background/topchoose.png" alt="1" />
</div>:''}
</div> </div>
))} ))}
</div> </div>
<IconChevronRight <IconChevronRight
style={{color:'rgba(0, 0, 0, 0.45)',fontSize:16,marginRight:18,cursor: "pointer",}} style={{
onClick={turnRight}/> color: "rgba(0, 0, 0, 0.45)",
fontSize: 16,
marginRight: 18,
cursor: "pointer",
}}
onClick={turnRight}
/>
</div> </div>
</div> </div>
<div style={{height:30,marginLeft:'-24px',marginRight:'-24px',marginTop:48,display:'flex',alignItems: 'center',justifyContent: 'space-between'}}> <div
<div style={{marginLeft:29,color:'#1859C1',fontSize:14,fontWeight:500}}>配置属性</div> style={{
{clickNum!==2?<div style={{display:'flex',marginRight:43,}}> height: 30,
<div style={{ marginLeft: "-24px",
height:30, marginRight: "-24px",
width:64, marginTop: 48,
border:'1px solid #D9D9D9', display: "flex",
borderRadius: '3px', alignItems: "center",
color:'rgba(0, 0, 0, 0.65)', justifyContent: "space-between",
display:'flex', }}
justifyContent: 'center', >
alignItems: 'center', <div
style={{
marginLeft: 29,
color: "#1859C1",
fontSize: 14,
fontWeight: 500,
}}
>
配置属性
</div>
{clickNum !== 2 ? (
<div style={{ display: "flex", marginRight: 43 }}>
<div
style={{
height: 30,
width: 64,
border: "1px solid #D9D9D9",
borderRadius: "3px",
color: "rgba(0, 0, 0, 0.65)",
display: "flex",
justifyContent: "center",
alignItems: "center",
cursor: "pointer", cursor: "pointer",
marginRight:16 marginRight: 16,
}} onClick={onReset}> }}
<img src="/assets/images/background/Reset.png" alt="1" style={{marginRight:4}}/> onClick={onReset}
>
<img
src="/assets/images/background/Reset.png"
alt="1"
style={{ marginRight: 4 }}
/>
重置 重置
</div> </div>
<div style={{ <div
height:30, style={{
width:64, height: 30,
border:'1px solid #1859C1', width: 64,
borderRadius: '3px', border: "1px solid #1859C1",
color:'#1859C1', borderRadius: "3px",
display:'flex', color: "#1859C1",
justifyContent: 'center', display: "flex",
alignItems: 'center', justifyContent: "center",
alignItems: "center",
cursor: "pointer", cursor: "pointer",
}} onClick={toTest}> }}
<img src="/assets/images/background/test.png" alt="1" style={{marginRight:4}} /> onClick={toTest}
>
<img
src="/assets/images/background/test.png"
alt="1"
style={{ marginRight: 4 }}
/>
测试 测试
</div> </div>
</div>:''} </div>
) : (
""
)}
</div> </div>
<div> <div>
{clickNum==1? {clickNum == 1 ? (
<FluoriteCamera cRef={fluoriteRef}/> <FluoriteCamera
:clickNum==2? cRef={fluoriteRef}
<NvrCamera/> CameraKind={CameraKind}
:clickNum==3? CameraAbility={CameraAbility}
<IpcCamera aRef={ipcRef} /> cameraData={cameraData}
:<CascadeCamera dRef={cascadeRef}/>} />
) : clickNum == 2 ? (
<NvrCamera />
) : clickNum == 3 ? (
<IpcCamera
aRef={ipcRef}
CameraKind={CameraKind}
CameraAbility={CameraAbility}
venderList={venderList}
cameraData={cameraData}
/>
) : (
<CascadeCamera dRef={cascadeRef} />
)}
</div> </div>
</Spin> </Spin>
</Modal> </Modal>
@ -246,12 +449,13 @@ function cameraModal(props){
); );
} }
function mapStateToProps(state) { function mapStateToProps(state) {
const { auth, global, members } = state; const { auth, global, members, CameraKind, CameraAbility } = state;
return { return {
loading: members.isRequesting, loading: members.isRequesting,
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
members: members.data, CameraKind: CameraKind.data || [],
CameraAbility: CameraAbility.data || [],
}; };
} }

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

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

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

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

13
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx

@ -1,17 +1,6 @@
import { Table } from "@douyinfe/semi-ui"; import { Table } from "@douyinfe/semi-ui";
export function skeletonScreen(line, columns) { export function skeletonScreen(line, columns) {
// function TableHead() {
// let str = [];
// for (let i = 0; i <= column; i++) {
// if(i==column-2){
// }else{
// str.push(<div>ngfbn</div>)
// }
// }
// return str;
// }
const data = () => { const data = () => {
let str = []; let str = [];
for (let i = 0; i < line; i++) { for (let i = 0; i < line; i++) {
@ -52,7 +41,7 @@ export function skeletonScreen(line, columns) {
style={{ style={{
width: 50, width: 50,
height: 14, height: 14,
background: "red", background: "rgba(217, 216, 216, 0.3)",
}} }}
></div> ></div>
), ),

39
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx

@ -13,7 +13,7 @@ import {
Skeleton, Skeleton,
Popconfirm, Popconfirm,
} from "@douyinfe/semi-ui"; } from "@douyinfe/semi-ui";
import { SimpleFileDownButton } from '$components' import { SimpleFileDownButton } from "$components";
import "../style.less"; import "../style.less";
import CameraModal from "../components/cameraModal"; import CameraModal from "../components/cameraModal";
import NvrModal from "../components/nvrModal"; import NvrModal from "../components/nvrModal";
@ -34,14 +34,13 @@ const CameraHeader = (props) => {
const [query, setQuery] = useState({ limit: 10, page: 0 }); // const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); // const [search, setearch] = useState({}); //
const [rowId, setRowId] = useState(); //id const [rowId, setRowId] = useState(); //id
const [load, setLoad] = useState(); // const [cameraData, setCameraData] = useState({}); //id
const { equipmentWarehouse } = actions; const { equipmentWarehouse } = actions;
const api = useRef(); const api = useRef();
const CAMERAS = "cameras"; const CAMERAS = "cameras";
useEffect(() => { useEffect(() => {
setLoad(loading);
dispatch(actions.equipmentWarehouse.getVender()).then((res) => { dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data); setvenderList(res.payload.data);
attribute(res.payload.data); attribute(res.payload.data);
@ -60,7 +59,7 @@ const CameraHeader = (props) => {
equipmentGetCamera(); equipmentGetCamera();
}, [query, search]); }, [query, search]);
function equipmentGetCamera () { function equipmentGetCamera() {
dispatch(equipmentWarehouse.getCamera({ ...query, ...search })); dispatch(equipmentWarehouse.getCamera({ ...query, ...search }));
} }
@ -98,17 +97,17 @@ const CameraHeader = (props) => {
width: "20%", width: "20%",
dataIndex: "", dataIndex: "",
render: (_, row) => { render: (_, row) => {
console.log(row);
return ( return (
<div style={{ display: "flex" }}> <div style={{ display: "flex" }}>
<Button theme="borderless"> <Button
<NvrModal theme="borderless"
nvrData={row} onClick={() => {
modalName="revise" setCameraModal(true);
venderList={venderList} setCameraData(row);
close={() => {
equipmentGetCamera();
}} }}
/> >
修改
</Button> </Button>
<Button <Button
theme="borderless" theme="borderless"
@ -116,7 +115,6 @@ const CameraHeader = (props) => {
setSideSheet(true); setSideSheet(true);
setcameraSetup(true); setcameraSetup(true);
setRowId(row.id); setRowId(row.id);
console.log(row.id);
}} }}
> >
查看 查看
@ -170,7 +168,9 @@ const CameraHeader = (props) => {
showArrow={true} showArrow={true}
position="topRight" position="topRight"
onConfirm={() => { onConfirm={() => {
dispatch(equipmentWarehouse.delNvr(row.id)).then(() => { dispatch(
equipmentWarehouse.delCamera({ cameraId: row.id })
).then(() => {
equipmentGetCamera(); equipmentGetCamera();
}); });
}} }}
@ -184,7 +184,7 @@ const CameraHeader = (props) => {
]; ];
// //
function attribute (data) { function attribute(data) {
const arr = localStorage.getItem(CAMERAS) const arr = localStorage.getItem(CAMERAS)
? JSON.parse(localStorage.getItem(CAMERAS)) ? JSON.parse(localStorage.getItem(CAMERAS))
: []; : [];
@ -313,7 +313,7 @@ const CameraHeader = (props) => {
} }
//station //station
function station (first, whole, name) { function station(first, whole, name) {
return ( return (
<Popover <Popover
key="updateTime" key="updateTime"
@ -674,9 +674,12 @@ const CameraHeader = (props) => {
{cameraModal ? ( {cameraModal ? (
<CameraModal <CameraModal
visible={true} visible={true}
venderList={venderList}
cameraData={cameraData}
close={() => { close={() => {
setCameraModal(false); setCameraModal(false);
// setEditData(null) setCameraData({});
equipmentGetCamera();
}} }}
modalName={modalName} modalName={modalName}
/> />
@ -687,7 +690,7 @@ const CameraHeader = (props) => {
); );
}; };
function mapStateToProps (state) { function mapStateToProps(state) {
const { auth, global, members, equipmentWarehouseCamera } = state; const { auth, global, members, equipmentWarehouseCamera } = state;
return { return {
loading: loading:

14
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

@ -14,11 +14,11 @@ import {
Tag, Tag,
} from "@douyinfe/semi-ui"; } from "@douyinfe/semi-ui";
import "../style.less"; import "../style.less";
import { ApiTable } from "$utils";
import NvrModal from "../components/nvrModal"; import NvrModal from "../components/nvrModal";
import Setup from "../components/setup"; import Setup from "../components/setup";
import SideSheets from "../components/sideSheet"; import SideSheets from "../components/sideSheet";
import {skeletonScreen} from "../components/skeletonScreen"; import { skeletonScreen } from "../components/skeletonScreen";
export const accessType = [ export const accessType = [
{ name: "萤石云平台摄像头", key: "yingshi" }, { name: "萤石云平台摄像头", key: "yingshi" },
@ -40,7 +40,6 @@ const NvrHeader = (props) => {
const [rowId, setRowId] = useState(); //id const [rowId, setRowId] = useState(); //id
const [load, setLoad] = useState(); // const [load, setLoad] = useState(); //
const api = useRef(); const api = useRef();
const SETUPS = "setups"; const SETUPS = "setups";
@ -514,6 +513,7 @@ const NvrHeader = (props) => {
style={{ width: 18, height: 18 }} style={{ width: 18, height: 18 }}
/> />
</Button> </Button>
<a href={`/_api/${ApiTable.getExport}`}>
<Button <Button
style={{ style={{
width: 65, width: 65,
@ -525,12 +525,10 @@ const NvrHeader = (props) => {
> >
导出 导出
</Button> </Button>
</a>
</div> </div>
</div> </div>
<Skeleton <Skeleton loading={loading} placeholder={skeletonScreen(8, setupp.length)}>
loading={load}
placeholder={skeletonScreen(8, setupp.length)}
>
<Table <Table
columns={setupp.filter((s) => s)} columns={setupp.filter((s) => s)}
dataSource={equipmentWarehouseNvr.data} dataSource={equipmentWarehouseNvr.data}
@ -598,7 +596,7 @@ const NvrHeader = (props) => {
function mapStateToProps(state) { function mapStateToProps(state) {
const { auth, global, members, equipmentWarehouseNvr } = state; const { auth, global, members, equipmentWarehouseNvr } = state;
return { return {
loading: equipmentWarehouseNvr.isRequesting, loading: equipmentWarehouseNvr.isRequesting && !equipmentWarehouseNvr.data,
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
members: members.data, members: members.data,

49
code/VideoAccess-VCMP/web/client/src/utils/webapi.js

@ -1,30 +1,33 @@
'use strict'; "use strict";
import { ProxyRequest } from '@peace/utils' import { ProxyRequest } from "@peace/utils";
export const AuthRequest = new ProxyRequest('_auth') export const AuthRequest = new ProxyRequest("_auth");
export const ApiTable = { export const ApiTable = {
login: 'login', login: "login",
logout: 'logout', logout: "logout",
getEnterprisesMembers: 'enterprises/{enterpriseId}/members', getEnterprisesMembers: "enterprises/{enterpriseId}/members",
getNvr:'nvr', getNvr: "nvr",
getVender:'vender', getVender: "vender",
nvr:'nvr', nvr: "nvr",
delNvr:'nvr/{nvrId}', delNvr: "nvr/{nvrId}",
getNvrDetails:'nvr/detail/{nvrId}', //获取nvr详情 getNvrDetails: "nvr/detail/{nvrId}", //获取nvr详情
getExport: "camera/export", //nvr表格数据导出
getCamera:"camera/project", // 获取摄像头列表
putForbidden:"camera/banned", //禁用摄像头 getCamera: "camera/project", // 获取摄像头列表
getCameraDetails:"camera/{cameraId}/detail", //获取摄像头详情 putForbidden: "camera/banned", //禁用摄像头
getAbility:"/camera/ability"//获取摄像头能力列表 delCamera:"camera", //删除摄像头
getCameraDetails: "camera/{cameraId}/detail", //获取摄像头详情
getCameraKind: "camera/kind", //获取摄像头种类列表
getAbility: "/camera/ability", //获取摄像头能力列表
postCameraYingshi: "camera/create/yingshi", //创建萤石摄像头
postCameraIpc: "camera/create/ipc", //创建IPC摄像头
}; };
export const RouteTable = { export const RouteTable = {
apiRoot: '/api/root', apiRoot: "/api/root",
fileUpload: '/_upload/new', fileUpload: "/_upload/new",
cleanUpUploadTrash: '/_upload/cleanup', cleanUpUploadTrash: "/_upload/cleanup",
}; };
Loading…
Cancel
Save