|
@ -1,31 +1,31 @@ |
|
|
import React, { useState, useEffect } from "react"; |
|
|
import React, { useState, useEffect } from "react"; |
|
|
import { connect } from "react-redux"; |
|
|
import { connect } from "react-redux"; |
|
|
import { Button, Form, Input, Row, Table } from "@douyinfe/semi-ui"; |
|
|
import { Button, Form, Input, Row, Table, Pagination } from "@douyinfe/semi-ui"; |
|
|
import "../style.less"; |
|
|
import "../style.less"; |
|
|
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"; |
|
|
|
|
|
|
|
|
const NvrHeader = (props) => { |
|
|
const NvrHeader = (props) => { |
|
|
const { dispatch, actions, user, loading } = props; |
|
|
const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props; |
|
|
|
|
|
const { equipmentWarehouse } = actions; |
|
|
const [setup, setSetup] = useState(false); |
|
|
const [setup, setSetup] = useState(false); |
|
|
const [sideSheet, setSideSheet] = useState(false); |
|
|
const [sideSheet, setSideSheet] = useState(false); |
|
|
const [setupp, setSetupp] = useState([]); |
|
|
const [setupp, setSetupp] = useState([]); |
|
|
|
|
|
const [pagination, setPagination] = useState({limit:10,page:0}); |
|
|
|
|
|
|
|
|
const SETUPS = "setups"; |
|
|
const SETUPS = "setups"; |
|
|
|
|
|
|
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ |
|
|
{ |
|
|
title: "序号", |
|
|
title: "序号", |
|
|
|
|
|
|
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return index + 1; |
|
|
return index + 1; |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "设备名称", |
|
|
title: "设备名称", |
|
|
// dataIndex: "name",/// |
|
|
dataIndex: "name", |
|
|
width: 200, |
|
|
|
|
|
background: "red", |
|
|
|
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return ( |
|
|
return ( |
|
|
<div> |
|
|
<div> |
|
@ -74,9 +74,15 @@ const NvrHeader = (props) => { |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
localStorage.setItem(SETUPS, JSON.stringify(["a", "c", "d", "e"])); |
|
|
|
|
|
dispatch(equipmentWarehouse.getNvr(pagination)); |
|
|
|
|
|
}, [pagination]); |
|
|
|
|
|
console.log(equipmentWarehouseNvr); |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
attribute(); |
|
|
attribute(); |
|
|
}, []); |
|
|
}, []); |
|
|
|
|
|
|
|
|
//获取表格属性设置 |
|
|
//获取表格属性设置 |
|
|
function attribute() { |
|
|
function attribute() { |
|
|
const arr = localStorage.getItem(SETUPS) |
|
|
const arr = localStorage.getItem(SETUPS) |
|
@ -86,22 +92,22 @@ const NvrHeader = (props) => { |
|
|
const column = [ |
|
|
const column = [ |
|
|
{ |
|
|
{ |
|
|
title: "设备厂家", |
|
|
title: "设备厂家", |
|
|
dataIndex: "size", |
|
|
dataIndex: "venderId", |
|
|
key: "a", |
|
|
key: "a", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "添加张账号", |
|
|
title: "添加账号", |
|
|
dataIndex: "size", |
|
|
dataIndex: "createUserId", |
|
|
key: "b", |
|
|
key: "b", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "通道数", |
|
|
title: "通道数", |
|
|
dataIndex: "size", |
|
|
dataIndex: "channelCount", |
|
|
key: "c", |
|
|
key: "c", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "端口", |
|
|
title: "端口", |
|
|
dataIndex: "size", |
|
|
dataIndex: "port", |
|
|
key: "d", |
|
|
key: "d", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
@ -111,7 +117,7 @@ const NvrHeader = (props) => { |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "创建时间", |
|
|
title: "创建时间", |
|
|
dataIndex: "size", |
|
|
dataIndex: "createTime", |
|
|
key: "f", |
|
|
key: "f", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
@ -139,6 +145,7 @@ const NvrHeader = (props) => { |
|
|
setSetupp(columns); |
|
|
setSetupp(columns); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//条件赛选样式 |
|
|
const screen = { |
|
|
const screen = { |
|
|
width: 193, |
|
|
width: 193, |
|
|
marginRight: 20, |
|
|
marginRight: 20, |
|
@ -146,35 +153,6 @@ const NvrHeader = (props) => { |
|
|
color: "rgba(0, 0, 0, 0.65)", |
|
|
color: "rgba(0, 0, 0, 0.65)", |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const data = [ |
|
|
|
|
|
{ |
|
|
|
|
|
key: "1", |
|
|
|
|
|
name: "智能设备NVR1", |
|
|
|
|
|
nameIconSrc: "12", |
|
|
|
|
|
size: "飞尚科技1", |
|
|
|
|
|
owner: "192.168.1.1", |
|
|
|
|
|
updateTime: "5000", |
|
|
|
|
|
avatarBg: "red", |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
key: "2", |
|
|
|
|
|
name: "智能设备NVR2", |
|
|
|
|
|
nameIconSrc: "8", |
|
|
|
|
|
size: "飞尚科技2", |
|
|
|
|
|
owner: "192.168.1.3", |
|
|
|
|
|
updateTime: "5001", |
|
|
|
|
|
avatarBg: "green", |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
key: "3", |
|
|
|
|
|
name: "智能设备NVR3", |
|
|
|
|
|
nameIconSrc: "9", |
|
|
|
|
|
size: "飞尚科技3", |
|
|
|
|
|
owner: "192.168.1.2", |
|
|
|
|
|
updateTime: "5002", |
|
|
|
|
|
avatarBg: "green", |
|
|
|
|
|
}, |
|
|
|
|
|
]; |
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div style={{ position: "" }}> |
|
|
<div style={{ position: "" }}> |
|
@ -386,14 +364,29 @@ const NvrHeader = (props) => { |
|
|
</div> |
|
|
</div> |
|
|
<Table |
|
|
<Table |
|
|
columns={setupp} |
|
|
columns={setupp} |
|
|
dataSource={data} |
|
|
dataSource={equipmentWarehouseNvr.data} |
|
|
pagination={false} |
|
|
|
|
|
bordered={false} |
|
|
bordered={false} |
|
|
empty="暂无数据" |
|
|
empty="暂无数据" |
|
|
style={{ |
|
|
style={{ |
|
|
padding: "0px 20px", |
|
|
padding: "0px 20px", |
|
|
}} |
|
|
}} |
|
|
|
|
|
pagination={false} |
|
|
|
|
|
/> |
|
|
|
|
|
<div style={{display: "flex", justifyContent:"flex-end",padding:"20px 20px"}}> |
|
|
|
|
|
<span style={{lineHeight:"30px"}}>共{equipmentWarehouseNvr.total}个设备</span> |
|
|
|
|
|
<Pagination |
|
|
|
|
|
className="22" |
|
|
|
|
|
total={equipmentWarehouseNvr.total} |
|
|
|
|
|
showSizeChanger |
|
|
|
|
|
pageSizeOpts={[10, 20, 30,40 ]} |
|
|
|
|
|
onChange={(currentPage,pageSize)=>{ |
|
|
|
|
|
setPagination({limit:pageSize,page:currentPage-1}) |
|
|
|
|
|
console.log(currentPage,pageSize); |
|
|
|
|
|
}} |
|
|
/> |
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{setup ? ( |
|
|
{setup ? ( |
|
|
<Setup |
|
|
<Setup |
|
|
visible={true} |
|
|
visible={true} |
|
@ -401,10 +394,7 @@ const NvrHeader = (props) => { |
|
|
close={() => { |
|
|
close={() => { |
|
|
setSetup(false); |
|
|
setSetup(false); |
|
|
attribute(); |
|
|
attribute(); |
|
|
// setEditData(null) |
|
|
|
|
|
}} |
|
|
}} |
|
|
// reportType={reportType} |
|
|
|
|
|
// editData={editData} |
|
|
|
|
|
/> |
|
|
/> |
|
|
) : ( |
|
|
) : ( |
|
|
"" |
|
|
"" |
|
@ -426,12 +416,13 @@ const NvrHeader = (props) => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function mapStateToProps(state) { |
|
|
function mapStateToProps(state) { |
|
|
const { auth, global, members } = state; |
|
|
const { auth, global, members, equipmentWarehouseNvr } = 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 || [], |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|