Browse Source

级联视频流 80%

release_0.0.2
wenlele 3 years ago
parent
commit
d255cb4ef6
  1. 30
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js
  2. 15
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
  3. 218
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
  4. 5
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx
  5. 8
      code/VideoAccess-VCMP/web/client/src/utils/webapi.js

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

@ -162,37 +162,49 @@ export function getParentCamera(query) {
}); });
} }
export function getVerifyYingshi(data) { export function postVerifyYingshi(data) {
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({
type: "post", type: "post",
dispatch: dispatch, dispatch: dispatch,
data, data,
actionType: "POST_VERIFY_YINGSHI", actionType: "POST_VERIFY_YINGSHI",
url: `${ApiTable.getVerifyYingshi}`, url: `${ApiTable.postVerifyYingshi}`,
msg: { option: "" }, //获取级联摄像头父级设备 msg: { option: "" }, ///验证萤石摄像头信息
}); });
} }
export function getVerifyIpc(data) { export function postVerifyIpc(data) {
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({
type: "post", type: "post",
dispatch: dispatch, dispatch: dispatch,
data, data,
actionType: "POST_VERIFY_IPC", actionType: "POST_VERIFY_IPC",
url: `${ApiTable.getVerifyIpc}`, url: `${ApiTable.postVerifyIpc}`,
msg: { option: "" }, //获取级联摄像头父级设备 msg: { option: "" }, //验证IPC摄像头信息
}); });
} }
export function getVerifyCascade(data) { export function postVerifyCascade(data) {
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({
type: "post", type: "post",
dispatch: dispatch, dispatch: dispatch,
data, data,
actionType: "POST_VERIFY_CASCADE", actionType: "POST_VERIFY_CASCADE",
url: `${ApiTable.getVerifyCascade}`, url: `${ApiTable.postVerifyCascade}`,
msg: { option: "" }, //获取级联摄像头父级设备 msg: { option: "" }, //验证级联摄像头信息
});
}
export function getCascadeStream(query) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
query,
actionType: "GET_CASCADE_STREAM",
url: `${ApiTable.getCascadeStream}`,
msg: { option: "" }, //获取级联视频流
}); });
} }

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

