Browse Source

Merge branch 'dev_trial' of https://gitea.free-sun.vip/free-sun/FS-IOT into dev_trial

release_0.0.2
yuan_yi 3 years ago
parent
commit
efab54dbdc
  1. 42
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js
  2. 3
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/index.js
  3. 12
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js
  4. 19
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/setup.jsx
  5. 252
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/sideSheet.jsx
  6. 171
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
  7. 90
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
  8. 6
      code/VideoAccess-VCMP/web/client/src/utils/webapi.js

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

@ -0,0 +1,42 @@
"use strict";
import { basicAction } from "@peace/utils";
import { ApiTable } from "$utils";
export function getCamera(query) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_CAMREA",
query: query,
url: `${ApiTable.getCamera}`,
msg: { option: "获取摄像头列表信息" },
reducer: { name: "equipmentWarehouseCamera" },
});
}
export function putForbidden(data) {
return (dispatch) =>
basicAction({
type: "put",
dispatch: dispatch,
actionType: "PUT_FORBIDDEN",
data,
url: `${ApiTable.putForbidden}`,
msg: { option: "" }, //禁用摄像头
reducer: {},
});
}
export function getCameraDetails(orgId) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_CAMREA_DETAILS",
url: `${ApiTable.getCameraDetails.replace("{cameraId}", orgId)}`,
msg: { option: "" }, //获取摄像头详情
reducer: { name: "nvrDetails" },
});
}

3
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/index.js

@ -1,7 +1,8 @@
'use strict'; 'use strict';
import * as nvr from './nvr' import * as nvr from './nvr'
import * as camera from './camera'
export default { export default {
...nvr ...nvr,...camera
} }

12
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js

