Browse Source

NVR跳转传参功能完成,NVR摄像头获取视频流时交互样式

release_0.0.2
wenlele 3 years ago
parent
commit
2d9f850a9f
  1. 21
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
  2. 729
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx
  3. 15
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
  4. 36
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
  5. 12
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

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

@ -20,7 +20,9 @@ function cameraModal (props) {
CameraAbility,
cameraData, //
modify,
parentCamera
parentCamera,
addNvr,
nvrNumber
} = props;
const { equipmentWarehouse } = actions;
const fluoriteRef = useRef();
@ -31,13 +33,13 @@ function cameraModal (props) {
const [loadingTip, setloadingTip] = useState("获取中...请稍后..."); //loading tip
const [okText, setokText] = useState("确定"); //oktext
const [cancelText, setcancelText] = useState("取消"); //text
const [clickNum, setclickNum] = useState(
cameraData.type == "yingshi"
? 1
: cameraData.type == "ipc"
? 3
: cameraData.type == "nvr"
: cameraData.type == "nvr" || addNvr
? 2
: cameraData.type == "cascade"
? 4
@ -47,7 +49,7 @@ function cameraModal (props) {
useEffect(() => {
dispatch(equipmentWarehouse.getCameraKind());
dispatch(equipmentWarehouse.getAbility());
cameraData.type == "nvr" ? setcameraList(cameraList.slice(1, 4)) : "";
cameraData.type == "nvr" || addNvr ? setcameraList(cameraList.slice(1, 4)) : "";
}, []);
const cameraList = [
//
@ -149,20 +151,19 @@ function cameraModal (props) {
}
function handleChoose (id) {
//
if (!modify) {
if (!addNvr && !modify) {
setclickNum(id);
}
}
function turnLift () {
//
if (!modify) {
if (!addNvr && !modify) {
setcameraList(cameraList.slice(0, 3));
}
}
function turnRight () {
//
if (!modify) {
if (!addNvr && !modify) {
setcameraList(cameraList.slice(1, 4));
}
}
@ -337,7 +338,7 @@ function cameraModal (props) {
}}
onClick={() => handleChoose(item.id)}
>
{modify ? item.id == clickNum ? "" : <div style={{
{modify || addNvr ? item.id == clickNum ? "" : <div style={{
width: 266,
height: 146,
borderRadius: 3,
@ -490,7 +491,7 @@ function cameraModal (props) {
cameraData={cameraData}
/>
) : clickNum == 2 ? (
<NvrCamera nvrRef={nvrRef} cameraData={cameraData} />
<NvrCamera nvrRef={nvrRef} cameraData={cameraData} addNvr={addNvr} nvrNumber={nvrNumber} />
) : clickNum == 3 ? (
<IpcCamera
aRef={ipcRef}

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

@ -1,358 +1,417 @@
import React, { useState, useRef, useEffect, useImperativeHandle } from "react";
import { connect } from "react-redux";
import {
Form,
Row,
Col,
Button,
CheckboxGroup,
Checkbox,
Radio,
Input,
Form,
Row,
Col,
Button,
CheckboxGroup,
Checkbox,
Radio,
Input,
Spin,
} from "@douyinfe/semi-ui";
import { IconEdit, IconPlayCircle } from "@douyinfe/semi-icons";
import { IconEdit, IconPlayCircle, IconTickCircle } from "@douyinfe/semi-icons";
import "./cameraModal.less";
import PerfectScrollbar from "perfect-scrollbar";
import { isIndexed } from "immutable";
let equipmentScrollbar;
function nvrCamera({ dispatch, actions, nvrRef, cameraData }) {
const { equipmentWarehouse } = actions;
const cameraDataNvr = cameraData.nvr || "";
const form = useRef();
const [nvrCheckList, setNvrCheckList] = useState([]); //nvr
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr
const [isAllChoose, setIsAllChoose] = useState(false); //
const [equipmentNum, setEquipmentNum] = useState(""); //nvr
function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }) {
const { equipmentWarehouse } = actions;
const cameraDataNvr = cameraData.nvr || "";
const form = useRef();
const [nvrCheckList, setNvrCheckList] = useState([]); //nvr
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr
const [isAllChoose, setIsAllChoose] = useState(false); //
const [equipmentNum, setEquipmentNum] = useState(""); //nvr
const [isloading, setloading] = useState(false); //loading
const [loadingTip, setloadingTip] = useState("正在接入视频流..."); //loading tip
const [step, setstep] = useState("none");
const [stepp, setstepp] = useState("none");
useEffect(() => {
NVRcameraList
? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
suppressScrollX: true,
}))
: "";
}, [NVRcameraList]);
useEffect(() => {
const videoStreaming = document.getElementById("video_streaming");
if (videoStreaming && equipmentScrollbar) {
equipmentScrollbar.update();
}
});
useEffect(() => {
cameraDataNvr
? dispatch(
equipmentWarehouse.getVideoStreaming({
streamId: cameraDataNvr.serialNo,
})
).then((res) => {
let oneData = res.payload.data[0];
let modifyData = res.payload.data.find(
(item) => item.camera.name == cameraData.name
);
console.log(oneData);
console.log(modifyData);
let data = res.payload.data.map((item, index) => {
if (index == 0) {
item = modifyData;
}
if (
item.camera
? item.camera.name == cameraData.name && index > 0
: index < 0
) {
item = oneData;
}
item.change = false;
item.support = false;
if (item.camera) {
item.name = item.camera.name;
}
useEffect(() => {
NVRcameraList
? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
suppressScrollX: true,
}))
: "";
}, [NVRcameraList]);
useEffect(() => {
const videoStreaming = document.getElementById("video_streaming");
if (videoStreaming && equipmentScrollbar) {
equipmentScrollbar.update();
}
});
useEffect(() => {
if (cameraDataNvr) {
setloading(true);
setstep("block");
dispatch(
equipmentWarehouse.getVideoStreaming({
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
);
let data = res.payload.data.map((item, index) => {
if (index == 0) {
item = modifyData;
}
if (
item.camera
? item.camera.name == cameraData.name && index > 0
: index < 0
) {
item = oneData;
}
item.change = false;
item.support = false;
if (item.camera) {
item.name = item.camera.name;
}
return item;
});
setNVRcameraList(data);
setNvrCheckList([data[0].id]);
if (res.success) {
setTimeout(() => {
setloadingTip("接入完成");
setTimeout(() => {
setstep("none");
setloading(false);
setstepp("block");
setloadingTip("正在接入视频流...");
}, 800);
}, 800)
}
})
}
return item;
});
console.log(data);
setNVRcameraList(data);
//NVRnvr
if (addNvr) {
setloading(true);
setstep("block");
dispatch(equipmentWarehouse.getVideoStreaming({ streamId: nvrNumber })).then((res) => {
let chooseList = [];
let data = res.payload.data.map((item) => {
item.change = false;
item.support = false;
return item;
});
setNVRcameraList(data);
for (let index = 0; index < data.length; index++) {
chooseList.push(data[index].id);
}
setNvrCheckList(chooseList);
setIsAllChoose(true);
if (res.success) {
setTimeout(() => {
setloadingTip("接入完成");
setTimeout(() => {
setstep("none");
setloading(false);
setstepp("block");
setloadingTip("正在接入视频流...");
}, 800);
}, 800)
}
})
}
setNvrCheckList([data[0].id]);
})
: "";
}, []);
function NvrChangeName(e, index, name) {
//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
if (!cameraDataNvr || cameraData.name == name) {
NvrchangeList[index].change = true;
setNVRcameraList(NvrchangeList);
e.stopPropagation();
}, []);
function NvrChangeName (e, index, name) {
//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
if (!cameraDataNvr || 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 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 valuess = JSON.parse(JSON.stringify(values));
valuess.streamId = values.serialNo;
delete valuess.serialNo;
setloading(true);
setstep("block");
dispatch(equipmentWarehouse.getVideoStreaming(valuess)).then((res) => {
let data = res.payload.data.map((item) => {
item.change = false;
item.support = false;
return item;
});
setNVRcameraList(data);
for (let index = 0; index < data.length; index++) {
chooseList.push(data[index].id);
}
setNvrCheckList(chooseList);
setIsAllChoose(true);
if (res.success) {
setTimeout(() => {
setloadingTip("接入完成");
setTimeout(() => {
setstep("none");
setloading(false);
setstepp("block");
setloadingTip("正在接入视频流...");
}, 800);
}, 800)
}
});
})
.catch((errors) => {
//
console.log("errors", errors);
});
}
}
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));
console.log(e);
NvrchangeList[index].name = e;
setNVRcameraList(NvrchangeList);
}
function toggle(e, index) {
//nvr
console.log(e)
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
console.log(NvrchangeList)
NvrchangeList[index].support = e.target.checked;
setNVRcameraList(NvrchangeList);
e.stopPropagation();
}
function getVideoList() {
form.current
.validate()
.then((values) => {
//
function allChoose (e) {
///
let chooseList = [];
let valuess = JSON.parse(JSON.stringify(values));
valuess.streamId = values.serialNo;
delete valuess.serialNo;
dispatch(equipmentWarehouse.getVideoStreaming(valuess)).then((res) => {
let data = res.payload.data.map((item) => {
item.change = false;
item.support = false;
return item;
});
console.log(data);
setNVRcameraList(data);
for (let index = 0; index < data.length; index++) {
chooseList.push(data[index].id);
}
console.log(chooseList);
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);
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;
function playVideo (e) {
//nvr
console.log("22222222222222222");
e.stopPropagation();
}
}
useImperativeHandle(nvrRef, () => ({
//
//aa
resetFluoriteCamera: form.current.reset,
equipmentNum: cameraDataNvr ? cameraDataNvr.serialNo : equipmentNum,
NVRcameraList: NVRcameraList.filter((v) =>
nvrCheckList.some((e) => e == v.id)
),
}));
return (
<>
<Form
allowEmpty
labelPosition="left"
labelAlign="left"
labelWidth="115px"
onValueChange={(values) => {
setEquipmentNum(values.serialNo);
}}
getFormApi={(formApi) => (form.current = formApi)}
>
<div style={{ display: "flex" }}>
<Form.Input
field="serialNo"
maxLength="39"
label="设备编号:"
disabled={cameraDataNvr ? true : false}
initValue={cameraDataNvr ? cameraDataNvr.serialNo : ""}
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"
disabled={cameraDataNvr ? true : false}
onChange={(e) => allChoose(e)}
aria-label="全选"
>
全选
</Radio>
</div>
) : (
""
)}
</div>
<Row>
<CheckboxGroup
type="pureCard"
direction="vertical"
aria-label="视频流获取"
value={nvrCheckList}
onChange={(nvrCheck) => {
setNvrCheckList(nvrCheck);
if (NVRcameraList.length == nvrCheck.length) {
setIsAllChoose(true);
} else {
setIsAllChoose(false);
}
}}
>
<div
id="video_streaming"
style={{ maxHeight: 300, position: "relative" }}
function onDisabled (name) {
if ((cameraDataNvr && cameraData.name == name) || !cameraDataNvr) {
return false;
} else {
return true;
}
}
useImperativeHandle(nvrRef, () => ({
//
//aa
resetFluoriteCamera: form.current.reset,
equipmentNum: cameraDataNvr ? cameraDataNvr.serialNo : addNvr ? nvrNumber : equipmentNum,
NVRcameraList: NVRcameraList.filter((v) =>
nvrCheckList.some((e) => e == v.id)
),
}));
return (
<>
<Form
allowEmpty
labelPosition="left"
labelAlign="left"
labelWidth="115px"
onValueChange={(values) => {
setEquipmentNum(values.serialNo);
}}
getFormApi={(formApi) => (form.current = formApi)}
>
{NVRcameraList.length > 0
? NVRcameraList.map((item, index) => (
<Col
key={index}
span={12}
style={{
display: "flex",
justifyContent: "center",
marginTop: 12,
}}
<div style={{ display: "flex" }}>
<Form.Input
field="serialNo"
maxLength="39"
label="设备编号:"
disabled={cameraDataNvr ? true : addNvr ? true : false}
initValue={cameraDataNvr ? cameraDataNvr.serialNo : addNvr ? nvrNumber : ""}
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 }}
>
<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)}
></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)}
/>
<Radio
checked={item.support}
视频流获取
</Button>
{NVRcameraList.length > 0 ? (
<div
style={{ display: "flex", alignItems: "center", marginLeft: 211 }}
>
<Radio
checked={isAllChoose}
mode="advanced"
disabled={onDisabled(item.name)}
onChange={(e) => toggle(e, index)}
aria-label="单选"
>
云台支持
</Radio>
</div>
</div>
}
style={{ width: 280, border: "1px solid #F9F9F9" }}
></Checkbox>
</Col>
))
: ""}
</div>
</CheckboxGroup>
</Row>
</Form>
</>
);
disabled={cameraDataNvr ? true : false}
onChange={(e) => allChoose(e)}
aria-label="全选"
>
全选
</Radio>
</div>
) : (
""
)}
</div>
<Row>
<CheckboxGroup
type="pureCard"
direction="vertical"
aria-label="视频流获取"
value={nvrCheckList}
onChange={(nvrCheck) => {
setNvrCheckList(nvrCheck);
if (NVRcameraList.length == nvrCheck.length) {
setIsAllChoose(true);
} else {
setIsAllChoose(false);
}
}}
>
<div
id="video_streaming"
style={{ maxHeight: 300, position: "relative" }}
>
<Spin tip={loadingTip} spinning={isloading}>
<div style={{ display: stepp }}>
{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)}
></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)}
/>
<Radio
checked={item.support}
mode="advanced"
disabled={onDisabled(item.name)}
onChange={(e) => toggle(e, index)}
aria-label="单选"
>
云台支持
</Radio>
</div>
</div>
}
style={{ width: 280, border: "1px solid #F9F9F9" }}
></Checkbox>
</Col>
))
: ""}
</div>
<div style={{ height: 50, width: "100%", display: step }}></div>
</Spin>
</div>
</CheckboxGroup>
</Row>
</Form>
</>
);
}
function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data,
};
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);

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

