Browse Source

nvr摄像头视频流bug解决

release_0.0.2
wenlele 2 years ago
parent
commit
ab2e4dc81a
  1. 31
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
  2. 35
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx

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

@ -17,30 +17,24 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
useEffect(() => {
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => {
setSip(res.payload.data);
setSip(res.payload.data);
if (cameraData) {
let sip=res.payload.data.find((item)=>item.streamid==cameraData.topSerialNo)
let sip = res.payload.data.find((item) => item.streamid == cameraData.topSerialNo)
dispatch(equipmentWarehouse.getCascadeStream({ sip: sip.sipip })).then((res) => {
console.log(res.payload.data);
let oneData = res.payload.data[0];
let modifyData = res.payload.data.find(
(item) => item.id == cameraData.gbId
);
console.log(modifyData)
let data = res.payload.data.map((item, index) => {
if (item.camera) {
item.name = item.camera.name;
}
if (item.id == cameraData.gbId) {
item = oneData;
}
if (index == 0) {
item = modifyData;
}
if (
item.camera&&item.camera.name == cameraData.name
) {
item = oneData;
}
return item;
})
setCascadeList(data)
@ -69,7 +63,9 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
console.log(res.payload.data);
let chooseList = [];
let data = res.payload.data.map((item, index) => {
item.change = false;
if (item.camera) {
item.name = item.camera.name;
}
return item;
})
setCascadeList(data)
@ -119,9 +115,10 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
function NvrChangeName (e, index, id) {
//
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
if (!cameraData||cameraData.gbId==id) {
NvrchangeList[index].change = true;
setCascadeList(NvrchangeList);
console.log(!cameraData.gbId)
if (!cameraData.gbId || cameraData.gbId == id) {
NvrchangeList[index].change = true;
setCascadeList(NvrchangeList);
}
e.stopPropagation();
}
@ -158,7 +155,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
e.stopPropagation();
}
function onDisabled (id) {
if (id==cameraData.gbId) {
if (id == cameraData.gbId||!cameraData.gbId) {
return false;
} else {
return true;
@ -246,7 +243,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
<Radio
checked={isAllChoose}
mode="advanced"
disabled={cameraData ? true : false}
disabled={cameraData.gbId ? true : false}
onChange={(e) => allChoose(e)}
aria-label="全选"
>

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

@ -15,6 +15,7 @@ import { IconEdit, IconPlayCircle, IconTickCircle } from "@douyinfe/semi-icons";
import "./cameraModal.less";
import PerfectScrollbar from "perfect-scrollbar";
import { isIndexed } from "immutable";
import { useId } from "react";
let equipmentScrollbar;
function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }) {
@ -52,24 +53,18 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
streamId: cameraDataNvr.serialNo,
})
).then((res) => {
console.log(res)
let oneData = res.payload.data[0];
let modifyData = res.payload.data.find(
(item) => item.camera == null ? false : item.camera.name == cameraData.name
);
(item) =>item.id == cameraData.gbId);
let data = res.payload.data.map((item, index) => {
if (index == 0) {
item = modifyData;
if (item.camera) {
item.name = item.camera.name;
}
if (
item.camera
? item.camera.name == cameraData.name && index > 0
: index < 0
) {
if (item.id == cameraData.gbId) {
item = oneData;
}
if (item.camera) {
item.name = item.camera.name;
if (index == 0) {
item = modifyData;
}
return item;
});
@ -121,10 +116,10 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
}
}, []);
function NvrChangeName (e, index, name) {
function NvrChangeName (e, index, id) {
//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
if (!cameraDataNvr || cameraData.name == name) {
if (!cameraData.gbId || cameraData.gbId == id) {
NvrchangeList[index].change = true;
setNVRcameraList(NvrchangeList);
}
@ -209,8 +204,8 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
console.log("22222222222222222");
e.stopPropagation();
}
function onDisabled (name) {
if ((cameraDataNvr && cameraData.name == name) || !cameraDataNvr) {
function onDisabled (id) {
if (cameraData.gbId == id || !cameraData.gbId) {
return false;
} else {
return true;
@ -269,7 +264,7 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
<Radio
checked={isAllChoose}
mode="advanced"
disabled={cameraDataNvr ? true : false}
disabled={cameraData.gbId ? true : false}
onChange={(e) => allChoose(e)}
aria-label="全选"
>
@ -314,7 +309,7 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
>
<Checkbox
value={item.id}
disabled={onDisabled(item.name)}
disabled={onDisabled(item.id)}
extra={
<div>
<div
@ -354,7 +349,7 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
color: "#1859C1",
}}
onClick={(e) =>
NvrChangeName(e, index, item.name)
NvrChangeName(e, index, item.id)
}
/>
</div>
@ -378,7 +373,7 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
<Radio
checked={item.support}
mode="advanced"
disabled={onDisabled(item.name)}
disabled={onDisabled(item.id)}
onChange={(e) => toggle(e, index)}
aria-label="单选"
>

Loading…
Cancel
Save