@ -35,7 +35,7 @@ function cameraModal (props) {
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 testComplete = useRef(false) //
const [clickNum, setclickNum] = useState( const [clickNum, setclickNum] = useState(
cameraData.type == "yingshi" cameraData.type == "yingshi"
? 1 ? 1
@ -200,6 +200,7 @@ function cameraModal (props) {
close(); close();
} else if (clickNum == 4) { } else if (clickNum == 4) {
cascadeRef.current.resetCascadeCamera(); cascadeRef.current.resetCascadeCamera();
testComplete.current = false
close(); close();
} else { } else {
nvrRef.current.resetFluoriteCamera(); nvrRef.current.resetFluoriteCamera();
@ -231,7 +232,7 @@ function cameraModal (props) {
var front = new moment(); // var front = new moment(); //
setloading(true); setloading(true);
dispatch( dispatch(
equipmentWarehouse.getVerifyYingshi({ equipmentWarehouse.postVerifyYingshi({
serialNo: values.serialNo, serialNo: values.serialNo,
}) })
).then((res) => { ).then((res) => {
@ -269,7 +270,7 @@ function cameraModal (props) {
var front = new moment(); // var front = new moment(); //
setloading(true); setloading(true);
dispatch( dispatch(
equipmentWarehouse.getVerifyIpc({ equipmentWarehouse.postVerifyIpc({
serialNo: values.serialNo, serialNo: values.serialNo,
}) })
).then((res) => { ).then((res) => {
@ -306,7 +307,7 @@ function cameraModal (props) {
var front = new moment(); // var front = new moment(); //
setloading(true); setloading(true);
dispatch( dispatch(
equipmentWarehouse.getVerifyCascade({ equipmentWarehouse.postVerifyCascade({
sip: values.sip, sip: values.sip,
}) })
).then((res) => { ).then((res) => {
@ -315,9 +316,11 @@ function cameraModal (props) {
if (res.success) { if (res.success) {
setTimeout(() => { setTimeout(() => {
setloadingTip("测试完成"); setloadingTip("测试完成");
testComplete.current = true
setTimeout(() => { setTimeout(() => {
setloading(false); setloading(false);
setloadingTip("测试中..."); setloadingTip("测试中...");
}, 800); }, 800);
}, duration > 2000 ? 0 : 2000 - duration) }, duration > 2000 ? 0 : 2000 - duration)
} else { } else {
@ -405,7 +408,7 @@ function cameraModal (props) {
}} }}
onClick={() => handleChoose(item.id)} onClick={() => handleChoose(item.id)}
> >
{modify || addNvr ||axyData? item.id == clickNum ? "" : <div style={{ {modify || addNvr || axyData ? item.id == clickNum ? "" : <div style={{
width: 266, width: 266,
height: 146, height: 146,
borderRadius: 3, borderRadius: 3,
@ -575,7 +578,7 @@ function cameraModal (props) {
</Spin> </Spin>
) : ( ) : (
<Spin tip={loadingTip} spinning={isloading}> <Spin tip={loadingTip} spinning={isloading}>
<CascadeCamera dRef={cascadeRef} cameraData={cameraData} parentCamera={parentCamera} /> <CascadeCamera dRef={cascadeRef} cameraData={cameraData} parentCamera={parentCamera} testComplete={testComplete.current} />
</Spin> </Spin>
)} )}
</div> </div>

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

@ -1,20 +1,60 @@
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, Checkbox, Radio, CheckboxGroup, } from "@douyinfe/semi-ui";
import { IconEdit, IconPlayCircle, } from "@douyinfe/semi-icons";
import "./cameraModal.less"; import "./cameraModal.less";
function cascadeCamera ({ dRef, dispatch, actions, cameraData ,parentCamera}) { import PerfectScrollbar from "perfect-scrollbar";
let equipmentScrollbar;
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete }) {
const form = useRef(); const form = useRef();
const { equipmentWarehouse } = actions; const { equipmentWarehouse } = actions;
const [sip, setSip] = useState([]); const [sip, setSip] = useState([]);
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr
const [nvrCheckList, setNvrCheckList] = useState([]); //nvr
const [isAllChoose, setIsAllChoose] = useState(false); //
const cameraDataNvr = cameraData.nvr || "";
useEffect(() => { useEffect(() => {
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => { dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => {
setSip(res.payload.data); setSip(res.payload.data);
}); });
const videoStreaming = document.getElementById("video_streaming");
if (videoStreaming && equipmentScrollbar) {
equipmentScrollbar.update();
}
}, []); }, []);
useEffect(() => {
NVRcameraList
? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
suppressScrollX: true,
}))
: "";
}, [NVRcameraList]);
useEffect(() => {
//
console.log(testComplete)
if (testComplete) {
dispatch(equipmentWarehouse.getCascadeStream({ sip: "111" })).then((res) => {
console.log(res.payload.data);
let chooseList = [];
let data = res.payload.data.map((item, index) => {
item.change = false;
return item;
})
setNVRcameraList(data)
for (let index = 0; index < data.length; index++) {
chooseList.push(data[index].id);
}
setNvrCheckList(chooseList);
setIsAllChoose(true);
});
}
}, [testComplete])
// //
const memoryList = [ const memoryList = [
{ {
@ -47,6 +87,54 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData ,parentCamera}) {
}, },
]; ];
function NvrChangeName (e, index, name) {
//
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
if (cameraData.name == name) {
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 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();
}
function onDisabled (name) {
if ((cameraDataNvr && cameraData.name == name) || !cameraDataNvr) {
return false;
} else {
return true;
}
}
useImperativeHandle(dRef, () => ({ useImperativeHandle(dRef, () => ({
// //
// //
@ -108,6 +196,128 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData ,parentCamera}) {
</Form.Select> </Form.Select>
</Col> </Col>
</Row> </Row>
<Row>
<div
id="video_streaming"
style={{ maxHeight: 300, position: "relative" }}
>
{NVRcameraList.length > 0 ? (
<div
style={{ display: "flex", alignItems: "center", marginLeft: 211 }}
>
<Radio
checked={isAllChoose}
mode="advanced"
disabled={true}
onChange={(e) => allChoose(e)}
aria-label="全选"
>
全选
</Radio>
</div>
) : (
""
)}
<CheckboxGroup
type="pureCard"
direction="vertical"
aria-label="视频流获取"
value={nvrCheckList}
onChange={(nvrCheck) => {
setNvrCheckList(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}
disabled={onDisabled(item.name)}
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)}
onClick={(e) => e.stopPropagation()}
></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, item.name)
}
/>
</div>
</div>
<div style={{ marginTop: 8, width: 246 }}>
设备编号{item.streamid}
</div>
<div
style={{
marginTop: 12,
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<IconPlayCircle
size="extra-large"
style={{ color: "#1859C1" }}
onClick={(e) => playVideo(e)}
/>
</div>
</div>
}
style={{ width: 280, border: "1px solid #F9F9F9" }}
></Checkbox>
</Col>
))
: ""}
</CheckboxGroup>
</div>
</Row>
</Form> </Form>
</> </>
); );

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

@ -129,8 +129,8 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
if (!cameraDataNvr || cameraData.name == name) { if (!cameraDataNvr || cameraData.name == name) {
NvrchangeList[index].change = true; NvrchangeList[index].change = true;
setNVRcameraList(NvrchangeList); setNVRcameraList(NvrchangeList);
e.stopPropagation();
} }
e.stopPropagation();
} }
function nvronBlur (index) { function nvronBlur (index) {
//nvr //nvr
@ -189,7 +189,7 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
}) })
.catch((errors) => { .catch((errors) => {
// //
console.log("errors", errors); // console.log("errors", errors);
}); });
} }
function allChoose (e) { function allChoose (e) {
@ -336,6 +336,7 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
value={item.name} value={item.name}
onChange={(e) => inputchange(e, index)} onChange={(e) => inputchange(e, index)}
onBlur={() => nvronBlur(index)} onBlur={() => nvronBlur(index)}
onClick={(e) => e.stopPropagation()}
></Input> ></Input>
) : ( ) : (
item.name item.name

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

@ -31,9 +31,11 @@ export const ApiTable = {
getCascadeSIP: "camera/sip_list/cascade", //获取级联摄像头sip列表 getCascadeSIP: "camera/sip_list/cascade", //获取级联摄像头sip列表
postAddCascade: "camera/create/cascade", //添加级联摄像头 postAddCascade: "camera/create/cascade", //添加级联摄像头
getParentCamera:"camera/cascade_device", //获取级联摄像头父级设备 getParentCamera:"camera/cascade_device", //获取级联摄像头父级设备
getVerifyYingshi:"camera/verify/yingshi", //验证萤石摄像头信息 postVerifyYingshi:"camera/verify/yingshi", //验证萤石摄像头信息
getVerifyIpc:"camera/verify/ipc", //验证IPC摄像头信息 postVerifyIpc:"camera/verify/ipc", //验证IPC摄像头信息
getVerifyCascade:"camera/verify/cascade", //验证级联摄像头信息 postVerifyCascade:"camera/verify/cascade", //验证级联摄像头信息
getCascadeStream:"/camera/cascade_stream", //获取级联视频流
}; };

Loading…
Cancel
Save