From 345a2014dbf00a26d564adaadaafd21dade91fdf Mon Sep 17 00:00:00 2001 From: wenlele Date: Mon, 30 May 2022 18:42:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipmentWarehouse/containers/nvr.jsx | 1065 +++++++++-------- 1 file changed, 554 insertions(+), 511 deletions(-) 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 98db120..67e210d 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 @@ -2,351 +2,411 @@ import React, { useState, useEffect, useRef } from "react"; import { connect } from "react-redux"; import moment from "moment"; import { - Button, - Form, - Input, - Row, - Table, - Pagination, - Skeleton, - Popconfirm, + Button, + Form, + Input, + Row, + Table, + Pagination, + Skeleton, + Popconfirm, + Popover, + Tag, } from "@douyinfe/semi-ui"; import "../style.less"; import NvrModal from "../components/nvrModal"; import Setup from "../components/setup"; import SideSheets from "../components/sideSheet"; +import {skeletonScreen} from "../components/skeletonScreen"; + export const accessType = [ - { name: "萤石云平台摄像头", key: "yingshi" }, - { name: "NVR摄像头", key: "nvr" }, - { name: "IPC 网络摄像头", key: "ipc" }, - { name: "不明厂家", key: "cascade" }, + { name: "萤石云平台摄像头", key: "yingshi" }, + { name: "NVR摄像头", key: "nvr" }, + { name: "IPC 网络摄像头", key: "ipc" }, + { name: "不明厂家", key: "cascade" }, ]; const NvrHeader = (props) => { - const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props; - const { equipmentWarehouse } = actions; - // const [loading, setLoading] = useState(false); - 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 { dispatch, actions, user, loading, equipmentWarehouseNvr } = props; + const { equipmentWarehouse } = actions; + // const [loading, setLoading] = useState(false); + 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 [load, setLoad] = useState(); //骨架屏是否显现 - const api = useRef(); - const SETUPS = "setups"; - useEffect(() => { - dispatch(actions.equipmentWarehouse.getVender()).then((res) => { - setvenderList(res.payload.data); - attribute(res.payload.data); - }); - //初始化表格显示设置 - localStorage.getItem(SETUPS) == null - ? localStorage.setItem( - SETUPS, - JSON.stringify(["manufactor", "passageway", "port", "state"]) - ) - : ""; - // ; - }, []); - useEffect(() => { - equipmentGetNvr(); - }, [query, search]); + const api = useRef(); + const SETUPS = "setups"; - function equipmentGetNvr () { - dispatch(equipmentWarehouse.getNvr({ ...query, ...search })); - } - const columns = [ + useEffect(() => { + setLoad(loading); + dispatch(actions.equipmentWarehouse.getVender()).then((res) => { + setvenderList(res.payload.data); + attribute(res.payload.data); + }); + //初始化表格显示设置 + localStorage.getItem(SETUPS) == null + ? localStorage.setItem( + SETUPS, + JSON.stringify(["manufactor", "passageway", "port", "state"]) + ) + : ""; + // ; + }, []); + useEffect(() => { + equipmentGetNvr(); + }, [query, search]); + + function equipmentGetNvr() { + dispatch(equipmentWarehouse.getNvr({ ...query, ...search })); + } + const columns = [ + { + title: "序号", + render: (text, record, index) => { + return index + 1; + }, + }, + { + title: "设备名称", + dataIndex: "name", + render: (text, r, index) => { + return ( +
+ + {r.name} +
+ ); + }, + }, + { + title: "SIP地址", + dataIndex: "owner", + }, + { + title: "操作", + width: "20%", + dataIndex: "", + render: (_, row) => { + return ( +
+ + + { + dispatch(equipmentWarehouse.delNvr(row.id)).then(() => { + equipmentGetNvr(); + }); + }} + > + + +
+ ); + }, + }, + ]; + + //获取表格属性设置 + function attribute(data) { + const arr = localStorage.getItem(SETUPS) + ? JSON.parse(localStorage.getItem(SETUPS)) + : []; + + const column = [ { - title: "序号", - render: (text, record, index) => { - return index + 1; - }, + title: "设备厂家", + dataIndex: "venderId", + key: "manufactor", + render: (_, r, index) => { + let manufactorName = data.find((item) => item.id == r.venderId); + return manufactorName ? manufactorName.name : ""; + }, }, { - title: "设备名称", - dataIndex: "name", - render: (text, r, index) => { - return ( -
- - {r.name} -
- ); - }, + title: "添加账号", + dataIndex: "createUserId", + key: "accountNumber", }, { - title: "SIP地址", - dataIndex: "owner", + title: "通道数", + dataIndex: "channelCount", + key: "passageway", }, { - title: "操作", - width: "20%", - dataIndex: "", - render: (_, row) => { - return ( -
- - - { - dispatch(equipmentWarehouse.delNvr(row.id)).then(() => { - equipmentGetNvr(); - }); - }} - > - - -
- ); - }, + title: "端口", + dataIndex: "port", + key: "port", }, - ]; - - //获取表格属性设置 - function attribute (data) { - const arr = localStorage.getItem(SETUPS) - ? JSON.parse(localStorage.getItem(SETUPS)) - : []; + { + title: "设备状态", + dataIndex: "size", + key: "state", + }, + { + 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 + ? "" + : r.station.map((item, index) => { + return item.structure.projects.length == 0 + ? "" + : station( + r.station[0].structure.projects[0].name, + item.structure.projects, + "name" + ); + }); + }, + }, + { + title: "pcode", + dataIndex: "", + key: "pcode", + render: (_, r, index) => { + return r.station.length == 0 + ? "" + : r.station.map((item, index) => { + return item.structure.projects.length == 0 + ? "" + : station( + r.station[0].structure.projects[0].url, + item.structure.projects, + "url" + ); + }); + }, + }, + { + title: "结构物", + dataIndex: "", + key: "structure", + render: (_, r, index) => { + return r.station.length == 0 + ? "" + : station(r.station[0].structure.name, r.station, "structure.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); + } - 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", - }, - { - title: "通道数", - dataIndex: "channelCount", - key: "passageway", - }, - { - title: "端口", - dataIndex: "port", - key: "port", - }, - { - title: "设备状态", - dataIndex: "size", - key: "state", - }, - { - 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) => { - // console.log(r); - // return r.station.length == 0 - // ? "" - // : r.station.map((item, index) => { - // return item.structure.projects.length == 0 - // ? "" - // : station( - // r.station[0].structure.projects[0].name, - // item.structure.projects, - // "name" - // ); - // }); - // }, - }, - { - title: "pcode", - dataIndex: "", - key: "pcode", - }, - { - title: "结构物", - dataIndex: "", - key: "structure", - }, - ]; - 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(first, whole, name) { + return ( + + {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
{names}
; + })} + + } + > + {first}... +
+ ); + } - //条件赛选样式 - const screen = { - width: 193, - marginRight: 20, - marginBottom: 16, - color: "rgba(0, 0, 0, 0.65)", - }; + //条件赛选样式 + const screen = { + width: 193, + marginRight: 20, + marginBottom: 16, + color: "rgba(0, 0, 0, 0.65)", + }; - return ( - <> -
-
-
+
+