|
@ -1,6 +1,7 @@ |
|
|
import React, { useState, useEffect, useRef } from "react"; |
|
|
import React, { useState, useEffect, useRef } from "react"; |
|
|
import { connect } from "react-redux"; |
|
|
import { connect } from "react-redux"; |
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
|
|
|
import qs from "qs"; |
|
|
import { |
|
|
import { |
|
|
Button, |
|
|
Button, |
|
|
Form, |
|
|
Form, |
|
@ -25,6 +26,7 @@ import { accessType } from "./nvr"; |
|
|
const CameraHeader = (props) => { |
|
|
const CameraHeader = (props) => { |
|
|
const { dispatch, actions, user, loading, equipmentWarehouseCamera } = props; |
|
|
const { dispatch, actions, user, loading, equipmentWarehouseCamera } = props; |
|
|
const [cameraModal, setCameraModal] = useState(false); |
|
|
const [cameraModal, setCameraModal] = useState(false); |
|
|
|
|
|
const [videoPlay, setVideoPlay] = useState(false); |
|
|
const [modalName, setModalName] = useState(""); |
|
|
const [modalName, setModalName] = useState(""); |
|
|
const [setup, setSetup] = useState(false); |
|
|
const [setup, setSetup] = useState(false); |
|
|
const [sideSheet, setSideSheet] = useState(false); |
|
|
const [sideSheet, setSideSheet] = useState(false); |
|
@ -39,6 +41,7 @@ const CameraHeader = (props) => { |
|
|
const [parentCamera, setParentCamera] = useState(""); //级联摄像头父级设备 |
|
|
const [parentCamera, setParentCamera] = useState(""); //级联摄像头父级设备 |
|
|
const [addNvr, setAddNvr] = useState(false); //nvr页面传递参数打开NVR摄像头添加弹框 |
|
|
const [addNvr, setAddNvr] = useState(false); //nvr页面传递参数打开NVR摄像头添加弹框 |
|
|
const [nvrNumber, setNvrNumber] = useState(); |
|
|
const [nvrNumber, setNvrNumber] = useState(); |
|
|
|
|
|
const [axyData, setAxyData] = useState(); |
|
|
const { equipmentWarehouse } = actions; |
|
|
const { equipmentWarehouse } = actions; |
|
|
const api = useRef(); |
|
|
const api = useRef(); |
|
|
const searchb = useRef(search) |
|
|
const searchb = useRef(search) |
|
@ -47,13 +50,19 @@ const CameraHeader = (props) => { |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
console.log(props) |
|
|
console.log(props) |
|
|
|
|
|
//安心云传参 |
|
|
|
|
|
let isAxyData = props.location.search |
|
|
|
|
|
|
|
|
|
|
|
if (isAxyData) { |
|
|
|
|
|
setAxyData(qs.parse(isAxyData.slice(1))) |
|
|
|
|
|
setCameraModal(true) |
|
|
|
|
|
} |
|
|
|
|
|
//NVR传来的参数 |
|
|
if (props.location.query) { |
|
|
if (props.location.query) { |
|
|
setAddNvr(props.location.query.addNvr) |
|
|
setAddNvr(props.location.query.addNvr) |
|
|
setNvrNumber(props.location.query.serialNo) |
|
|
setNvrNumber(props.location.query.serialNo) |
|
|
setCameraModal(true); |
|
|
setCameraModal(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
@ -74,8 +83,31 @@ const CameraHeader = (props) => { |
|
|
function equipmentGetCamera () { |
|
|
function equipmentGetCamera () { |
|
|
dispatch(equipmentWarehouse.getCamera({ ...query, ...search })); |
|
|
dispatch(equipmentWarehouse.getCamera({ ...query, ...search })); |
|
|
} |
|
|
} |
|
|
const equipmentStatus = { ON: "在线", ONLINE: "在线", OFF: "离线", Alarmed: "未知状态" } |
|
|
function equipmentStatus (data) { |
|
|
|
|
|
switch (data) { |
|
|
|
|
|
case "ON": |
|
|
|
|
|
return "在线" |
|
|
|
|
|
case "ONLINE": |
|
|
|
|
|
return "在线" |
|
|
|
|
|
case "OFF": |
|
|
|
|
|
return "离线" |
|
|
|
|
|
default: |
|
|
|
|
|
return "未知" |
|
|
|
|
|
}F |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function colorStatus (data) { |
|
|
|
|
|
switch (data) { |
|
|
|
|
|
case "ON": |
|
|
|
|
|
return "#04B234" |
|
|
|
|
|
case "ONLINE": |
|
|
|
|
|
return "#04B234" |
|
|
|
|
|
case "OFF": |
|
|
|
|
|
return "rgba(0, 0, 0, 0.45)" |
|
|
|
|
|
default: |
|
|
|
|
|
return "#1859C1" |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ |
|
|
{ |
|
|
title: "序号", |
|
|
title: "序号", |
|
@ -123,6 +155,7 @@ 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 |
|
|
<Button |
|
@ -144,7 +177,20 @@ const CameraHeader = (props) => { |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
修改 |
|
|
修改 |
|
|
|
|
|
|
|
|
</Button> |
|
|
</Button> |
|
|
|
|
|
|
|
|
|
|
|
{/* <Button onClick={() => { //aa开始为true |
|
|
|
|
|
if(aa){ |
|
|
|
|
|
显示注记的方法 |
|
|
|
|
|
aa=false |
|
|
|
|
|
}else{ |
|
|
|
|
|
隐藏注记的方法 |
|
|
|
|
|
aa=true |
|
|
|
|
|
} |
|
|
|
|
|
}}> |
|
|
|
|
|
{aa?"显示注记":"隐藏注记"} |
|
|
|
|
|
</Button> */} |
|
|
<Button |
|
|
<Button |
|
|
theme="borderless" |
|
|
theme="borderless" |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
@ -158,7 +204,8 @@ const CameraHeader = (props) => { |
|
|
<Button |
|
|
<Button |
|
|
theme="borderless" |
|
|
theme="borderless" |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
setRowId(row.id); |
|
|
// setRowId(row.id); |
|
|
|
|
|
setVideoPlay(true) |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
播放 |
|
|
播放 |
|
@ -256,6 +303,24 @@ const CameraHeader = (props) => { |
|
|
title: "设备状态", |
|
|
title: "设备状态", |
|
|
dataIndex: "channelCount", |
|
|
dataIndex: "channelCount", |
|
|
key: "state", |
|
|
key: "state", |
|
|
|
|
|
render: (_, r, index) => { |
|
|
|
|
|
let status = r.gbCamera; |
|
|
|
|
|
return ( |
|
|
|
|
|
<div> |
|
|
|
|
|
<span |
|
|
|
|
|
style={{ |
|
|
|
|
|
width: 8, |
|
|
|
|
|
height: 8, |
|
|
|
|
|
display: "inline-block", |
|
|
|
|
|
borderRadius: "50%", |
|
|
|
|
|
backgroundColor: r.forbidden ? "red" : status ? colorStatus(status.online) : "", |
|
|
|
|
|
margin: "0 8px 0 0", |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
{r.forbidden ? "禁用" : status ? equipmentStatus(status.online) : ""} |
|
|
|
|
|
</div> |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "云台支持", |
|
|
title: "云台支持", |
|
@ -696,6 +761,7 @@ const CameraHeader = (props) => { |
|
|
addNvr={addNvr} |
|
|
addNvr={addNvr} |
|
|
nvrNumber={nvrNumber} |
|
|
nvrNumber={nvrNumber} |
|
|
parentCamera={parentCamera} |
|
|
parentCamera={parentCamera} |
|
|
|
|
|
axyData={axyData} |
|
|
close={() => { |
|
|
close={() => { |
|
|
setCameraModal(false); |
|
|
setCameraModal(false); |
|
|
setCameraData({}); |
|
|
setCameraData({}); |
|
@ -703,6 +769,7 @@ const CameraHeader = (props) => { |
|
|
setParentCamera("") |
|
|
setParentCamera("") |
|
|
setAddNvr(false) |
|
|
setAddNvr(false) |
|
|
setNvrNumber("") |
|
|
setNvrNumber("") |
|
|
|
|
|
setAxyData("") |
|
|
equipmentGetCamera(); |
|
|
equipmentGetCamera(); |
|
|
}} |
|
|
}} |
|
|
modalName={modalName} |
|
|
modalName={modalName} |
|
@ -710,8 +777,13 @@ const CameraHeader = (props) => { |
|
|
) : ( |
|
|
) : ( |
|
|
"" |
|
|
"" |
|
|
)} |
|
|
)} |
|
|
{ |
|
|
{videoPlay ? |
|
|
// <VideoPlayModal visible={true} /> |
|
|
<VideoPlayModal |
|
|
|
|
|
visible={true} |
|
|
|
|
|
close={() => { |
|
|
|
|
|
setVideoPlay(false) |
|
|
|
|
|
}} /> |
|
|
|
|
|
: "" |
|
|
} |
|
|
} |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|