@ -1,4 +1,4 @@
import React, { useState, useRef, useEffect } from "react";
import React, { useState, useRef, useEffect,useImperativeHandle } from "react";
import { connect } from "react-redux";
import { Modal, Form, Row, Col, Spin } from "@douyinfe/semi-ui";
import { IconTickCircle } from "@douyinfe/semi-icons";
@ -6,7 +6,7 @@ import { IconTickCircle } from "@douyinfe/semi-icons";
import moment from "moment";
function nvrModal(props) {
const { modalName } = props;
const { modalName ,nvrRef} = props;
const { dispatch, actions, vender, close } = props;
const nvrData = props.nvrData || {}; //
const form = useRef();
@ -18,10 +18,6 @@ function nvrModal(props) {
const [cancelText, setcancelText] = useState("取消"); //text
const [formObj, setformObj] = useState(); //
useEffect(() => {
console.log(props.user.id);
}, []);
function showDialog() {
//
setVisible(true);
@ -47,6 +43,7 @@ function nvrModal(props) {
.validate()
.then((values) => {
//
console.log(values)
let valuesObj = JSON.parse(JSON.stringify(values));
valuesObj.longitude = values.position.split(",")[0];
valuesObj.latitude = values.position.split(",")[1];
@ -61,7 +58,6 @@ function nvrModal(props) {
serialNo: valuesObj.serialNo,
})
).then((res) => {
console.log(res);
var after = new moment(); //
var duration = moment.duration(after.diff(front))._data.milliseconds;
if (res.success) {
@ -127,6 +123,11 @@ function nvrModal(props) {
//
window.open("https://lbs.amap.com/tools/picker", "_blank");
}
useImperativeHandle(nvrRef, () => ({
//
//aa
nvrNumber: ()=>formObj.serialNo
}));
return (
<>
<div onClick={showDialog}>{modalName == "add" ? "添加NVR" : "修改"}</div>

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

@ -37,6 +37,8 @@ const CameraHeader = (props) => {
const [cameraData, setCameraData] = useState({}); //
const [modify, setModify] = useState(false); //
const [parentCamera, setParentCamera] = useState(""); //
const [addNvr, setAddNvr] = useState(false); //nvrNVR
const [nvrNumber, setNvrNumber] = useState();
const { equipmentWarehouse } = actions;
const api = useRef();
const searchb = useRef(search)
@ -44,8 +46,14 @@ const CameraHeader = (props) => {
const CAMERAS = "cameras";
useEffect(() => {
console.log(props)
if (props.location.query) {
setAddNvr(props.location.query.addNvr)
setNvrNumber(props.location.query.serialNo)
setCameraModal(true);
}
dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data);
attribute(res.payload.data);
@ -115,7 +123,6 @@ const CameraHeader = (props) => {
width: "20%",
dataIndex: "",
render: (_, row) => {
console.log(row);
return (
<div style={{ display: "flex" }}>
<Button
@ -220,26 +227,6 @@ const CameraHeader = (props) => {
},
];
const device_ = (r) => {
console.log(searchb)
if (deviceClick) {
// if (r.type == "nvr") {
// console.log(search)
// setearch({ ...search, nvrId: r.nvr.id })
// } else {
// setearch({ ...search, externalDomain: r.externalDomain })
// }
setDeviceClick(false)
} else {
// if (r.type == "nvr") {
// setearch({ ...search, nvrId: null })
// } else {
// setearch({ ...search, externalDomain: null })
// }
setDeviceClick(true)
}
}
//
function attribute (data) {
const arr = localStorage.getItem(CAMERAS)
@ -706,14 +693,17 @@ const CameraHeader = (props) => {
venderList={venderList}
cameraData={cameraData}
modify={modify}
addNvr={addNvr}
nvrNumber={nvrNumber}
parentCamera={parentCamera}
close={() => {
setCameraModal(false);
setCameraData({});
setModify(false)
setParentCamera("")
setAddNvr(false)
setNvrNumber("")
equipmentGetCamera();
}}
modalName={modalName}
/>

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

@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux";
import { push } from "react-router-redux";
// import { push } from "react-router-redux";
import moment from "moment";
import {
Button,
@ -30,7 +30,7 @@ export const accessType = [
];
const NvrHeader = (props) => {
const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props;
const { history,dispatch, actions, user, loading, equipmentWarehouseNvr } = props;
const { equipmentWarehouse } = actions;
const [setup, setSetup] = useState(false);
const [sideSheet, setSideSheet] = useState(false);
@ -39,12 +39,13 @@ const NvrHeader = (props) => {
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); //
const [rowId, setRowId] = useState(); //id
const [reminder, setReminder] = useState(false); //
const api = useRef();
const SETUPS = "setups";
const nvrRef = useRef(); //
useEffect(() => {
console.log(props)
dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data);
attribute(res.payload.data);
@ -157,7 +158,6 @@ const NvrHeader = (props) => {
dataIndex: "venderId",
key: "manufactor",
render: (_, r, index) => {
console.log(r);
let manufactorName = data.find((item) => item.id == r.venderId);
return manufactorName ? manufactorName.name : "";
},
@ -327,7 +327,9 @@ const NvrHeader = (props) => {
<NvrModal
modalName="add"
venderList={venderList}
nvrRef={nvrRef}
close={() => {
setReminder(true)
equipmentGetNvr();
}}
/>
@ -592,7 +594,7 @@ const NvrHeader = (props) => {
toadd="去添加"
visible={reminder}
onOk={() => {
dispatch(push('/equipmentWarehouse/camera/:addNvr=true'));
history.push({pathname:'/equipmentWarehouse/camera',query:{addNvr:true,serialNo:nvrRef.current.nvrNumber()}});
setReminder(false)
}}
/>

Loading…
Cancel
Save