From 6915209046d95ae4f2e88a4997a746917a638213 Mon Sep 17 00:00:00 2001
From: deartibers <947466799@qq.com>
Date: Tue, 12 Jul 2022 15:08:21 +0800
Subject: [PATCH 1/8] =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=A0=81=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E5=92=8C=E4=BF=A1=E9=B8=BD=E6=9C=8D=E5=8A=A1=E4=B8=BB?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/sections/offline/components/setup.jsx | 138 ++++
.../offline/containers/carrierpigeon.jsx | 598 +++++++++++++++++-
.../offline/containers/statuscode.jsx | 597 ++++++++++++++++-
3 files changed, 1309 insertions(+), 24 deletions(-)
create mode 100644 code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx
new file mode 100644
index 0000000..99ddc86
--- /dev/null
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx
@@ -0,0 +1,138 @@
+import React, { useState, useEffect } from "react";
+import {
+ Modal,
+ CheckboxGroup,
+ Checkbox,
+} from "@douyinfe/semi-ui";
+
+function Setup(props) {
+ const {
+ visible,
+ close,
+ CODE,//错误码
+ PIGEON,//信鸽
+ pigeonSetup,
+ } = props;
+ const [check, setCheck] = useState([]);
+
+ const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" };
+
+ useEffect(() => {
+ //获取是否勾选信息
+ const codeItem = localStorage.getItem(CODE);
+ const pigeonItem = localStorage.getItem(PIGEON);
+ if (pigeonSetup) {
+ setCheck(pigeonItem ? JSON.parse(pigeonItem) : []);
+ } else {
+ setCheck(codeItem ? JSON.parse(codeItem) : []);
+ }
+ ischeck();
+ }, []);
+
+ const equipmentCode = [//状态码管理
+ { name: "常规解决方案", value: "manufactor" },
+ { name: "状态频率", value: "accountNumber" },
+ ];
+ const equipmentCarrierpigeon = [//信鸽服务
+ { name: "策略类型", value: "manufactor" },
+ { name: "推送机制", value: "type" },
+ { name: "监听设备数量", value: "state" },
+ { name: "累计推送次数", value: "support" },
+ ];
+
+ function ischeck(value) {
+ if (check.length >= 8) {
+ if (check.includes(value)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ return (
+
+ 表格属性设置
+
+ {check.length}/8
+
+
+ }
+ visible={visible}
+ style={{ width: 600 }}
+ onOk={() => {
+ pigeonSetup
+ ? localStorage.setItem(PIGEON, JSON.stringify(check))
+ : localStorage.setItem(CODE, JSON.stringify(check));
+ close();
+ }}
+ onCancel={() => {
+ close();
+ }}
+ >
+ {
+ setCheck(check);
+ ischeck();
+ }}
+ >
+
+
+ {pigeonSetup?'推送信息':'状态码信息'}
+
+
+ {(pigeonSetup ? equipmentCarrierpigeon : equipmentCode).map((item) => {
+ return (
+
+ {item.name}
+
+ );
+ })}
+
+
+
+
+ );
+}
+
+export default Setup;
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
index 695cb73..e86ffea 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
@@ -1,20 +1,594 @@
-import React, { useEffect } from 'react';
-import { connect } from 'react-redux';
-import { Coming } from '$components'
-import '../style.less'
+import React, { useState, useEffect, useRef } from "react";
+import { connect } from "react-redux";
+import moment from "moment";
+import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, } from "@douyinfe/semi-ui";
+import "../style.less";
+import { ApiTable } from "$utils";
+import Setup from "../components/setup";
+// import SideSheets from "../components/sideSheet";
+// import { skeletonScreen } from "../components/skeletonScreen";
+// import { ReminderBox } from "../../../components/index";
+
+export const accessType = [
+ { name: "萤石云", key: "yingshi" },
+ { name: "NVR", key: "nvr" },
+ { name: "IPC", key: "ipc" },
+ { name: "级联", key: "cascade" },
+];
const Carrierpigeon = (props) => {
+ const { history, dispatch, actions, user, loading, equipmentWarehouseNvr } = props;
+ const { equipmentWarehouse } = actions;
+ const [setup, setSetup] = useState(false);
+ const [sideSheet, setSideSheet] = useState(false);
+ const [setupp, setSetupp] = useState([]);
+ const [venderList, setvenderList] = useState([]); //厂商信息
+ 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 searchData = useRef(search)
+ const limits = useRef(); //每页实际条数
+ const page = useRef(query.page);
+ const PIGEON = "pigeon";
+ const USER = "user" + props.user.id
+ const nvrRef = useRef(); //获取子组件的设备编号
- return (
-
- )
-}
+ useEffect(() => {
+ dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
+ setvenderList(res.payload.data);
+ attribute(res.payload.data);
+ });
+ //初始化表格显示设置
+ localStorage.getItem(PIGEON) == null
+ ? localStorage.setItem(
+ PIGEON,
+ JSON.stringify(["manufactor", "type","state","support"])
+ )
+ : "";
+ }, []);
+
+ useEffect(() => {
+ equipmentGetNvr();
+ }, [query, search]);
+
+ const equipmentGetNvr = () => {
+ searchData.current = { ...query, ...search }
+ dispatch(equipmentWarehouse.getNvr(searchData.current)).then((res) => {
+ limits.current = res.payload.data.data.length
+ });
+ }
+
+ 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 = [
+ {
+ title: "序号",
+ render: (_, record, index) => {
+ return index + 1;
+ },
+ },
+ {
+ title: "设备名称",
+ dataIndex: "name",
+ render: (_, r, index) => {
+ console.log(r);
+ return r.name
+ },
+ },
+ {
+ title: "SIP地址",
+ dataIndex: "owner",
+ render: (_, r, index) => {
+ return r?.gbNvr?.sipip
+ },
+ },
+ {
+ title: "操作",
+ width: "20%",
+ dataIndex: "",
+ render: (_, row) => {
+ return (
+
+
+
+
{
+ dispatch(equipmentWarehouse.delNvr(row.id)).then(() => {
+ if (page.current > 0 && limits.current < 2) {
+ setQuery({ limit: 10, page: page.current - 1 })
+ } else {
+ setQuery({ limit: 10, page: page.current })
+ }
+ });
+ }}
+ >
+
+
+
+ );
+ },
+ },
+ ];
+
+ //获取表格属性设置
+ function attribute (data) {
+ const arr = localStorage.getItem(PIGEON)
+ ? JSON.parse(localStorage.getItem(PIGEON))
+ : [];
+
+ const column = [
+ {
+ title: "设备厂家",
+ dataIndex: "venderId",
+ key: "manufactor",
+ render: (_, r, index) => {
+ let manufactorName = data.find((item) => item.id == r.venderId);
+ return manufactorName ? manufactorName.name : "";
+ },
+ },
+ {
+ title: "添加账号",
+ dataIndex: "createUserId",
+ key: "accountNumber",
+ render: (_, r, index) => {
+ return r?.createUser?.name
+ },
+ },
+ {
+ title: "通道数",
+ dataIndex: "channelCount",
+ key: "passageway",
+ },
+ {
+ title: "端口",
+ dataIndex: "port",
+ key: "port",
+ },
+ {
+ title: "设备状态",
+ dataIndex: "size",
+ key: "state",
+ render: (_, r, index) => {
+ let status = r.gbNvr;
+ return (
+
+
+ {status ? equipmentStatus(status.online) : ""}
+
+ );
+ },
+ },
+ {
+ title: "创建时间",
+ dataIndex: "createTime",
+ key: "time",
+ render: (_, r, index) => {
+ return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS");
+ },
+ },
+ {
+ title: "项目名称",
+ dataIndex: "",
+ key: "name",
+ render: (_, r, index) => {
+ return r.station.length == 0
+ ? ""
+ : station(r, "name", "projects")
+ },
+ },
+ {
+ title: "pcode",
+ dataIndex: "",
+ key: "pcode",
+ render: (_, r, index) => {
+ return r.station.length == 0
+ ? ""
+ : station(r, "url", "projects")
+ },
+ },
+ {
+ title: "结构物",
+ dataIndex: "",
+ key: "structure",
+ render: (_, r, index) => {
+ return r.station.length == 0
+ ? ""
+ : station(r, "name")
+ },
+ },
+ ];
+ for (let i = 0; i < arr.length; i++) {
+ let colum = column.filter((item) => {
+ return item.key === arr[i];
+ });
+ columns.splice(i + 2, 0, colum[0]);
+ }
+ setSetupp(columns);
+ }
+
+ //表格请求数据中station属性数据的展示
+ function station (r, name, projects) {
+ let data = []
+ if (projects == "projects") {
+ r.station.map((v) => {
+ if (v.structure.projects.length > 0) {
+ v.structure.projects.map((item) => data.push(item[name]))
+ }
+ })
+ } else {
+ r.station.map((v, index) => data.push(v.structure[name]))
+ }
+ let dataSet = [...(new Set(data))]
+ return dataSet.length > 0 ? 1 ? {dataSet.map((v, index) => {v}
)} : ""
+ }
+ >
+ {dataSet.length > 1 ? `${dataSet[0]}...` : dataSet.length > 0 ? dataSet[0] : ""}
+ : ""
+
+ }
+
+ //条件赛选样式
+ const screen = {
+ width: 193,
+ marginRight: 20,
+ marginBottom: 16,
+ color: "rgba(0, 0, 0, 0.65)",
+ };
+
+ return (
+ <>
+
+
+
+
+ 信鸽服务
+
+
+ 对设备状态变更进行监听,通过短信或邮件通知指定人员
+
+
+ 创建推送
+ {/* {
+ const remind = localStorage.getItem(USER);
+ console.log(remind)
+ if (!remind) {
+ setReminder(true)
+ }
+ equipmentGetNvr();
+ }}
+ /> */}
+
+
+
+
+
+ 筛选条件
+
+
+
+
+ 全部
+ 短信通知
+ 邮件通知
+
+
+
+
+
+
+
+
+
+
+
+ 策略详情
+
+
+
+
+
+
+ s)}
+ dataSource={equipmentWarehouseNvr.data}
+ bordered={false}
+ empty="暂无数据"
+ style={{
+ padding: "0px 20px",
+ }}
+ pagination={false}
+ />
+
+
+
+
+ 共{equipmentWarehouseNvr.total}个设备
+
+
{
+ setQuery({ limit: pageSize, page: currentPage - 1 });
+ page.current = currentPage - 1
+ }}
+ />
+
+
+ {setup ? (
+ {
+ setSetup(false);
+ attribute(venderList);
+ }}
+ />
+ ) : (
+ ""
+ )}
+
+ {/* {sideSheet ? (
+ {
+ setSideSheet(false);
+ }}
+ />
+ ) : (
+ []
+ )} */}
+ {/* {
+ history.push({ pathname: '/equipmentWarehouse/camera', query: { addNvr: true, serialNo: nvrRef.current.nvrNumber() } });
+ localStorage.setItem('vcmp_selected_sider', JSON.stringify("camera"))
+ setReminder(false)
+ }}
+ close={() => {
+ setReminder(false)
+ }}
+ /> */}
+
+ >
+ );
+};
function mapStateToProps (state) {
- const { auth } = state;
- return {
- user: auth.user,
- };
+ const { auth, global, members, equipmentWarehouseNvr } = state;
+ return {
+ loading: equipmentWarehouseNvr.isRequesting && !equipmentWarehouseNvr.data,
+ user: auth.user,
+ actions: global.actions,
+ members: members.data,
+ equipmentWarehouseNvr: equipmentWarehouseNvr.data || {},
+ };
}
export default connect(mapStateToProps)(Carrierpigeon);
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx
index 7117612..eeb8b53 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx
@@ -1,20 +1,593 @@
-import React, { useEffect } from 'react';
-import { connect } from 'react-redux';
-import { Coming } from '$components'
-import '../style.less'
+import React, { useState, useEffect, useRef } from "react";
+import { connect } from "react-redux";
+import moment from "moment";
+import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, } from "@douyinfe/semi-ui";
+import "../style.less";
+import { ApiTable } from "$utils";
+import Setup from "../components/setup";
+// import SideSheets from "../components/sideSheet";
+// import { skeletonScreen } from "../components/skeletonScreen";
+// import { ReminderBox } from "../../../components/index";
+
+export const accessType = [
+ { name: "萤石云", key: "yingshi" },
+ { name: "NVR", key: "nvr" },
+ { name: "IPC", key: "ipc" },
+ { name: "级联", key: "cascade" },
+];
const Statuscode = (props) => {
+ const { history, dispatch, actions, user, loading, equipmentWarehouseNvr } = props;
+ const { equipmentWarehouse } = actions;
+ const [setup, setSetup] = useState(false);
+ const [sideSheet, setSideSheet] = useState(false);
+ const [setupp, setSetupp] = useState([]);
+ const [venderList, setvenderList] = useState([]); //厂商信息
+ 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 searchData = useRef(search)
+ const limits = useRef(); //每页实际条数
+ const page = useRef(query.page);
+ const CODE = "code";
+ const USER = "user" + props.user.id
+ const nvrRef = useRef(); //获取子组件的设备编号
- return (
-
- )
-}
+ useEffect(() => {
+ dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
+ setvenderList(res.payload.data);
+ attribute(res.payload.data);
+ });
+ //初始化表格显示设置
+ localStorage.getItem(CODE) == null
+ ? localStorage.setItem(
+ CODE,
+ JSON.stringify(["manufactor", "accountNumber"])
+ )
+ : "";
+ }, []);
+
+ useEffect(() => {
+ equipmentGetNvr();
+ }, [query, search]);
+
+ const equipmentGetNvr = () => {
+ searchData.current = { ...query, ...search }
+ dispatch(equipmentWarehouse.getNvr(searchData.current)).then((res) => {
+ limits.current = res.payload.data.data.length
+ });
+ }
+
+ 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 = [
+ {
+ title: "序号",
+ render: (_, record, index) => {
+ return index + 1;
+ },
+ },
+ {
+ title: "设备名称",
+ dataIndex: "name",
+ render: (_, r, index) => {
+ console.log(r);
+ return r.name
+ },
+ },
+ {
+ title: "SIP地址",
+ dataIndex: "owner",
+ render: (_, r, index) => {
+ return r?.gbNvr?.sipip
+ },
+ },
+ {
+ title: "操作",
+ width: "20%",
+ dataIndex: "",
+ render: (_, row) => {
+ return (
+
+
+
+
{
+ dispatch(equipmentWarehouse.delNvr(row.id)).then(() => {
+ if (page.current > 0 && limits.current < 2) {
+ setQuery({ limit: 10, page: page.current - 1 })
+ } else {
+ setQuery({ limit: 10, page: page.current })
+ }
+ });
+ }}
+ >
+
+
+
+ );
+ },
+ },
+ ];
+
+ //获取表格属性设置
+ function attribute (data) {
+ const arr = localStorage.getItem(CODE)
+ ? JSON.parse(localStorage.getItem(CODE))
+ : [];
+
+ const column = [
+ {
+ title: "设备厂家",
+ dataIndex: "venderId",
+ key: "manufactor",
+ render: (_, r, index) => {
+ let manufactorName = data.find((item) => item.id == r.venderId);
+ return manufactorName ? manufactorName.name : "";
+ },
+ },
+ {
+ title: "添加账号",
+ dataIndex: "createUserId",
+ key: "accountNumber",
+ render: (_, r, index) => {
+ return r?.createUser?.name
+ },
+ },
+ {
+ title: "通道数",
+ dataIndex: "channelCount",
+ key: "passageway",
+ },
+ {
+ title: "端口",
+ dataIndex: "port",
+ key: "port",
+ },
+ {
+ title: "设备状态",
+ dataIndex: "size",
+ key: "state",
+ render: (_, r, index) => {
+ let status = r.gbNvr;
+ return (
+
+
+ {status ? equipmentStatus(status.online) : ""}
+
+ );
+ },
+ },
+ {
+ title: "创建时间",
+ dataIndex: "createTime",
+ key: "time",
+ render: (_, r, index) => {
+ return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS");
+ },
+ },
+ {
+ title: "项目名称",
+ dataIndex: "",
+ key: "name",
+ render: (_, r, index) => {
+ return r.station.length == 0
+ ? ""
+ : station(r, "name", "projects")
+ },
+ },
+ {
+ title: "pcode",
+ dataIndex: "",
+ key: "pcode",
+ render: (_, r, index) => {
+ return r.station.length == 0
+ ? ""
+ : station(r, "url", "projects")
+ },
+ },
+ {
+ title: "结构物",
+ dataIndex: "",
+ key: "structure",
+ render: (_, r, index) => {
+ return r.station.length == 0
+ ? ""
+ : station(r, "name")
+ },
+ },
+ ];
+ for (let i = 0; i < arr.length; i++) {
+ let colum = column.filter((item) => {
+ return item.key === arr[i];
+ });
+ columns.splice(i + 2, 0, colum[0]);
+ }
+ setSetupp(columns);
+ }
+
+ //表格请求数据中station属性数据的展示
+ function station (r, name, projects) {
+ let data = []
+ if (projects == "projects") {
+ r.station.map((v) => {
+ if (v.structure.projects.length > 0) {
+ v.structure.projects.map((item) => data.push(item[name]))
+ }
+ })
+ } else {
+ r.station.map((v, index) => data.push(v.structure[name]))
+ }
+ let dataSet = [...(new Set(data))]
+ return dataSet.length > 0 ? 1 ? {dataSet.map((v, index) => {v}
)} : ""
+ }
+ >
+ {dataSet.length > 1 ? `${dataSet[0]}...` : dataSet.length > 0 ? dataSet[0] : ""}
+ : ""
+
+ }
+
+ //条件赛选样式
+ const screen = {
+ width: 193,
+ marginRight: 20,
+ marginBottom: 16,
+ color: "rgba(0, 0, 0, 0.65)",
+ };
+
+ return (
+ <>
+
+
+
+
+ 状态码管理
+
+
+ 系统支持状态码显示内容的释义修改,当设备异常时,会为您显示自定义释义内容。
+
+
+
+
+
+ 筛选条件
+
+
+
+
+ 全部
+ 启用
+ 禁用
+
+
+ 全部
+ 已设置
+ 未设置
+
+
+
+
+
+
+
+
+
+
+
+ 状态码详情
+
+
+
+
+
+
+
+ s)}
+ dataSource={equipmentWarehouseNvr.data}
+ bordered={false}
+ empty="暂无数据"
+ style={{
+ padding: "0px 20px",
+ }}
+ pagination={false}
+ />
+
+
+
+
+ 共{equipmentWarehouseNvr.total}个设备
+
+
{
+ setQuery({ limit: pageSize, page: currentPage - 1 });
+ page.current = currentPage - 1
+ }}
+ />
+
+
+ {setup ? (
+ {
+ setSetup(false);
+ attribute(venderList);
+ }}
+ />
+ ) : (
+ ""
+ )}
+
+ {/* {sideSheet ? (
+ {
+ setSideSheet(false);
+ }}
+ />
+ ) : (
+ []
+ )} */}
+ {/* {
+ history.push({ pathname: '/equipmentWarehouse/camera', query: { addNvr: true, serialNo: nvrRef.current.nvrNumber() } });
+ localStorage.setItem('vcmp_selected_sider', JSON.stringify("camera"))
+ setReminder(false)
+ }}
+ close={() => {
+ setReminder(false)
+ }}
+ /> */}
+
+ >
+ );
+};
function mapStateToProps (state) {
- const { auth } = state;
- return {
- user: auth.user,
- };
+ const { auth, global, members, equipmentWarehouseNvr } = state;
+ return {
+ loading: equipmentWarehouseNvr.isRequesting && !equipmentWarehouseNvr.data,
+ user: auth.user,
+ actions: global.actions,
+ members: members.data,
+ equipmentWarehouseNvr: equipmentWarehouseNvr.data || {},
+ };
}
export default connect(mapStateToProps)(Statuscode);
From fca233345908d25fa4d34b80257dd5b33f7478f4 Mon Sep 17 00:00:00 2001
From: deartibers <947466799@qq.com>
Date: Wed, 13 Jul 2022 09:29:51 +0800
Subject: [PATCH 2/8] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=B1=9E=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../web/client/src/components/index.js | 2 +
.../web/client/src/components/setup.jsx | 121 +++++++++++
.../equipmentWarehouse/components/setup.jsx | 191 ------------------
.../equipmentWarehouse/containers/camera.jsx | 32 ++-
.../equipmentWarehouse/containers/nvr.jsx | 27 ++-
.../src/sections/offline/components/setup.jsx | 138 -------------
.../offline/containers/carrierpigeon.jsx | 17 +-
.../offline/containers/statuscode.jsx | 20 +-
8 files changed, 200 insertions(+), 348 deletions(-)
create mode 100644 code/VideoAccess-VCMP/web/client/src/components/setup.jsx
delete mode 100644 code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/setup.jsx
delete mode 100644 code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx
diff --git a/code/VideoAccess-VCMP/web/client/src/components/index.js b/code/VideoAccess-VCMP/web/client/src/components/index.js
index 5e7f4a7..9f703c5 100644
--- a/code/VideoAccess-VCMP/web/client/src/components/index.js
+++ b/code/VideoAccess-VCMP/web/client/src/components/index.js
@@ -4,6 +4,7 @@ import Coming from './coming'
import ReminderBox from './reminderBox'
import VideoPlay from './videoPlayer/videoPlay'
import VideoPlayModal from './videoPlayer/videoPlayModal'
+import Setup from './setup'
export {
SimpleFileDownButton,
@@ -11,4 +12,5 @@ export {
ReminderBox,
VideoPlay,
VideoPlayModal,
+ Setup
};
diff --git a/code/VideoAccess-VCMP/web/client/src/components/setup.jsx b/code/VideoAccess-VCMP/web/client/src/components/setup.jsx
new file mode 100644
index 0000000..9ff3a55
--- /dev/null
+++ b/code/VideoAccess-VCMP/web/client/src/components/setup.jsx
@@ -0,0 +1,121 @@
+import React, { useState, useEffect } from "react";
+import {
+ Modal,
+ CheckboxGroup,
+ Checkbox,
+} from "@douyinfe/semi-ui";
+
+function Setup(props) {
+ const {
+ close,
+ tableType,
+ tableList
+ } = props;
+ const [check, setCheck] = useState([]);
+
+ const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" };
+
+ useEffect(() => {
+ //获取是否勾选信息
+ const checkItem = localStorage.getItem(tableType);
+ setCheck(checkItem?JSON.parse(checkItem) : [])
+ ischeck();
+ }, []);
+ function ischeck(value) {
+ if (check.length >= 8) {
+ if (check.includes(value)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ return (
+
+ 表格属性设置
+
+ {check.length}/8
+
+
+ }
+ visible={true}
+ style={{ width: 600 }}
+ onOk={() => {
+ localStorage.setItem(tableType, JSON.stringify(check));
+ close();
+ }}
+ onCancel={() => {
+ close();
+ }}
+ >
+ {
+ setCheck(check);
+ ischeck();
+ }}
+ >
+ {tableList.map((item,index)=>{
+ return(
+
+
+ {item.title}
+
+
+ {item.list.map((itm) => {
+ return (
+
+ {itm.name}
+
+ );
+ })}
+
+
+ )})}
+
+
+ );
+}
+
+export default Setup;
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/setup.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/setup.jsx
deleted file mode 100644
index 1100342..0000000
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/setup.jsx
+++ /dev/null
@@ -1,191 +0,0 @@
-import React, { useState, useEffect } from "react";
-import {
- Modal,
- CheckboxGroup,
- Checkbox,
-} from "@douyinfe/semi-ui";
-
-function Setup(props) {
- const {
- visible,
- close,
- SETUPS,
- CAMERAS,
- cameraSetup,
- } = props;
- const [check, setCheck] = useState([]);
-
- const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" };
-
- useEffect(() => {
- //获取是否勾选信息
- const nvrItem = localStorage.getItem(SETUPS);
- const cameraItem = localStorage.getItem(CAMERAS);
- if (cameraSetup) {
- setCheck(cameraItem ? JSON.parse(cameraItem) : []);
- } else {
- setCheck(nvrItem ? JSON.parse(nvrItem) : []);
- }
- ischeck();
- }, []);
-
- const equipmentNVR = [
- { name: "设备厂家", value: "manufactor" },
- { name: "添加账号", value: "accountNumber" },
- { name: "通道数", value: "passageway" },
- { name: "端口", value: "port" },
- { name: "设备状态", value: "state" },
- { name: "创建时间", value: "time" },
- ];
- const projectNVR = [
- { name: "项目名称", value: "name" },
- { name: "pcode", value: "pcode" },
- { name: "结构物", value: "structure" },
- ];
- const equipmentCamera = [
- { name: "设备厂家", value: "manufactor" },
- { name: "接入类型", value: "type" },
- { name: "设备状态", value: "state" },
- { name: "云台支持", value: "support" },
- { name: "内存卡信息", value: "memoryCard" },
- { name: "设备创建时间", value: "time" },
- { name: "设备添加账号", value: "account" },
- ];
- const projectCamera = [
- { name: "项目名称", value: "name" },
- { name: "pcode", value: "pcode" },
- { name: "结构物", value: "structure" },
- { name: "测点", value: "measuringPoint" },
- { name: "监测因素", value: "factor" },
- ];
-
- function ischeck(value) {
- if (check.length >= 8) {
- if (check.includes(value)) {
- return false;
- } else {
- return true;
- }
- }
- }
-
- return (
-
- 表格属性设置
-
- {check.length}/8
-
-
- }
- visible={visible}
- style={{ width: 600 }}
- onOk={() => {
- cameraSetup
- ? localStorage.setItem(CAMERAS, JSON.stringify(check))
- : localStorage.setItem(SETUPS, JSON.stringify(check));
- close();
- }}
- onCancel={() => {
- close();
- }}
- >
- {
- setCheck(check);
- ischeck();
- }}
- >
-
-
- 设备信息
-
-
- {(cameraSetup ? equipmentCamera : equipmentNVR).map((item) => {
- return (
-
- {item.name}
-
- );
- })}
-
-
-
-
-
- 项目信息
-
-
- {(cameraSetup ? projectCamera : projectNVR).map((item) => {
- return (
-
- {item.name}
-
- );
- })}
-
-
-
-
- );
-}
-
-export default Setup;
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
index 22f4e02..39d19c4 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
@@ -17,7 +17,7 @@ import { SimpleFileDownButton, VideoPlayModal } from "$components";
import "../style.less";
import CameraModal from "../components/cameraModal";
import RemarksModal from "../components/remarksModal";
-import Setup from "../components/setup";
+import {Setup} from "$components";
import SideSheets from "../components/sideSheet";
import { skeletonScreen } from "../components/skeletonScreen";
import { accessType } from "./nvr";
@@ -51,7 +51,30 @@ const CameraHeader = (props) => {
const page = useRef(query.page);
const deviceClickb = useRef(true)
const CAMERAS = "cameras";
-
+ const tableList = [//表格属性
+ {
+ title:'设备信息',
+ list:[
+ { name: "设备厂家", value: "manufactor" },
+ { name: "接入类型", value: "type" },
+ { name: "设备状态", value: "state" },
+ { name: "云台支持", value: "support" },
+ { name: "内存卡信息", value: "memoryCard" },
+ { name: "设备创建时间", value: "time" },
+ { name: "设备添加账号", value: "account" },
+ ]
+ },
+ {
+ title:'项目信息',
+ list:[
+ { name: "项目名称", value: "name" },
+ { name: "pcode", value: "pcode" },
+ { name: "结构物", value: "structure" },
+ { name: "测点", value: "measuringPoint" },
+ { name: "监测因素", value: "factor" },
+ ]
+ },
+ ];
useEffect(() => {
//安心云传参
let isAxyData = props.location.search
@@ -771,9 +794,8 @@ const CameraHeader = (props) => {
{setup ? (
{
setSetup(false);
attribute(venderList);
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
index a84b557..21a9f58 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
@@ -5,7 +5,7 @@ import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, }
import "../style.less";
import { ApiTable } from "$utils";
import NvrModal from "../components/nvrModal";
-import Setup from "../components/setup";
+import {Setup} from "$components";
import SideSheets from "../components/sideSheet";
import { skeletonScreen } from "../components/skeletonScreen";
import { ReminderBox } from "../../../components/index";
@@ -36,6 +36,27 @@ const NvrHeader = (props) => {
const SETUPS = "setups";
const USER = "user" + props.user.id
const nvrRef = useRef(); //获取子组件的设备编号
+ const tableList = [//表格属性
+ {
+ title:'设备信息',
+ list:[
+ { name: "设备厂家", value: "manufactor" },
+ { name: "添加账号", value: "accountNumber" },
+ { name: "通道数", value: "passageway" },
+ { name: "端口", value: "port" },
+ { name: "设备状态", value: "state" },
+ { name: "创建时间", value: "time" },
+ ]
+ },
+ {
+ title:'项目信息',
+ list:[
+ { name: "项目名称", value: "name" },
+ { name: "pcode", value: "pcode" },
+ { name: "结构物", value: "structure" },
+ ]
+ },
+ ];
useEffect(() => {
dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
@@ -575,8 +596,8 @@ const NvrHeader = (props) => {
{setup ? (
{
setSetup(false);
attribute(venderList);
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx
deleted file mode 100644
index 99ddc86..0000000
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/components/setup.jsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import React, { useState, useEffect } from "react";
-import {
- Modal,
- CheckboxGroup,
- Checkbox,
-} from "@douyinfe/semi-ui";
-
-function Setup(props) {
- const {
- visible,
- close,
- CODE,//错误码
- PIGEON,//信鸽
- pigeonSetup,
- } = props;
- const [check, setCheck] = useState([]);
-
- const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" };
-
- useEffect(() => {
- //获取是否勾选信息
- const codeItem = localStorage.getItem(CODE);
- const pigeonItem = localStorage.getItem(PIGEON);
- if (pigeonSetup) {
- setCheck(pigeonItem ? JSON.parse(pigeonItem) : []);
- } else {
- setCheck(codeItem ? JSON.parse(codeItem) : []);
- }
- ischeck();
- }, []);
-
- const equipmentCode = [//状态码管理
- { name: "常规解决方案", value: "manufactor" },
- { name: "状态频率", value: "accountNumber" },
- ];
- const equipmentCarrierpigeon = [//信鸽服务
- { name: "策略类型", value: "manufactor" },
- { name: "推送机制", value: "type" },
- { name: "监听设备数量", value: "state" },
- { name: "累计推送次数", value: "support" },
- ];
-
- function ischeck(value) {
- if (check.length >= 8) {
- if (check.includes(value)) {
- return false;
- } else {
- return true;
- }
- }
- }
-
- return (
-
- 表格属性设置
-
- {check.length}/8
-
-
- }
- visible={visible}
- style={{ width: 600 }}
- onOk={() => {
- pigeonSetup
- ? localStorage.setItem(PIGEON, JSON.stringify(check))
- : localStorage.setItem(CODE, JSON.stringify(check));
- close();
- }}
- onCancel={() => {
- close();
- }}
- >
- {
- setCheck(check);
- ischeck();
- }}
- >
-
-
- {pigeonSetup?'推送信息':'状态码信息'}
-
-
- {(pigeonSetup ? equipmentCarrierpigeon : equipmentCode).map((item) => {
- return (
-
- {item.name}
-
- );
- })}
-
-
-
-
- );
-}
-
-export default Setup;
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
index e86ffea..def979f 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
@@ -4,7 +4,7 @@ import moment from "moment";
import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, } from "@douyinfe/semi-ui";
import "../style.less";
import { ApiTable } from "$utils";
-import Setup from "../components/setup";
+import {Setup} from "$components";
// import SideSheets from "../components/sideSheet";
// import { skeletonScreen } from "../components/skeletonScreen";
// import { ReminderBox } from "../../../components/index";
@@ -34,7 +34,15 @@ const Carrierpigeon = (props) => {
const PIGEON = "pigeon";
const USER = "user" + props.user.id
const nvrRef = useRef(); //获取子组件的设备编号
-
+ const tableList = [//表格属性
+ {
+ title:'状态码信息',
+ list:[
+ { name: "常规解决方案", value: "manufactor" },
+ { name: "状态频率", value: "accountNumber" },
+ ]
+ },
+ ];
useEffect(() => {
dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data);
@@ -535,9 +543,8 @@ const Carrierpigeon = (props) => {
{setup ? (
{
setSetup(false);
attribute(venderList);
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx
index eeb8b53..318398f 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/statuscode.jsx
@@ -3,8 +3,8 @@ import { connect } from "react-redux";
import moment from "moment";
import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, } from "@douyinfe/semi-ui";
import "../style.less";
-import { ApiTable } from "$utils";
-import Setup from "../components/setup";
+import {Setup} from "$components";
+
// import SideSheets from "../components/sideSheet";
// import { skeletonScreen } from "../components/skeletonScreen";
// import { ReminderBox } from "../../../components/index";
@@ -34,7 +34,15 @@ const Statuscode = (props) => {
const CODE = "code";
const USER = "user" + props.user.id
const nvrRef = useRef(); //获取子组件的设备编号
-
+ const tableList = [//表格属性
+ {
+ title:'状态码信息',
+ list:[
+ { name: "常规解决方案", value: "manufactor" },
+ { name: "状态频率", value: "accountNumber" },
+ ]
+ },
+ ];
useEffect(() => {
dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data);
@@ -443,7 +451,7 @@ const Statuscode = (props) => {
>
{
{setup ? (
{
setSetup(false);
attribute(venderList);
From a40ad824522c2c1b246d1602825b3bbe7e846961 Mon Sep 17 00:00:00 2001
From: yangsen <952208207@qq.com>
Date: Wed, 13 Jul 2022 09:42:34 +0800
Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=A1=E9=B8=BD=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E6=9A=82=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../offline/containers/carrierpigeon.jsx | 35 +++++++++++++------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
index e86ffea..7673517 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
@@ -44,7 +44,7 @@ const Carrierpigeon = (props) => {
localStorage.getItem(PIGEON) == null
? localStorage.setItem(
PIGEON,
- JSON.stringify(["manufactor", "type","state","support"])
+ JSON.stringify(["manufactor", "type", "state", "support"])
)
: "";
}, []);
@@ -93,7 +93,7 @@ const Carrierpigeon = (props) => {
},
},
{
- title: "设备名称",
+ title: "策略名称",
dataIndex: "name",
render: (_, r, index) => {
console.log(r);
@@ -101,10 +101,19 @@ const Carrierpigeon = (props) => {
},
},
{
- title: "SIP地址",
+ title: "监听设备数量",
dataIndex: "owner",
render: (_, r, index) => {
- return r?.gbNvr?.sipip
+ console.log(r);
+ return r.name
+ },
+ },
+ {
+ title: "累计推送次数",
+ dataIndex: "owner",
+ render: (_, r, index) => {
+ console.log(r);
+ return (r.name + '次')
},
},
{
@@ -115,7 +124,7 @@ const Carrierpigeon = (props) => {
return (
{
});
}}
>
-
+
+
+
);
},
@@ -157,7 +172,7 @@ const Carrierpigeon = (props) => {
const column = [
{
- title: "设备厂家",
+ title: "策略类型",
dataIndex: "venderId",
key: "manufactor",
render: (_, r, index) => {
@@ -184,7 +199,7 @@ const Carrierpigeon = (props) => {
key: "port",
},
{
- title: "设备状态",
+ title: "推送机制",
dataIndex: "size",
key: "state",
render: (_, r, index) => {
@@ -519,7 +534,7 @@ const Carrierpigeon = (props) => {
}}
>
- 共{equipmentWarehouseNvr.total}个设备
+ 共{equipmentWarehouseNvr.total}条策略
Date: Thu, 14 Jul 2022 09:24:12 +0800
Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=A1=E9=B8=BD=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E6=9C=AA=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../sections/offline/components/pushModal.jsx | 299 ++++++++++++++++++
.../offline/containers/carrierpigeon.jsx | 172 ++++------
2 files changed, 360 insertions(+), 111 deletions(-)
create mode 100644 code/VideoAccess-VCMP/web/client/src/sections/offline/components/pushModal.jsx
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/components/pushModal.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/components/pushModal.jsx
new file mode 100644
index 0000000..1c722db
--- /dev/null
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/components/pushModal.jsx
@@ -0,0 +1,299 @@
+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";
+
+import moment from "moment";
+
+function pushModal (props) {
+ const { modalName, pushRef } = props;
+ const { dispatch, actions, vender, close } = props;
+ const pushData = props.pushData || {}; //修改时传来的值
+ const form = useRef();
+ const [visible, setVisible] = useState(false); //是否显示弹框
+ const [isloading, setloading] = useState(false); //是否显示loading
+ const [loadingTip, setloadingTip] = useState("获取中...请稍后..."); //loading tip的值
+ const [step, setstep] = useState("none"); //第几步
+ const [okText, setokText] = useState("测试校验"); //ok弹框text 右边
+ const [cancelText, setcancelText] = useState("取消"); //取消弹框text 左边
+ const [formObj, setformObj] = useState(); //接口入参
+
+ function showDialog () {
+ //打开弹框
+ setVisible(true);
+ }
+ function positionForm (val) {
+ let zz = /^(-?\d+)(\.\d+)?$/;
+ if (!val) {
+ return "请输入或拾取高德经纬度坐标";
+ } else if (val.split(",").length != 2) {
+ return "请输入格式为116.354169,39.835452的经纬度坐标";
+ } else if (!zz.test(val.split(",")[0])) {
+ return "只能填写数字";
+ } else if (!zz.test(val.split(",")[1])) {
+ return "只能填写数字";
+ } else {
+ return "";
+ }
+ }
+ function handleOk () {
+ //点击弹框确定 右边按钮
+ if (step == "none") {
+ form.current
+ .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];
+ delete valuesObj.position;
+ if (pushData.id) {
+ valuesObj.id = pushData.id;
+ }
+ var front = new moment(); //验证前时间
+ setloading(true);
+ dispatch(
+ actions.equipmentWarehouse.getCheck({
+ serialNo: valuesObj.serialNo,
+ })
+ ).then((res) => {
+ var after = new moment(); //验证后时间
+ var duration = moment.duration(after.diff(front))._data.milliseconds;
+ if (res.success) {
+ setTimeout(
+ () => {
+ setloadingTip("已完成");
+ setTimeout(() => {
+ setstep("block");
+ setloading(false);
+ setokText("确认");
+ setcancelText("上一步");
+ setloadingTip("获取中...请稍后...");
+ }, 1000);
+ },
+ duration > 2000 ? 0 : 2000 - duration
+ );
+ } else {
+ setTimeout(
+ () => {
+ setloadingTip("校验失败");
+ setTimeout(() => {
+ setstep("none");
+ setloading(false);
+ setokText("测试校验");
+ setcancelText("取消");
+ setloadingTip("获取中...请稍后...");
+ }, 1000);
+ },
+ duration > 2000 ? 0 : 2000 - duration
+ );
+ }
+ });
+ setformObj(valuesObj);
+ })
+ .catch((errors) => {
+ //表单校验失败
+ console.log("errors", errors);
+ });
+ } else {
+ dispatch(actions.equipmentWarehouse.addchangepush(formObj)).then((res) => {
+ setVisible(false);
+ close();
+ });
+ }
+ }
+ function handleAfterClose () {
+ //在关闭之后
+ setstep("none");
+ setokText("测试校验");
+ setcancelText("取消");
+ }
+ function handleCancel () {
+ //点击弹框取消 左边按钮
+ if (step == "none") {
+ setVisible(false);
+ } else {
+ setstep("none");
+ setokText("测试校验");
+ setcancelText("取消");
+ }
+ }
+ function handleLocation () {
+ //高德经纬度
+ window.open("https://lbs.amap.com/tools/picker", "_blank");
+ }
+ useImperativeHandle(pushRef, () => ({
+ //传给父组件方法
+ //aa即为子组件暴露给父组件的方法
+ pushNumber: () => formObj.serialNo
+ }));
+ return (
+ <>
+ {modalName == "add" ? "创建推送" : "修改"}
+
+
+
+
+
+
+
+ >
+ );
+}
+
+function mapStateToProps (state) {
+ const { auth, global, members, vender } = state;
+ return {
+ loading: members.isRequesting,
+ user: auth.user,
+ actions: global.actions,
+ members: members.data,
+ vender: vender.data || [], //设备厂家
+ };
+}
+
+export default connect(mapStateToProps)(pushModal);
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
index cab4296..48a9755 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx
@@ -4,7 +4,8 @@ import moment from "moment";
import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, } from "@douyinfe/semi-ui";
import "../style.less";
import { ApiTable } from "$utils";
-import {Setup} from "$components";
+import { Setup } from "$components";
+import PushModal from "../components/pushModal";
// import SideSheets from "../components/sideSheet";
// import { skeletonScreen } from "../components/skeletonScreen";
// import { ReminderBox } from "../../../components/index";
@@ -36,10 +37,12 @@ const Carrierpigeon = (props) => {
const nvrRef = useRef(); //获取子组件的设备编号
const tableList = [//表格属性
{
- title:'状态码信息',
- list:[
- { name: "常规解决方案", value: "manufactor" },
- { name: "状态频率", value: "accountNumber" },
+ title: '推送信息',
+ list: [
+ { name: "策略类型", value: "PolicyType" },
+ { name: "推送机制", value: "PushMechanism" },
+ { name: "监听设备数量", value: "DevicesNumber" },
+ { name: "累计推送次数", value: "PushNumber" },
]
},
];
@@ -52,7 +55,7 @@ const Carrierpigeon = (props) => {
localStorage.getItem(PIGEON) == null
? localStorage.setItem(
PIGEON,
- JSON.stringify(["manufactor", "type", "state", "support"])
+ JSON.stringify(["PolicyType", "PushMechanism", "DevicesNumber", "PushNumber"])
)
: "";
}, []);
@@ -70,12 +73,10 @@ const Carrierpigeon = (props) => {
function equipmentStatus (data) {
switch (data) {
- case "ON":
- return "在线"
- case "ONLINE":
- return "在线"
- case "OFF":
- return "离线"
+ case "email":
+ return "邮件通知"
+ case "note":
+ return "短信通知"
default:
return "未知"
}F
@@ -104,26 +105,10 @@ const Carrierpigeon = (props) => {
title: "策略名称",
dataIndex: "name",
render: (_, r, index) => {
- console.log(r);
+ console.log("r:" + r.name);
return r.name
},
},
- {
- title: "监听设备数量",
- dataIndex: "owner",
- render: (_, r, index) => {
- console.log(r);
- return r.name
- },
- },
- {
- title: "累计推送次数",
- dataIndex: "owner",
- render: (_, r, index) => {
- console.log(r);
- return (r.name + '次')
- },
- },
{
title: "操作",
width: "20%",
@@ -132,7 +117,9 @@ const Carrierpigeon = (props) => {
return (
{
const column = [
{
- title: "策略类型",
+ title: "推送机制",
dataIndex: "venderId",
- key: "manufactor",
+ key: "PushMechanism",
render: (_, r, index) => {
let manufactorName = data.find((item) => item.id == r.venderId);
return manufactorName ? manufactorName.name : "";
},
},
{
- title: "添加账号",
- dataIndex: "createUserId",
- key: "accountNumber",
+ title: "监听设备数量",
+ dataIndex: "DevicesNum",
+ key: "DevicesNumber",
render: (_, r, index) => {
- return r?.createUser?.name
+ return r.name
},
},
{
- title: "通道数",
- dataIndex: "channelCount",
- key: "passageway",
- },
- {
- title: "端口",
- dataIndex: "port",
- key: "port",
+ title: "累计推送次数",
+ dataIndex: "PushNum",
+ key: "PushNumber",
+ render: (_, r, index) => {
+ return (r.name + '次')
+ },
},
+
{
- title: "推送机制",
+ title: "策略类型",
dataIndex: "size",
- key: "state",
+ key: "PolicyType",
render: (_, r, index) => {
let status = r.gbNvr;
return (
@@ -224,49 +210,11 @@ const Carrierpigeon = (props) => {
margin: "0 8px 0 0",
}}
/>
- {status ? equipmentStatus(status.online) : ""}
+ {status ? "邮件通知" : equipmentStatus(status.email)}
);
},
},
- {
- title: "创建时间",
- dataIndex: "createTime",
- key: "time",
- render: (_, r, index) => {
- return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS");
- },
- },
- {
- title: "项目名称",
- dataIndex: "",
- key: "name",
- render: (_, r, index) => {
- return r.station.length == 0
- ? ""
- : station(r, "name", "projects")
- },
- },
- {
- title: "pcode",
- dataIndex: "",
- key: "pcode",
- render: (_, r, index) => {
- return r.station.length == 0
- ? ""
- : station(r, "url", "projects")
- },
- },
- {
- title: "结构物",
- dataIndex: "",
- key: "structure",
- render: (_, r, index) => {
- return r.station.length == 0
- ? ""
- : station(r, "name")
- },
- },
];
for (let i = 0; i < arr.length; i++) {
let colum = column.filter((item) => {
@@ -278,29 +226,29 @@ const Carrierpigeon = (props) => {
}
//表格请求数据中station属性数据的展示
- function station (r, name, projects) {
- let data = []
- if (projects == "projects") {
- r.station.map((v) => {
- if (v.structure.projects.length > 0) {
- v.structure.projects.map((item) => data.push(item[name]))
- }
- })
- } else {
- r.station.map((v, index) => data.push(v.structure[name]))
- }
- let dataSet = [...(new Set(data))]
- return dataSet.length > 0 ? 1 ? {dataSet.map((v, index) => {v}
)} : ""
- }
- >
- {dataSet.length > 1 ? `${dataSet[0]}...` : dataSet.length > 0 ? dataSet[0] : ""}
- : ""
+ // function station (r, name, projects) {
+ // let data = []
+ // if (projects == "projects") {
+ // r.station.map((v) => {
+ // if (v.structure.projects.length > 0) {
+ // v.structure.projects.map((item) => data.push(item[name]))
+ // }
+ // })
+ // } else {
+ // r.station.map((v, index) => data.push(v.structure[name]))
+ // }
+ // let dataSet = [...(new Set(data))]
+ // return dataSet.length > 0 ? 1 ? {dataSet.map((v, index) => {v}
)} : ""
+ // }
+ // >
+ // {dataSet.length > 1 ? `${dataSet[0]}...` : dataSet.length > 0 ? dataSet[0] : ""}
+ // : ""
- }
+ // }
//条件赛选样式
const screen = {
@@ -355,7 +303,9 @@ const Carrierpigeon = (props) => {
cursor: "pointer",
}}
>
- 创建推送
+
{/* {
{
});
}}
>
- 搜素
+ 搜索