|
|
@ -34,7 +34,7 @@ const CameraHeader = (props) => { |
|
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 |
|
|
|
const [search, setSearch] = useState({}); //搜索条件 |
|
|
|
const [rowId, setRowId] = useState(); //表格数据id |
|
|
|
const [cameraData, setCameraData] = useState({}); //表格数据 |
|
|
|
const [cameraData, setCameraData] = useState({}); //表格传递数据 |
|
|
|
const [modify, setModify] = useState(false); //修改 |
|
|
|
const [parentCamera, setParentCamera] = useState(""); //级联摄像头父级设备 |
|
|
|
const [addNvr, setAddNvr] = useState(false); //nvr页面传递参数打开NVR摄像头添加弹框 |
|
|
@ -43,7 +43,9 @@ const CameraHeader = (props) => { |
|
|
|
const [axyData, setAxyData] = useState(); |
|
|
|
const { equipmentWarehouse } = actions; |
|
|
|
const api = useRef(); |
|
|
|
const searchb = useRef(search) |
|
|
|
const searchData = useRef({}) |
|
|
|
const limits = useRef(); //每页实际条数 |
|
|
|
const page = useRef(query.page); |
|
|
|
const deviceClickb = useRef(true) |
|
|
|
const CAMERAS = "cameras"; |
|
|
|
|
|
|
@ -77,8 +79,11 @@ const CameraHeader = (props) => { |
|
|
|
equipmentGetCamera(); |
|
|
|
}, [query, search]); |
|
|
|
|
|
|
|
function equipmentGetCamera () { |
|
|
|
dispatch(equipmentWarehouse.getCamera({ ...query, ...search })); |
|
|
|
const equipmentGetCamera = () => { |
|
|
|
searchData.current = { ...query, ...search } |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchData.current)).then((res) => { |
|
|
|
limits.current = res.payload.data.data.length |
|
|
|
}); |
|
|
|
} |
|
|
|
function equipmentStatus (data) { |
|
|
|
switch (data) { |
|
|
@ -124,16 +129,16 @@ const CameraHeader = (props) => { |
|
|
|
onClick={() => { |
|
|
|
if (deviceClickb.current) { |
|
|
|
if (row.type == "nvr") { |
|
|
|
setSearch({ ...searchb.current, nvrId: row.nvr.id }) |
|
|
|
setSearch({ ...search, nvrId: row.nvr.id }) |
|
|
|
} else { |
|
|
|
setSearch({ ...searchb.current, externalDomain: row.externalDomain }) |
|
|
|
setSearch({ ...search, externalDomain: row.externalDomain }) |
|
|
|
} |
|
|
|
deviceClickb.current = false |
|
|
|
} else { |
|
|
|
if (row.type == "nvr") { |
|
|
|
setSearch({ ...searchb.current, nvrId: null }) |
|
|
|
setSearch({ ...search, nvrId: null }) |
|
|
|
} else { |
|
|
|
setSearch({ ...searchb.current, externalDomain: null }) |
|
|
|
setSearch({ ...search, externalDomain: null }) |
|
|
|
} |
|
|
|
deviceClickb.current = true |
|
|
|
} |
|
|
@ -150,7 +155,6 @@ const CameraHeader = (props) => { |
|
|
|
width: "20%", |
|
|
|
dataIndex: "", |
|
|
|
render: (_, row) => { |
|
|
|
console.log(row); |
|
|
|
return ( |
|
|
|
<div style={{ display: "flex" }}> |
|
|
|
<Button |
|
|
@ -187,6 +191,8 @@ const CameraHeader = (props) => { |
|
|
|
<Button |
|
|
|
theme="borderless" |
|
|
|
onClick={() => { |
|
|
|
let data = row?.cameraRemarks.map((item)=>item.remark) |
|
|
|
console.log((data)); |
|
|
|
if (row.type == "yingshi") { |
|
|
|
setVideoObj({ |
|
|
|
type: row.type, |
|
|
@ -194,6 +200,7 @@ const CameraHeader = (props) => { |
|
|
|
yingshiToken: row.secretYingshi?.token, |
|
|
|
playUrlSd: row.gbCamera?.playUrl?.liveUrl?.sd?.ezopen, |
|
|
|
playUrlHd: row.gbCamera?.playUrl?.liveUrl?.hd?.ezopen, |
|
|
|
content:data, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
setVideoObj({ |
|
|
@ -223,7 +230,7 @@ const CameraHeader = (props) => { |
|
|
|
row.forbidden |
|
|
|
) |
|
|
|
).then(() => { |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchb.current)); |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchData.current)) |
|
|
|
}); |
|
|
|
}} |
|
|
|
> |
|
|
@ -245,7 +252,7 @@ const CameraHeader = (props) => { |
|
|
|
row.forbidden |
|
|
|
) |
|
|
|
).then(() => { |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchb.current)); |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchData.current)) |
|
|
|
}); |
|
|
|
}} |
|
|
|
> |
|
|
@ -254,7 +261,7 @@ const CameraHeader = (props) => { |
|
|
|
)} |
|
|
|
|
|
|
|
<Popconfirm |
|
|
|
title="删除NVR会删除端口下的所有摄像头,是否确定删除?" |
|
|
|
title="删除后设备视频流会被中断,是否确定删除?" |
|
|
|
arrowPointAtCenter={false} |
|
|
|
showArrow={true} |
|
|
|
position="topRight" |
|
|
@ -262,7 +269,11 @@ const CameraHeader = (props) => { |
|
|
|
dispatch( |
|
|
|
equipmentWarehouse.delCamera(row.id) |
|
|
|
).then(() => { |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchb.current)); |
|
|
|
if (page.current > 0 && limits.current < 2) { |
|
|
|
setQuery({ limit: 10, page: page.current - 1 }) |
|
|
|
} else { |
|
|
|
setQuery({ limit: 10, page: page.current }) |
|
|
|
} |
|
|
|
}); |
|
|
|
}} |
|
|
|
> |
|
|
@ -438,13 +449,14 @@ const CameraHeader = (props) => { |
|
|
|
return dataSet.length > 0 ? <Popover |
|
|
|
key="updateTime" |
|
|
|
position="top" |
|
|
|
content={ |
|
|
|
content={dataSet.length > 1 ? |
|
|
|
<article style={{ padding: 12 }}> |
|
|
|
{dataSet.length > 0 ? dataSet.map((v, index) => <div key={index}>{v}</div>) : ""} |
|
|
|
{dataSet.map((v, index) => <div key={index}>{v}</div>)} |
|
|
|
</article> |
|
|
|
: "" |
|
|
|
} |
|
|
|
> |
|
|
|
<Tag>{dataSet.length > 0 ? `${dataSet[0]}...` : ""}</Tag> |
|
|
|
<Tag>{dataSet.length > 1 ? `${dataSet[0]}...` : dataSet.length > 0 ? dataSet[0] : ""}</Tag> |
|
|
|
</Popover> : "" |
|
|
|
|
|
|
|
} |
|
|
@ -631,7 +643,6 @@ const CameraHeader = (props) => { |
|
|
|
api.current.validate().then((v) => { |
|
|
|
setSearch(v); |
|
|
|
setQuery({ limit: 10, page: 0 }) |
|
|
|
searchb.current = { ...v, limit: 10, page: 0 } |
|
|
|
}); |
|
|
|
}} |
|
|
|
> |
|
|
@ -651,6 +662,7 @@ const CameraHeader = (props) => { |
|
|
|
onClick={() => { |
|
|
|
api.current.reset(); |
|
|
|
setSearch({}); |
|
|
|
setQuery({ limit: 10, page: 0 }) |
|
|
|
}} |
|
|
|
> |
|
|
|
重置 |
|
|
@ -739,6 +751,7 @@ const CameraHeader = (props) => { |
|
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
|
onChange={(currentPage, pageSize) => { |
|
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
page.current = currentPage - 1 |
|
|
|
}} |
|
|
|
/> |
|
|
|
</div> |
|
|
@ -793,7 +806,7 @@ const CameraHeader = (props) => { |
|
|
|
setAddNvr(false) |
|
|
|
setNvrNumber("") |
|
|
|
setAxyData("") |
|
|
|
dispatch(equipmentWarehouse.getCamera(searchb.current)); |
|
|
|
equipmentGetCamera() |
|
|
|
}} |
|
|
|
modalName={modalName} |
|
|
|
/> |
|
|
|