@ -27,6 +27,18 @@ export function getNvr(query) {
reducer: { name: "equipmentWarehouseNvr" }, reducer: { name: "equipmentWarehouseNvr" },
}); });
} }
export function getNvrDetails(orgId) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_NVR_DETAILS",
url: `${ApiTable.getNvrDetails.replace("{nvrId}", orgId)}`,
msg: { option: "" }, //获取nvr详情
reducer: { name: "nvrDetails" },
});
}
export function delNvr(orgId) { export function delNvr(orgId) {
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({

19
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/setup.jsx

@ -20,6 +20,7 @@ function Setup(props) {
cameraSetup, cameraSetup,
} = props; } = props;
const [check, setCheck] = useState([]); const [check, setCheck] = useState([]);
const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" }; const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" };
useEffect(() => { useEffect(() => {
@ -35,17 +36,17 @@ function Setup(props) {
}, []); }, []);
const equipmentNVR = [ const equipmentNVR = [
{ name: "设备厂家", value: "a" }, { name: "设备厂家", value: "manufactor" },
{ name: "添加账号", value: "b" }, { name: "添加账号", value: "accountNumber" },
{ name: "通道数", value: "c" }, { name: "通道数", value: "passageway" },
{ name: "端口", value: "d" }, { name: "端口", value: "port" },
{ name: "设备状态", value: "e" }, { name: "设备状态", value: "state" },
{ name: "创建时间", value: "f" }, { name: "创建时间", value: "time" },
]; ];
const projectNVR = [ const projectNVR = [
{ name: "项目名称", value: "g" }, { name: "项目名称", value: "name" },
{ name: "things名称", value: "h" }, { name: "pcode", value: "pcode" },
{ name: "things数量", value: "i" }, { name: "结构物", value: "structure" },
]; ];
const equipmentCamera = [ const equipmentCamera = [
{ name: "设备厂家", value: "manufactor" }, { name: "设备厂家", value: "manufactor" },

252
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/sideSheet.jsx

@ -1,6 +1,12 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { connect } from "react-redux";
import { SideSheet, Tabs, TabPane, Button } from "@douyinfe/semi-ui"; import { SideSheet, Tabs, TabPane, Button } from "@douyinfe/semi-ui";
import copy from "copy-to-clipboard"; import copy from "copy-to-clipboard";
import moment from "moment";
import PerfectScrollbar from "perfect-scrollbar";
let projectScrollbar;
let equipmentScrollbar;
function SideSheets(props) { function SideSheets(props) {
const { const {
@ -12,39 +18,33 @@ function SideSheets(props) {
close, close,
SETUPS, SETUPS,
cameraSetup, cameraSetup,
rowId,
venderList,
accessType,
} = props; } = props;
const { equipmentWarehouse } = actions;
const [clickStyle, setclickStyle] = useState(); const [clickStyle, setclickStyle] = useState();
const list = [ const [nvrDetails, setNvrDetails] = useState("");
{ const list = ["项目名称", "关联结构物", "关联测点", "关联监测因素"];
name: "项目名称",
a: "南昌县智慧环保",
b: "南昌县智慧环保",
c: "南昌市市政隧道综合管理 哦哦哦哦哦 哦哦哦哦 哦哦哦哦 哦哦哦哦哦哦哦哦哦 哦",
d: "C",
},
{ name: "关联结构物", a: "a", b: "B", c: "C", d: "C" },
{ name: "关联测点", a: "a", b: "B", c: "C", d: "C" },
{ name: "关联监测因素", a: "a", b: "B", c: "C", d: "C" },
];
const information = { const information = {
nvr: [ nvr: [
{ {
name: "基础信息", name: "基础信息",
basics: [ basics: [
{ name: "设备名称:", value: "消火栓呼呼呼呼" }, { name: "设备名称:", key: "name" },
{ name: "设备编号:", value: "D50F2049010B" }, { name: "设备编号:", key: "serialNo" },
{ name: "接入方式:", value: "NJBJ858G68H" }, { name: "接入方式:", key: "type" },
{ name: "厂商:", value: "哇哇哇哇哇" }, { name: "厂商:", key: "venderId" },
{ name: "添加账号:", value: "Superadmin" }, { name: "添加账号:", key: "createUser" },
{ name: "添加时间:", value: "2022-09-09" }, { name: "添加时间:", key: "createTime" },
{ {
name: "行政区别:", name: "行政区别:",
value: "江西省-南昌市-南昌县", key: "江西省-南昌市-南昌县",
difference: "difference", difference: "difference",
}, },
{ {
name: "设备安装位置:", name: "设备安装位置:",
value: "江西省南昌县小蓝经开区江西飞尚科技有限公司", key: "江西省南昌县小蓝经开区江西飞尚科技有限公司",
difference: "line", difference: "line",
}, },
], ],
@ -52,15 +52,15 @@ function SideSheets(props) {
{ {
name: "接入信息", name: "接入信息",
access: [ access: [
{ name: "SIP服务编号:", value: "1111111111" }, { name: "SIP服务编号:", key: "1111111111" },
{ name: "SIP域:", value: "KGU876J87" }, { name: "SIP域:", key: "KGU876J87" },
{ name: "SIP端口号:", value: "KGU876J87" }, { name: "SIP端口号:", key: "port" },
{ name: "通道数量:", value: "16通道" }, { name: "通道数量:", key: "channelCount" },
{ name: "心跳周期:", value: "3600s" }, { name: "心跳周期:", key: "3600s" },
{ name: "最大心跳次数:", value: "3次" }, { name: "最大心跳次数:", key: "3次" },
{ name: "注册密码:", value: "**********" }, { name: "注册密码:", key: "**********" },
{ name: "注册有效期::", value: "3600s" }, { name: "注册有效期::", key: "3600s" },
{ name: "接入识别模块:", value: "sssss" }, { name: "接入识别模块:", key: "sssss" },
], ],
}, },
{ {
@ -83,15 +83,18 @@ function SideSheets(props) {
{ {
name: "基础信息", name: "基础信息",
basics: [ basics: [
{ name: "设备名称:", value: "消火栓呼呼呼呼" }, { name: "设备名称:", key: "name" },
{ name: "SIP编号/设备编号:", value: "D50F2049010B" }, {
{ name: "接入方式:", value: "NJBJ858G68H" }, name: "SIP编号/设备编号:",
{ name: "厂商:", value: "哇哇哇哇哇" }, key: nvrDetails.serialNo ? "serialNo" : "sip",
{ name: "添加账号:", value: "Superadmin" }, },
{ name: "添加时间:", value: "2022-09-09" }, { name: "接入方式:", key: "type" },
{ name: "厂商:", key: "venderId" },
{ name: "添加账号:", key: "createUser" },
{ name: "添加时间:", key: "createTime" },
{ {
name: "设备安装位置:", name: "设备安装位置:",
value: "江西省南昌县小蓝经开区江西飞尚科技有限公司", key: "江西省南昌县小蓝经开区江西飞尚科技有限公司",
difference: "line", difference: "line",
}, },
], ],
@ -99,11 +102,11 @@ function SideSheets(props) {
{ {
name: "复制直播地址", name: "复制直播地址",
liveBroadcast: [ liveBroadcast: [
{ name: "HLS地址", value: "" }, { name: "HLS地址", key: "" },
{ name: "FLV地址", value: "" }, { name: "FLV地址", key: "" },
{ name: "RTMP地址", value: "" }, { name: "RTMP地址", key: "" },
{ name: "EZOPEN地址", value: "" }, { name: "EZOPEN地址", key: "" },
{ name: "ONVIF地址", value: "" }, { name: "ONVIF地址", key: "" },
], ],
}, },
{ {
@ -132,8 +135,33 @@ function SideSheets(props) {
zIndex: 5, zIndex: 5,
}; };
useEffect(() => {}, []); useEffect(() => {
dispatch(
equipmentWarehouse[cameraSetup ? "getCameraDetails" : "getNvrDetails"](
rowId
)
).then((res) => {
setNvrDetails(res.payload.data);
projectScrollbar = new PerfectScrollbar("#project_information", {
suppressScrollX: true,
});
equipmentScrollbar = new PerfectScrollbar("#equipment_information", {
suppressScrollX: true,
});
});
console.log(nvrDetails);
}, []);
useEffect(() => {
const domProject = document.getElementById("project_information");
if (domProject && projectScrollbar) {
projectScrollbar.update();
}
const domEquipment = document.getElementById("equipment_information");
if (domEquipment && equipmentScrollbar) {
projectScrollbar.update();
}
});
return ( return (
<SideSheet <SideSheet
visible={visible} visible={visible}
@ -146,16 +174,14 @@ function SideSheets(props) {
> >
<Tabs type="line"> <Tabs type="line">
<TabPane tab="项目信息" itemKey="1"> <TabPane tab="项目信息" itemKey="1">
<div style={{ display: "flex", justifyContent: "space-evenly" }}>
{list.map((item, index) => {
return (
<div <div
key={item.name}
style={{ style={{
width: 200, display: "flex",
margin: "12px 8px", justifyContent: "space-evenly",
}} }}
> >
{list.map((item, index) => {
return (
<div <div
style={{ style={{
lineHeight: "32px", lineHeight: "32px",
@ -163,25 +189,58 @@ function SideSheets(props) {
color: "#FFFFFF", color: "#FFFFFF",
borderRadius: 3, borderRadius: 3,
textAlign: "center", textAlign: "center",
width: 200,
margin: "12px 8px",
}} }}
key={item}
> >
<img <img
src={`/assets/images/background/projectIcon${index}.png`} src={`/assets/images/background/projectIcon${index}.png`}
style={{ marginRight: 10 }} style={{ marginRight: 10 }}
/> />
{item.name} {item}
</div>
<div style={styles}>{item.a}</div>
<div style={styles}>{item.b}</div>
<div style={styles}>{item.c}</div>
<div style={styles}>{item.d}</div>
</div> </div>
); );
})} })}
</div> </div>
<div
id="project_information"
style={{
height: document.body.clientHeight - 182,
// position: "relative",
}}
>
{nvrDetails
? nvrDetails.station.map((item, index) => {
return item.structure.projects.map((v, i) => {
return (
<div
key={v.name}
style={{
display: "flex",
justifyContent: "space-evenly",
}}
>
<div style={styles}>{v.name}</div>
<div style={styles}>{item.structure.name}</div>
<div style={styles}>{item.name}</div>
<div style={styles}>{item.factor.name}</div>
</div>
);
});
})
: ""}
</div>
</TabPane> </TabPane>
<TabPane tab="设备信息" itemKey="2"> <TabPane tab="设备信息" itemKey="2">
{(cameraSetup ? information.camera : information.nvr).map( <div
id="equipment_information"
style={{
height: document.body.clientHeight - 126,
}}
>
{nvrDetails
? (cameraSetup ? information.camera : information.nvr).map(
(item, index) => { (item, index) => {
let str = []; let str = [];
if (index > 0) { if (index > 0) {
@ -190,7 +249,11 @@ function SideSheets(props) {
src="/assets/images/background/straightline.png" src="/assets/images/background/straightline.png"
key={"img" + index} key={"img" + index}
alt="无法显示" alt="无法显示"
style={{ width: 872, display: "block", marginTop: 24 }} style={{
width: 872,
display: "block",
marginTop: 24,
}}
/> />
); );
} }
@ -231,7 +294,10 @@ function SideSheets(props) {
item.basics.map((item, index) => { item.basics.map((item, index) => {
if (item.difference == "line") { if (item.difference == "line") {
str.push( str.push(
<div key={"basics" + index} style={{ marginTop: 14 }}> <div
key={"basics" + index}
style={{ marginTop: 14 }}
>
<span <span
style={{ style={{
width: 150, width: 150,
@ -243,8 +309,10 @@ function SideSheets(props) {
> >
{item.name} {item.name}
</span> </span>
<span style={{ fontWeight: "600", color: " #34383E" }}> <span
{item.value} style={{ fontWeight: "600", color: " #34383E" }}
>
{nvrDetails[item.key]}
</span> </span>
</div> </div>
); );
@ -269,8 +337,23 @@ function SideSheets(props) {
> >
{item.name} {item.name}
</span> </span>
<span style={{ fontWeight: "600", color: " #34383E" }}> <span
{item.value} style={{ fontWeight: "600", color: " #34383E" }}
>
{item.key == "typ"
? accessType.find((v) => v.key == nvrDetails.type)
.name
: item.key == "venderId"
? venderList.find(
(v) => v.id == nvrDetails.venderId
).name
: item.key == "createUser"
? nvrDetails.createUser.namePresent
: item.key == "createTime"
? moment(nvrDetails.createTime).format(
"YYYY-MM-DD HH:MM:SS"
)
: nvrDetails[item.key]}
</span> </span>
</div> </div>
); );
@ -316,7 +399,9 @@ function SideSheets(props) {
{item.name} {item.name}
<img <img
src={`/assets/images/background/${ src={`/assets/images/background/${
clickStyle == item.name ? "copy2" : "copy1" clickStyle == item.name
? "copy2"
: "copy1"
}.png`} }.png`}
style={{ style={{
paddingBottom: 10, paddingBottom: 10,
@ -350,9 +435,12 @@ function SideSheets(props) {
{item.name} {item.name}
</span> </span>
<span <span
style={{ fontWeight: "600", color: " #34383E" }} style={{
fontWeight: "600",
color: " #34383E",
}}
> >
{item.value} {nvrDetails[item.key]}
</span> </span>
</div> </div>
); );
@ -363,7 +451,7 @@ function SideSheets(props) {
} }
/// ///
if (index == 2) { if (index == 2) {
(cameraSetup ? item.recovery : item.CameraInformation).map( (cameraSetup ? item.recovery : nvrDetails.camera).map(
(item, index) => { (item, index) => {
if (cameraSetup) { if (cameraSetup) {
str.push( str.push(
@ -389,7 +477,9 @@ function SideSheets(props) {
> >
<img <img
src={`/assets/images/background/${ src={`/assets/images/background/${
clickStyle == item.name ? "store2" : "store1" clickStyle == item.name
? "store2"
: "store1"
}.png`} }.png`}
style={{ margin: "20px 0 8px 0" }} style={{ margin: "20px 0 8px 0" }}
/> />
@ -397,7 +487,9 @@ function SideSheets(props) {
{item.name} {item.name}
<img <img
src={`/assets/images/background/${ src={`/assets/images/background/${
clickStyle == item.name ? "copy2" : "copy1" clickStyle == item.name
? "copy2"
: "copy1"
}.png`} }.png`}
style={{ style={{
paddingBottom: 10, paddingBottom: 10,
@ -439,14 +531,14 @@ function SideSheets(props) {
display: "inline-block", display: "inline-block",
}} }}
> >
{item.name} {item.channelName}
</div> </div>
</div> </div>
<p style={{ margin: "16px 0 0 30px " }}> <p style={{ margin: "16px 0 0 32px " }}>
{item.value1} {item.id}
</p> </p>
<p style={{ margin: "16px 0 20px 30px " }}> <p style={{ margin: "16px 0 20px 32px " }}>
{item.value2} {item.name}
</p> </p>
</div> </div>
); );
@ -458,11 +550,23 @@ function SideSheets(props) {
return str; return str;
} }
)} )
: ""}
</div>
</TabPane> </TabPane>
</Tabs> </Tabs>
</SideSheet> </SideSheet>
); );
} }
export default SideSheets; function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
global: global,
members: members.data,
};
}
export default connect(mapStateToProps)(SideSheets);

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

@ -1,14 +1,25 @@
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 { Button, Form, Input, Row, Table, Pagination } from "@douyinfe/semi-ui"; import moment from "moment";
import {
Button,
Form,
Input,
Row,
Table,
Pagination,
Popover,
Tag,
} from "@douyinfe/semi-ui";
import "../style.less"; import "../style.less";
import CameraModal from "../components/cameraModal"; import CameraModal from "../components/cameraModal";
import NvrModal from "../components/nvrModal"; import NvrModal from "../components/nvrModal";
import Setup from "../components/setup"; import Setup from "../components/setup";
import SideSheets from "../components/sideSheet"; import SideSheets from "../components/sideSheet";
import { accessType } from "./nvr";
const CameraHeader = (props) => { const CameraHeader = (props) => {
const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props; const { dispatch, actions, user, loading, equipmentWarehouseCamera } = props;
const [cameraModal, setCameraModal] = useState(false); const [cameraModal, setCameraModal] = useState(false);
const [modalName, setModalName] = useState(""); const [modalName, setModalName] = useState("");
const [setup, setSetup] = useState(false); const [setup, setSetup] = useState(false);
@ -16,7 +27,10 @@ const CameraHeader = (props) => {
const [cameraSetup, setcameraSetup] = useState(false); const [cameraSetup, setcameraSetup] = useState(false);
const [setupp, setSetupp] = useState([]); const [setupp, setSetupp] = useState([]);
const [venderList, setvenderList] = useState([]); // const [venderList, setvenderList] = useState([]); //
const [query, setQuery] = useState({ limit: 10, page: 0 }); const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); //
const [rowId, setRowId] = useState(); //id
const { equipmentWarehouse } = actions; const { equipmentWarehouse } = actions;
const api = useRef(); const api = useRef();
const CAMERAS = "cameras"; const CAMERAS = "cameras";
@ -24,6 +38,7 @@ const CameraHeader = (props) => {
useEffect(() => { useEffect(() => {
dispatch(actions.equipmentWarehouse.getVender()).then((res) => { dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data); setvenderList(res.payload.data);
attribute(res.payload.data);
}); });
// //
localStorage.getItem(CAMERAS) == null localStorage.getItem(CAMERAS) == null
@ -32,16 +47,17 @@ const CameraHeader = (props) => {
JSON.stringify(["state", "type", "manufactor"]) JSON.stringify(["state", "type", "manufactor"])
) )
: ""; : "";
attribute(); console.log(equipmentWarehouseCamera);
}, []); }, []);
useEffect(() => { useEffect(() => {
equipmentGetNvr(); equipmentGetCamera();
}, [query]); }, [query, search]);
function equipmentGetNvr() { function equipmentGetCamera() {
dispatch(equipmentWarehouse.getNvr(query)); dispatch(equipmentWarehouse.getCamera({ ...query, ...search }));
} }
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
@ -76,7 +92,6 @@ 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 theme="borderless"> <Button theme="borderless">
@ -94,12 +109,27 @@ const CameraHeader = (props) => {
onClick={() => { onClick={() => {
setSideSheet(true); setSideSheet(true);
setcameraSetup(true); setcameraSetup(true);
setRowId(row.id);
console.log(row.id);
}} }}
> >
查看 查看
</Button> </Button>
<Button theme="borderless">播放</Button> <Button theme="borderless">播放</Button>
<Button theme="borderless">禁用</Button> <Button
theme="borderless"
onClick={() => {
console.log(row.id, !row.forbidden);
dispatch(
equipmentWarehouse.putForbidden({
cameraId: row.id,
forbidden: !row.forbidden,
})
);
}}
>
{row.forbidden ? "启用" : "禁用"}
</Button>
<Button <Button
theme="borderless" theme="borderless"
onClick={() => { onClick={() => {
@ -116,7 +146,7 @@ const CameraHeader = (props) => {
]; ];
// //
function attribute() { function attribute(data) {
const arr = localStorage.getItem(CAMERAS) const arr = localStorage.getItem(CAMERAS)
? JSON.parse(localStorage.getItem(CAMERAS)) ? JSON.parse(localStorage.getItem(CAMERAS))
: []; : [];
@ -126,11 +156,19 @@ const CameraHeader = (props) => {
title: "设备厂家", title: "设备厂家",
dataIndex: "venderId", dataIndex: "venderId",
key: "manufactor", key: "manufactor",
render: (_, r, index) => {
let manufactorName = data.find((item) => item.id == r.venderId);
return manufactorName ? manufactorName.name : "";
},
}, },
{ {
title: "接入类型", title: "接入类型",
dataIndex: "createUserId", dataIndex: "cameraAbility.type",
key: "type", key: "type",
render: (_, r, index) => {
let manufactorName = data.find((item) => item.id == r.venderId);
return manufactorName ? manufactorName.name : "";
},
}, },
{ {
title: "设备状态", title: "设备状态",
@ -144,13 +182,16 @@ const CameraHeader = (props) => {
}, },
{ {
title: "内存卡信息", title: "内存卡信息",
dataIndex: "size", dataIndex: "memoryCard",
key: "memoryCard", key: "memoryCard",
}, },
{ {
title: "设备创建时间", title: "设备创建时间",
dataIndex: "createTime", dataIndex: "createTime",
key: "time", key: "time",
render: (text, r, index) => {
return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS");
},
}, },
{ {
title: "设备添加账号", title: "设备添加账号",
@ -161,26 +202,57 @@ const CameraHeader = (props) => {
title: "项目名称", title: "项目名称",
dataIndex: "updateTime", dataIndex: "updateTime",
key: "name", key: "name",
render: (_, r, index) => {
return r.station.map((item, index) =>
station(
item.structure.projects[0].name,
item.structure.projects,
"name"
)
);
},
}, },
{ {
title: "pcode", title: "pcode",
dataIndex: "updateTime", dataIndex: "updateTime",
key: "pcode", key: "pcode",
render: (_, r, index) => {
return r.station.map((item, index) =>
station(
item.structure.projects[0].url,
item.structure.projects,
"url"
)
);
},
}, },
{ {
title: "结构物", title: "结构物",
dataIndex: "updateTime", dataIndex: "updateTime",
key: "structure", key: "structure",
render: (_, r, index) => {
return station(
r.station[0].structure.name,
r.station,
"structure.name"
);
},
}, },
{ {
title: "测点", title: "测点",
dataIndex: "updateTime", dataIndex: "updateTime",
key: "measuringPoint", key: "measuringPoint",
render: (_, r, index) => {
return station(r.station[0].name, r.station, "name");
},
}, },
{ {
title: "监测因素", title: "监测因素",
dataIndex: "updateTime", dataIndex: "updateTime",
key: "factor", key: "factor",
render: (_, r, index) => {
return station(r.station[0].factor.name, r.station, "factor.name");
},
}, },
]; ];
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
@ -192,6 +264,41 @@ const CameraHeader = (props) => {
setSetupp(columns); setSetupp(columns);
} }
//station
function station(first, whole, name) {
return (
<Popover
key="updateTime"
position="top"
content={
<article style={{ padding: 12 }}>
{whole.map((v, index) => {
let names = "";
switch (name) {
case "name":
names = v[name];
break;
case "url":
names = v[name];
break;
case "structure.name":
names = v.structure.name;
break;
case "factor.name":
names = v.factor.name;
break;
default:
break;
}
return <div key={index}>{names}</div>;
})}
</article>
}
>
<Tag>{first}...</Tag>
</Popover>
);
}
// //
const screen = { const screen = {
width: 193, width: 193,
@ -286,7 +393,7 @@ const CameraHeader = (props) => {
> >
<Form.Input <Form.Input
label="设备搜索:" label="设备搜索:"
field="name" field="keyword"
placeholder="请输入设备名称" placeholder="请输入设备名称"
labelPosition="left" labelPosition="left"
style={screen} style={screen}
@ -294,9 +401,10 @@ const CameraHeader = (props) => {
<Form.Select <Form.Select
label="接入类型:" label="接入类型:"
labelPosition="left" labelPosition="left"
field="type1" field="type"
style={screen} style={screen}
placeholder="全部" placeholder="全部"
showClear
> >
<Form.Select.Option value="12">111</Form.Select.Option> <Form.Select.Option value="12">111</Form.Select.Option>
<Form.Select.Option value="11">111111</Form.Select.Option> <Form.Select.Option value="11">111111</Form.Select.Option>
@ -307,6 +415,7 @@ const CameraHeader = (props) => {
style={screen} style={screen}
field="venderId" field="venderId"
placeholder="全部" placeholder="全部"
showClear
> >
{venderList.map((item) => { {venderList.map((item) => {
return ( return (
@ -322,6 +431,7 @@ const CameraHeader = (props) => {
field="type2" field="type2"
style={screen} style={screen}
placeholder="全部" placeholder="全部"
showClear
> >
<Form.Select.Option value="yes">在线</Form.Select.Option> <Form.Select.Option value="yes">在线</Form.Select.Option>
<Form.Select.Option value="no">离线</Form.Select.Option> <Form.Select.Option value="no">离线</Form.Select.Option>
@ -332,6 +442,7 @@ const CameraHeader = (props) => {
field="type3" field="type3"
style={screen} style={screen}
placeholder="全部" placeholder="全部"
showClear
> >
<Form.Select.Option value="智慧环保"> <Form.Select.Option value="智慧环保">
飞尚科技1 飞尚科技1
@ -360,19 +471,10 @@ const CameraHeader = (props) => {
marginRight: 20, marginRight: 20,
}} }}
onClick={() => { onClick={() => {
api.current.validate().then((values) => { api.current.validate().then((v) => {
console.log(values); setearch(v);
console.log(
equipmentWarehouseNvr.data.filter((item) => {
return (
item.name.indexOf(values.name) > -1 &&
item.venderId === values.venderId
);
// return item.venderId === values.venderId;
})
);
}); });
console.log(equipmentWarehouseNvr.data); equipmentGetCamera();
}} }}
> >
搜素 搜素
@ -453,7 +555,7 @@ const CameraHeader = (props) => {
</div> </div>
<Table <Table
columns={setupp} columns={setupp}
dataSource={equipmentWarehouseNvr.data} dataSource={equipmentWarehouseCamera.data}
bordered={false} bordered={false}
empty="暂无数据" empty="暂无数据"
style={{ style={{
@ -469,11 +571,11 @@ const CameraHeader = (props) => {
}} }}
> >
<span style={{ lineHeight: "30px" }}> <span style={{ lineHeight: "30px" }}>
{equipmentWarehouseNvr.total}个设备 {equipmentWarehouseCamera.total}个设备
</span> </span>
<Pagination <Pagination
className="22" className="22"
total={equipmentWarehouseNvr.total} total={equipmentWarehouseCamera.total}
showSizeChanger showSizeChanger
currentPage={query.page + 1} currentPage={query.page + 1}
pageSizeOpts={[10, 20, 30, 40]} pageSizeOpts={[10, 20, 30, 40]}
@ -490,7 +592,7 @@ const CameraHeader = (props) => {
cameraSetup={cameraSetup} cameraSetup={cameraSetup}
close={() => { close={() => {
setSetup(false); setSetup(false);
attribute(); attribute(venderList);
setcameraSetup(false); setcameraSetup(false);
}} }}
/> />
@ -501,6 +603,9 @@ const CameraHeader = (props) => {
{sideSheet ? ( {sideSheet ? (
<SideSheets <SideSheets
visible={true} visible={true}
rowId={rowId}
venderList={venderList}
accessType={accessType}
cameraSetup={cameraSetup} cameraSetup={cameraSetup}
close={() => { close={() => {
setSideSheet(false); setSideSheet(false);
@ -529,13 +634,13 @@ const CameraHeader = (props) => {
}; };
function mapStateToProps(state) { function mapStateToProps(state) {
const { auth, global, members, equipmentWarehouseNvr } = state; const { auth, global, members, equipmentWarehouseCamera } = state;
return { return {
loading: members.isRequesting, loading: members.isRequesting,
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
members: members.data, members: members.data,
equipmentWarehouseNvr: equipmentWarehouseNvr.data || [], equipmentWarehouseCamera: equipmentWarehouseCamera.data || [],
}; };
} }

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

@ -7,6 +7,13 @@ import NvrModal from "../components/nvrModal";
import Setup from "../components/setup"; import Setup from "../components/setup";
import SideSheets from "../components/sideSheet"; import SideSheets from "../components/sideSheet";
export const accessType = [
{ name: "萤石", key: "yingshi" },
{ name: "NVR摄像头", key: "nvr" },
{ name: "IPC 网络摄像头", key: "ipc" },
{ name: "级联摄像头", key: "cascade" },
];
const NvrHeader = (props) => { const NvrHeader = (props) => {
const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props; const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props;
const { equipmentWarehouse } = actions; const { equipmentWarehouse } = actions;
@ -14,27 +21,33 @@ const NvrHeader = (props) => {
const [sideSheet, setSideSheet] = useState(false); const [sideSheet, setSideSheet] = useState(false);
const [setupp, setSetupp] = useState([]); const [setupp, setSetupp] = useState([]);
const [venderList, setvenderList] = useState([]); // const [venderList, setvenderList] = useState([]); //
const [query, setQuery] = useState({ limit: 10, page: 0 }); const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); //
const [rowId, setRowId] = useState(); //id
const api = useRef(); const api = useRef();
const SETUPS = "setups"; const SETUPS = "setups";
useEffect(() => { useEffect(() => {
dispatch(actions.equipmentWarehouse.getVender()).then((res) => { dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data); setvenderList(res.payload.data);
attribute(res.payload.data);
}); });
// //
localStorage.getItem(SETUPS) == null localStorage.getItem(SETUPS) == null
? localStorage.setItem(SETUPS, JSON.stringify(["a", "c", "d", "e"])) ? localStorage.setItem(
SETUPS,
JSON.stringify(["manufactor", "passageway", "port", "state"])
)
: ""; : "";
// ; // ;
attribute();
}, []); }, []);
useEffect(() => { useEffect(() => {
equipmentGetNvr(); equipmentGetNvr();
}, [query]); }, [query, search]);
function equipmentGetNvr() { function equipmentGetNvr() {
dispatch(equipmentWarehouse.getNvr(query)); dispatch(equipmentWarehouse.getNvr({ ...query, ...search }));
} }
const columns = [ const columns = [
{ {
@ -46,12 +59,12 @@ const NvrHeader = (props) => {
{ {
title: "设备名称", title: "设备名称",
dataIndex: "name", dataIndex: "name",
render: (text, record, index) => { render: (text, r, index) => {
return ( return (
<div> <div>
<span <span
style={{ style={{
backgroundColor: record.avatarBg, backgroundColor: r.avatarBg,
width: "10px", width: "10px",
height: "10px", height: "10px",
borderRadius: "50%", borderRadius: "50%",
@ -59,7 +72,7 @@ const NvrHeader = (props) => {
marginRight: "10px", marginRight: "10px",
}} }}
/> />
{record.name} {r.name}
</div> </div>
); );
}, },
@ -73,7 +86,6 @@ const NvrHeader = (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 theme="borderless"> <Button theme="borderless">
@ -90,6 +102,7 @@ const NvrHeader = (props) => {
theme="borderless" theme="borderless"
onClick={() => { onClick={() => {
setSideSheet(true); setSideSheet(true);
setRowId(row.id);
}} }}
> >
查看 查看
@ -110,7 +123,7 @@ const NvrHeader = (props) => {
]; ];
// //
function attribute() { function attribute(data) {
const arr = localStorage.getItem(SETUPS) const arr = localStorage.getItem(SETUPS)
? JSON.parse(localStorage.getItem(SETUPS)) ? JSON.parse(localStorage.getItem(SETUPS))
: []; : [];
@ -119,50 +132,54 @@ const NvrHeader = (props) => {
{ {
title: "设备厂家", title: "设备厂家",
dataIndex: "venderId", dataIndex: "venderId",
key: "a", key: "manufactor",
render: (_, r, index) => {
let manufactorName = data.find((item) => item.id == r.venderId);
return manufactorName ? manufactorName.name : "";
},
}, },
{ {
title: "添加账号", title: "添加账号",
dataIndex: "createUserId", dataIndex: "createUserId",
key: "b", key: "accountNumber",
}, },
{ {
title: "通道数", title: "通道数",
dataIndex: "channelCount", dataIndex: "channelCount",
key: "c", key: "passageway",
}, },
{ {
title: "端口", title: "端口",
dataIndex: "port", dataIndex: "port",
key: "d", key: "port",
}, },
{ {
title: "设备状态", title: "设备状态",
dataIndex: "size", dataIndex: "size",
key: "e", key: "state",
}, },
{ {
title: "创建时间", title: "创建时间",
dataIndex: "createTime", dataIndex: "createTime",
key: "f", key: "time",
render: (text, r, index) => { render: (text, r, index) => {
return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS"); return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS");
}, },
}, },
{ {
title: "项目名称", title: "项目名称",
dataIndex: "size", dataIndex: "",
key: "g", key: "name",
}, },
{ {
title: "things名称", title: "pcode",
dataIndex: "updateTime", dataIndex: "",
key: "h", key: "pcode",
}, },
{ {
title: "things数量", title: "结构物",
dataIndex: "updateTime", dataIndex: "",
key: "i", key: "structure",
}, },
]; ];
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
@ -269,7 +286,7 @@ const NvrHeader = (props) => {
> >
<Form.Input <Form.Input
label="设备搜索:" label="设备搜索:"
field="name" field="keyword"
placeholder="请输入设备名称" placeholder="请输入设备名称"
labelPosition="left" labelPosition="left"
style={screen} style={screen}
@ -280,6 +297,7 @@ const NvrHeader = (props) => {
style={screen} style={screen}
field="venderId" field="venderId"
placeholder="全部" placeholder="全部"
showClear
> >
{venderList.map((item) => { {venderList.map((item) => {
return ( return (
@ -295,6 +313,7 @@ const NvrHeader = (props) => {
field="type2" field="type2"
style={screen} style={screen}
placeholder="全部" placeholder="全部"
showClear
> >
<Form.Select.Option value="yes">在线</Form.Select.Option> <Form.Select.Option value="yes">在线</Form.Select.Option>
<Form.Select.Option value="no">离线</Form.Select.Option> <Form.Select.Option value="no">离线</Form.Select.Option>
@ -305,6 +324,7 @@ const NvrHeader = (props) => {
field="type3" field="type3"
style={screen} style={screen}
placeholder="全部" placeholder="全部"
showClear
> >
<Form.Select.Option value="智慧环保"> <Form.Select.Option value="智慧环保">
飞尚科技1 飞尚科技1
@ -333,18 +353,10 @@ const NvrHeader = (props) => {
marginRight: 20, marginRight: 20,
}} }}
onClick={() => { onClick={() => {
api.current.validate().then((values) => { api.current.validate().then((v) => {
console.log(values); setearch(v);
console.log(
equipmentWarehouseNvr.data.filter((item) => {
return (
item.name.indexOf(values.name) > -1 &&
item.venderId === values.venderId
);
})
);
}); });
console.log(equipmentWarehouseNvr.data); equipmentGetNvr();
}} }}
> >
搜素 搜素
@ -459,7 +471,7 @@ const NvrHeader = (props) => {
SETUPS={SETUPS} SETUPS={SETUPS}
close={() => { close={() => {
setSetup(false); setSetup(false);
attribute(); attribute(venderList);
}} }}
/> />
) : ( ) : (
@ -469,6 +481,9 @@ const NvrHeader = (props) => {
{sideSheet ? ( {sideSheet ? (
<SideSheets <SideSheets
visible={true} visible={true}
rowId={rowId}
accessType={accessType}
venderList={venderList}
close={() => { close={() => {
setSideSheet(false); setSideSheet(false);
}} }}
@ -481,6 +496,7 @@ const NvrHeader = (props) => {
); );
}; };
function mapStateToProps(state) { function mapStateToProps(state) {
const { auth, global, members, equipmentWarehouseNvr } = state; const { auth, global, members, equipmentWarehouseNvr } = state;
return { return {

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

@ -13,6 +13,12 @@ export const ApiTable = {
getVender:'vender', getVender:'vender',
nvr:'nvr', nvr:'nvr',
delNvr:'nvr/{nvrId}', delNvr:'nvr/{nvrId}',
getNvrDetails:'nvr/detail/{nvrId}', //获取nvr详情
getCamera:"camera/project", // 获取摄像头列表
putForbidden:"camera/banned", //禁用摄像头
getCameraDetails:"camera/{cameraId}/detail", //获取摄像头详情
}; };
export const RouteTable = { export const RouteTable = {

Loading…
Cancel
Save