|
@ -1,19 +1,7 @@ |
|
|
import React, { useState, useEffect, useRef } from "react"; |
|
|
import React, { useState, useEffect, useRef } from "react"; |
|
|
import { connect } from "react-redux"; |
|
|
import { connect } from "react-redux"; |
|
|
// import { push } from "react-router-redux"; |
|
|
|
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
import { |
|
|
import { Button, Form, Table, Pagination, Skeleton, Popconfirm, Popover, Tag, } from "@douyinfe/semi-ui"; |
|
|
Button, |
|
|
|
|
|
Form, |
|
|
|
|
|
Input, |
|
|
|
|
|
Row, |
|
|
|
|
|
Table, |
|
|
|
|
|
Pagination, |
|
|
|
|
|
Skeleton, |
|
|
|
|
|
Popconfirm, |
|
|
|
|
|
Popover, |
|
|
|
|
|
Tag, |
|
|
|
|
|
} from "@douyinfe/semi-ui"; |
|
|
|
|
|
import "../style.less"; |
|
|
import "../style.less"; |
|
|
import { ApiTable } from "$utils"; |
|
|
import { ApiTable } from "$utils"; |
|
|
import NvrModal from "../components/nvrModal"; |
|
|
import NvrModal from "../components/nvrModal"; |
|
@ -42,6 +30,7 @@ const NvrHeader = (props) => { |
|
|
const [reminder, setReminder] = useState(false); //提醒弹框 |
|
|
const [reminder, setReminder] = useState(false); //提醒弹框 |
|
|
const api = useRef(); |
|
|
const api = useRef(); |
|
|
const SETUPS = "setups"; |
|
|
const SETUPS = "setups"; |
|
|
|
|
|
const USER = "user" + props.user.id |
|
|
const nvrRef = useRef(); //获取子组件的设备编号 |
|
|
const nvrRef = useRef(); //获取子组件的设备编号 |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
@ -208,7 +197,7 @@ const NvrHeader = (props) => { |
|
|
height: 8, |
|
|
height: 8, |
|
|
display: "inline-block", |
|
|
display: "inline-block", |
|
|
borderRadius: "50%", |
|
|
borderRadius: "50%", |
|
|
backgroundColor: status ?colorStatus(status.online):"", |
|
|
backgroundColor: status ? colorStatus(status.online) : "", |
|
|
margin: "0 8px 0 0", |
|
|
margin: "0 8px 0 0", |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
@ -267,19 +256,25 @@ const NvrHeader = (props) => { |
|
|
|
|
|
|
|
|
//表格请求数据中station属性数据的展示 |
|
|
//表格请求数据中station属性数据的展示 |
|
|
function station (r, name, projects) { |
|
|
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 <Popover |
|
|
return <Popover |
|
|
key="updateTime" |
|
|
key="updateTime" |
|
|
position="top" |
|
|
position="top" |
|
|
content={ |
|
|
content={ |
|
|
<article style={{ padding: 12 }}> |
|
|
<article style={{ padding: 12 }}>{dataSet.map((v,index)=><div key={index}>{v}</div>)}</article> |
|
|
{projects == "projects" ? |
|
|
|
|
|
r.station.map((v) => v.structure.projects.length == 0 ? "" : v.structure.projects.map((item, index) => <div key={index}>{item[name]}</div>)) |
|
|
|
|
|
: r.station.map((v, index) => <div key={index}>{v.structure[name]}</div>) |
|
|
|
|
|
} |
|
|
|
|
|
</article> |
|
|
|
|
|
} |
|
|
} |
|
|
> |
|
|
> |
|
|
<Tag>{projects == "projects" ? r.station[0].structure.projects[0][name] : r.station[0].structure[name]}...</Tag> |
|
|
<Tag>{dataSet[0]}...</Tag> |
|
|
</Popover> |
|
|
</Popover> |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -342,7 +337,12 @@ const NvrHeader = (props) => { |
|
|
venderList={venderList} |
|
|
venderList={venderList} |
|
|
nvrRef={nvrRef} |
|
|
nvrRef={nvrRef} |
|
|
close={() => { |
|
|
close={() => { |
|
|
setReminder(true) |
|
|
const remind = localStorage.getItem(USER); |
|
|
|
|
|
console.log(remind) |
|
|
|
|
|
if (!remind) { |
|
|
|
|
|
console.log(1) |
|
|
|
|
|
setReminder(true) |
|
|
|
|
|
} |
|
|
equipmentGetNvr(); |
|
|
equipmentGetNvr(); |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
@ -607,11 +607,12 @@ const NvrHeader = (props) => { |
|
|
wait="再等等" |
|
|
wait="再等等" |
|
|
toadd="去添加" |
|
|
toadd="去添加" |
|
|
visible={reminder} |
|
|
visible={reminder} |
|
|
|
|
|
USER={USER} |
|
|
onOk={() => { |
|
|
onOk={() => { |
|
|
history.push({ pathname: '/equipmentWarehouse/camera', query: { addNvr: true, serialNo: nvrRef.current.nvrNumber() } }); |
|
|
history.push({ pathname: '/equipmentWarehouse/camera', query: { addNvr: true, serialNo: nvrRef.current.nvrNumber() } }); |
|
|
setReminder(false) |
|
|
setReminder(false) |
|
|
}} |
|
|
}} |
|
|
close={()=>{ |
|
|
close={() => { |
|
|
setReminder(false) |
|
|
setReminder(false) |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
|