|
@ -1,31 +1,47 @@ |
|
|
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 [venderList, setvenderList] = useState([]); //厂商信息 |
|
|
|
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }); |
|
|
const SETUPS = "setups"; |
|
|
const SETUPS = "setups"; |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
dispatch(actions.equipmentWarehouse.getVender()).then((res) => { |
|
|
|
|
|
setvenderList(res.payload.data); |
|
|
|
|
|
}); |
|
|
|
|
|
//初始化表格显示设置 |
|
|
|
|
|
localStorage.setItem(SETUPS, JSON.stringify(["a", "c", "d", "e"])); |
|
|
|
|
|
attribute(); |
|
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
equipmentGetNvr(); |
|
|
|
|
|
}, [query]); |
|
|
|
|
|
|
|
|
|
|
|
function equipmentGetNvr() { |
|
|
|
|
|
dispatch(equipmentWarehouse.getNvr(query)); |
|
|
|
|
|
} |
|
|
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> |
|
@ -57,7 +73,14 @@ const NvrHeader = (props) => { |
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<Button theme="borderless"> |
|
|
<Button theme="borderless"> |
|
|
<NvrModal nvrData={row} modalName="revise" /> |
|
|
<NvrModal |
|
|
|
|
|
nvrData={row} |
|
|
|
|
|
modalName="revise" |
|
|
|
|
|
venderList={venderList} |
|
|
|
|
|
close={() => { |
|
|
|
|
|
equipmentGetNvr(); |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
</Button> |
|
|
</Button> |
|
|
<Button |
|
|
<Button |
|
|
theme="borderless" |
|
|
theme="borderless" |
|
@ -67,16 +90,16 @@ const NvrHeader = (props) => { |
|
|
> |
|
|
> |
|
|
查看 |
|
|
查看 |
|
|
</Button> |
|
|
</Button> |
|
|
<Button theme="borderless">删除</Button> |
|
|
<Button theme="borderless" onClick={()=>{ |
|
|
|
|
|
dispatch(equipmentWarehouse.delNvr(row.id)); |
|
|
|
|
|
equipmentGetNvr(); |
|
|
|
|
|
}}>删除</Button> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
attribute(); |
|
|
|
|
|
}, []); |
|
|
|
|
|
//获取表格属性设置 |
|
|
//获取表格属性设置 |
|
|
function attribute() { |
|
|
function attribute() { |
|
|
const arr = localStorage.getItem(SETUPS) |
|
|
const arr = localStorage.getItem(SETUPS) |
|
@ -86,22 +109,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 +134,7 @@ const NvrHeader = (props) => { |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "创建时间", |
|
|
title: "创建时间", |
|
|
dataIndex: "size", |
|
|
dataIndex: "createTime", |
|
|
key: "f", |
|
|
key: "f", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
@ -139,6 +162,7 @@ const NvrHeader = (props) => { |
|
|
setSetupp(columns); |
|
|
setSetupp(columns); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//条件赛选样式 |
|
|
const screen = { |
|
|
const screen = { |
|
|
width: 193, |
|
|
width: 193, |
|
|
marginRight: 20, |
|
|
marginRight: 20, |
|
@ -146,35 +170,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: "" }}> |
|
@ -220,7 +215,13 @@ const NvrHeader = (props) => { |
|
|
cursor: "pointer", |
|
|
cursor: "pointer", |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<NvrModal modalName="add" /> |
|
|
<NvrModal |
|
|
|
|
|
modalName="add" |
|
|
|
|
|
venderList={venderList} |
|
|
|
|
|
close={() => { |
|
|
|
|
|
equipmentGetNvr(); |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -249,7 +250,6 @@ const NvrHeader = (props) => { |
|
|
<div style={{ display: "flex" }}> |
|
|
<div style={{ display: "flex" }}> |
|
|
<Form |
|
|
<Form |
|
|
onSubmit={(values) => console.log(values)} |
|
|
onSubmit={(values) => console.log(values)} |
|
|
// labelPosition='top' |
|
|
|
|
|
layout="horizontal" |
|
|
layout="horizontal" |
|
|
style={{ position: "relative", width: "100%", flex: 1 }} |
|
|
style={{ position: "relative", width: "100%", flex: 1 }} |
|
|
> |
|
|
> |
|
@ -266,8 +266,13 @@ const NvrHeader = (props) => { |
|
|
field="type1" |
|
|
field="type1" |
|
|
placeholder="全部" |
|
|
placeholder="全部" |
|
|
> |
|
|
> |
|
|
<Form.Select.Option value="f1">飞尚科技1</Form.Select.Option> |
|
|
{venderList.map((item) => { |
|
|
<Form.Select.Option value="f2">飞尚科技2</Form.Select.Option> |
|
|
return ( |
|
|
|
|
|
<Form.Select.Option key={item.id} value={item.id}> |
|
|
|
|
|
{item.name} |
|
|
|
|
|
</Form.Select.Option> |
|
|
|
|
|
); |
|
|
|
|
|
})} |
|
|
</Form.Select> |
|
|
</Form.Select> |
|
|
<Form.Select |
|
|
<Form.Select |
|
|
label="状态查询:" |
|
|
label="状态查询:" |
|
@ -308,6 +313,7 @@ const NvrHeader = (props) => { |
|
|
marginBottom: 20, |
|
|
marginBottom: 20, |
|
|
marginRight: 20, |
|
|
marginRight: 20, |
|
|
}} |
|
|
}} |
|
|
|
|
|
onClick={() => {}} |
|
|
> |
|
|
> |
|
|
搜素 |
|
|
搜素 |
|
|
</Button> |
|
|
</Button> |
|
@ -386,14 +392,36 @@ 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) => { |
|
|
|
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
|
|
console.log(currentPage, pageSize); |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
{setup ? ( |
|
|
{setup ? ( |
|
|
<Setup |
|
|
<Setup |
|
|
visible={true} |
|
|
visible={true} |
|
@ -401,10 +429,7 @@ const NvrHeader = (props) => { |
|
|
close={() => { |
|
|
close={() => { |
|
|
setSetup(false); |
|
|
setSetup(false); |
|
|
attribute(); |
|
|
attribute(); |
|
|
// setEditData(null) |
|
|
|
|
|
}} |
|
|
}} |
|
|
// reportType={reportType} |
|
|
|
|
|
// editData={editData} |
|
|
|
|
|
/> |
|
|
/> |
|
|
) : ( |
|
|
) : ( |
|
|
"" |
|
|
"" |
|
@ -426,12 +451,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 || [], |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|