10 changed files with 680 additions and 689 deletions
			
			
		| @ -1,332 +1,332 @@ | |||||
| import React, { useEffect, useState, useRef, useMemo } from 'react' | import React, { useEffect, useState, useRef, useMemo } from 'react' | ||||
| import { connect } from 'react-redux' | import { connect } from 'react-redux' | ||||
| import { Spin, Card, CardGroup, Form,Select ,Input, Button, Table, Pagination, Tooltip } from 'antd' | import { Spin, Card, CardGroup, Form, Select, Input, Button, Table, Pagination, Tooltip } from 'antd' | ||||
| import ExportData from '../components/export-data' | import ExportData from '../components/export-data' | ||||
| import moment from 'moment' | import moment from 'moment' | ||||
| 
 | 
 | ||||
| const Network = props => { | const Network = props => { | ||||
|   const { dispatch, actions, user, clientHeight, thingId, deviceListAlarms, devicesCardStatusList, project } = props |    const { dispatch, actions, user, clientHeight, thingId, deviceListAlarms, devicesCardStatusList, project, token } = props | ||||
|   const { analysis } = actions |    const { analysis } = actions | ||||
|   const form = useRef() //表单
 |    const form = useRef() //表单
 | ||||
|   const [deployData, setDeployData] = useState([]) |    const [deployData, setDeployData] = useState([]) | ||||
|   const [deviceData, setDeviceData] = useState([]) |    const [deviceData, setDeviceData] = useState([]) | ||||
|   const [deviceMetasDeployed, setDeviceMetasDeployed] = useState([]) |    const [deviceMetasDeployed, setDeviceMetasDeployed] = useState([]) | ||||
|   const [sensorId, setSensorId] = useState([]) |    const [sensorId, setSensorId] = useState([]) | ||||
|   const [sensorsDataItems, setSensorsDataItems] = useState({}) |    const [sensorsDataItems, setSensorsDataItems] = useState({}) | ||||
|   const [tableData, setTableData] = useState([]) //最新一次的数据
 |    const [tableData, setTableData] = useState([]) //最新一次的数据
 | ||||
|   const [lastData, setLastData] = useState([]) //最终数据
 |    const [lastData, setLastData] = useState([]) //最终数据
 | ||||
|   const [lastDataCopy, setLastDataCopy] = useState([]) //最终数据
 |    const [lastDataCopy, setLastDataCopy] = useState([]) //最终数据
 | ||||
|   const [searchType, setSearchType] = useState('') |    const [searchType, setSearchType] = useState('') | ||||
|   const [searchName, setSearchName] = useState('') |    const [searchName, setSearchName] = useState('') | ||||
|   const [typeList, setTypeList] = useState([]) |    const [typeList, setTypeList] = useState([]) | ||||
|   const [query, setQuery] = useState({ limit: 10, page: 0 }) //页码信息
 |    const [query, setQuery] = useState({ limit: 10, page: 0 }) //页码信息
 | ||||
| 
 | 
 | ||||
|   const DeviceTypes = { |    const DeviceTypes = { | ||||
|     'DTU': 'DTU', |       'DTU': 'DTU', | ||||
|     'gateway': '网关', |       'gateway': '网关', | ||||
|     'sensor': '传感器', |       'sensor': '传感器', | ||||
|     'acqUnit': '采集单元', |       'acqUnit': '采集单元', | ||||
|     'dau.gateway': '分布式智能云采集网关', |       'dau.gateway': '分布式智能云采集网关', | ||||
|     'dau.node': '分布式智能云采集节点', |       'dau.node': '分布式智能云采集节点', | ||||
|     'tcp.dtu': '工作站', |       'tcp.dtu': '工作站', | ||||
|   } |    } | ||||
| 
 | 
 | ||||
|   useEffect(() => { |    useEffect(() => { | ||||
|     setLastData([]) |       setLastData([]) | ||||
|     setLastDataCopy([]) |       setLastDataCopy([]) | ||||
|   }, [project]) |    }, [project]) | ||||
| 
 | 
 | ||||
|   useEffect(() => { |    useEffect(() => { | ||||
|     if (thingId) { |       if (thingId) { | ||||
|       let dataList = [] |          let dataList = [] | ||||
|       dispatch(analysis.getThingsDeploy(thingId)).then(rs => { |          dispatch(analysis.getThingsDeploy(thingId, token)).then(rs => { | ||||
|         if (rs.success) { |             if (rs.success) { | ||||
|           setDeployData(rs.payload.data) |                setDeployData(rs.payload.data) | ||||
|           dataList = rs.payload.data |                dataList = rs.payload.data | ||||
|           //列表渲染数据
 |                //列表渲染数据
 | ||||
|           let da = [] |                let da = [] | ||||
|           if (dataList.instances) { |                if (dataList.instances) { | ||||
|             Object.keys(dataList.instances).forEach(i => { |                   Object.keys(dataList.instances).forEach(i => { | ||||
|               if (dataList.instances[i].type == 's.d') { |                      if (dataList.instances[i].type == 's.d') { | ||||
|                 da.push({ |                         da.push({ | ||||
|                   sensorId: i, |                            sensorId: i, | ||||
|                   sensorName: dataList.instances[i]?.name, |                            sensorName: dataList.instances[i]?.name, | ||||
|                   deviceType: dataList?.instances[i]?.instance?.properties?.deviceType, |                            deviceType: dataList?.instances[i]?.instance?.properties?.deviceType, | ||||
|                   collectTime: '--', |                            collectTime: '--', | ||||
|                   data: '--', |                            data: '--', | ||||
|                   iotCardStatus: '--', |                            iotCardStatus: '--', | ||||
|                   status: '--', |                            status: '--', | ||||
|                   option: '--', |                            option: '--', | ||||
|                 }) |                         }) | ||||
|               } |                      } | ||||
|             }) |                   }) | ||||
|           } |                } | ||||
| 
 | 
 | ||||
|           dispatch(analysis.findDeviceMetaDeployed(thingId)).then(res => { |                dispatch(analysis.findDeviceMetaDeployed(thingId, token)).then(res => { | ||||
|             if (res.success) { |                   if (res.success) { | ||||
|               setDeviceMetasDeployed(res.payload.data) |                      setDeviceMetasDeployed(res.payload.data) | ||||
|               const deviceMetaDeployed = res.payload.data |                      const deviceMetaDeployed = res.payload.data | ||||
|               if (deviceMetaDeployed && dataList && deviceMetaDeployed.devices) { |                      if (deviceMetaDeployed && dataList && deviceMetaDeployed.devices) { | ||||
|                 const sensorsId = [] |                         const sensorsId = [] | ||||
|                 let deviceIds = [] //所有设备的id
 |                         let deviceIds = [] //所有设备的id
 | ||||
|                 const sensorsDataItems = {} |                         const sensorsDataItems = {} | ||||
|                 for (const id in dataList.instances) { |                         for (const id in dataList.instances) { | ||||
|                   deviceIds.push(id) |                            deviceIds.push(id) | ||||
|                   const instances = dataList.instances[id] |                            const instances = dataList.instances[id] | ||||
| 
 | 
 | ||||
|                   if (instances.type == 's.d' && instances.instance.properties.deviceType == 'sensor') { |                            if (instances.type == 's.d' && instances.instance.properties.deviceType == 'sensor') { | ||||
|                     const meta = deviceMetaDeployed.devices.find(m => m.id == instances.instance.deviceMetaId) |                               const meta = deviceMetaDeployed.devices.find(m => m.id == instances.instance.deviceMetaId) | ||||
|                     sensorsDataItems[id] = { |                               sensorsDataItems[id] = { | ||||
|                       items: {}, |                                  items: {}, | ||||
|                       deviceName: instances.name, |                                  deviceName: instances.name, | ||||
|                     } |                               } | ||||
|                     if (meta) { |                               if (meta) { | ||||
|                       sensorsDataItems[id].items = meta.capabilities[0].properties.reduce((p, n) => { |                                  sensorsDataItems[id].items = meta.capabilities[0].properties.reduce((p, n) => { | ||||
|                         if (n.category == 'Output') { |                                     if (n.category == 'Output') { | ||||
|                           p[n.name] = { name: n.showName, unit: n.unit } |                                        p[n.name] = { name: n.showName, unit: n.unit } | ||||
|  |                                     } | ||||
|  |                                     return p | ||||
|  |                                  }, {}) | ||||
|  |                               } | ||||
|  |                               sensorsId.push(id) | ||||
|  |                            } | ||||
|                         } |                         } | ||||
|                         return p |                         dispatch(analysis.getDevicesAlarms(deviceIds, { limit: 5 }, token)) | ||||
|                       }, {}) |                         dispatch(analysis.findDevicesCardStatus({ deviceIds: alarmSensorId }, token)) | ||||
|                     } |                         setSensorsDataItems(sensorsDataItems) | ||||
|                     sensorsId.push(id) |                         setSensorId(sensorsId) | ||||
|  |                         setDeviceData(da) | ||||
|  |                      } | ||||
|                   } |                   } | ||||
|                 } |                }) | ||||
|                 dispatch(analysis.getDevicesAlarms(deviceIds , { limit: 5 })) |  | ||||
|                 dispatch(analysis.findDevicesCardStatus({ deviceIds: alarmSensorId })) |  | ||||
|                 setSensorsDataItems(sensorsDataItems) |  | ||||
|                 setSensorId(sensorsId) |  | ||||
|                 setDeviceData(da) |  | ||||
|               } |  | ||||
|             } |             } | ||||
|           }) |          }) | ||||
|         } |       } | ||||
|       }) |    }, [thingId]) | ||||
|     } |    useEffect(async () => { | ||||
|   }, [thingId]) |       if (sensorId && sensorId.length && sensorsDataItems) { | ||||
|   useEffect(async () => { |          const rs = await dispatch(analysis.findSensorLastData(sensorId, token)) | ||||
|     if (sensorId && sensorId.length && sensorsDataItems) { |          const tableData = [] | ||||
|       const rs = await dispatch(analysis.findSensorLastData(sensorId)) |          if (rs.success) { | ||||
|       const tableData = [] |             rs.payload.data.forEach(sd => { | ||||
|       if (rs.success) { |                if (Object.keys(sensorsDataItems).length) { | ||||
|         rs.payload.data.forEach(sd => { |                   let sensorDataItem = sensorsDataItems[sd.sensorId] | ||||
|           if (Object.keys(sensorsDataItems).length) { |                   let sensorName = sensorDataItem && sensorDataItem.deviceName ? sensorDataItem.deviceName : '' | ||||
|             let sensorDataItem = sensorsDataItems[sd.sensorId] |                   let msg = sd.data.length | ||||
|             let sensorName = sensorDataItem && sensorDataItem.deviceName ? sensorDataItem.deviceName : '' |                      ? sd.data[0] | ||||
|             let msg = sd.data.length |                      : { | ||||
|               ? sd.data[0] |                         collectTime: null, | ||||
|               : { |                         sensorName: sensorName, | ||||
|                   collectTime: null, |                         data: { noData: '暂无数据' }, | ||||
|                   sensorName: sensorName, |                      } | ||||
|                   data: { noData: '暂无数据' }, |                   let dataStr = '' | ||||
|                 } |                   let dataKeys = Object.keys(msg.data) | ||||
|             let dataStr = '' |                   dataKeys.forEach(k => { | ||||
|             let dataKeys = Object.keys(msg.data) |                      let item = sensorDataItem && sensorDataItem.items ? sensorDataItem.items[k] : null | ||||
|             dataKeys.forEach(k => { |                      if (item) { | ||||
|               let item = sensorDataItem && sensorDataItem.items ? sensorDataItem.items[k] : null |                         dataStr += `${item.name}:${msg.data[k]}(${item.unit}); ` | ||||
|               if (item) { |                      } else if (k == 'noData') { | ||||
|                 dataStr += `${item.name}:${msg.data[k]}(${item.unit}); ` |                         dataStr += msg.data[k] | ||||
|               } else if (k == 'noData') { |                      } else { | ||||
|                 dataStr += msg.data[k] |                         dataStr += `${k}:${msg.data[k]};` | ||||
|               } else { |                      } | ||||
|                 dataStr += `${k}:${msg.data[k]};` |                   }) | ||||
|               } |                   let collectTime = msg.collectTime ? moment(msg.collectTime).format('YYYY-MM-DD HH:mm:ss') : '--' | ||||
|             }) |                   tableData.push({ | ||||
|             let collectTime = msg.collectTime ? moment(msg.collectTime).format('YYYY-MM-DD HH:mm:ss') : '--' |                      sensorId: sd.sensorId, | ||||
|             tableData.push({ |                      sensorName: sensorName, | ||||
|               sensorId: sd.sensorId, |                      collectTime: collectTime, | ||||
|               sensorName: sensorName, |                      data: dataStr, | ||||
|               collectTime: collectTime, |                      deviceType: 'sensor', //传感器
 | ||||
|               data: dataStr, |                      iotCardStatus: '--', | ||||
|               deviceType: 'sensor', //传感器
 |                      status: '--', | ||||
|               iotCardStatus: '--', |                      option: '--', | ||||
|               status: '--', |                   }) | ||||
|               option: '--', |                } | ||||
|             }) |             }) | ||||
|           } |          } | ||||
|         }) |          setTableData(tableData) | ||||
|  |       } | ||||
|  |    }, [sensorId]) | ||||
|  |    useEffect(() => { | ||||
|  |       if (deviceData && deviceData.length) { | ||||
|  |          const dataD = deviceData?.map(p => { | ||||
|  |             const objRslt = tableData?.find(q => q.sensorId == p.sensorId) | ||||
|  |             return { | ||||
|  |                sensorId: objRslt ? objRslt.sensorId : p.sensorId, | ||||
|  |                sensorName: objRslt ? objRslt.sensorName : p.sensorName, | ||||
|  |                collectTime: objRslt ? objRslt.collectTime : p.collectTime, | ||||
|  |                data: objRslt ? objRslt.data : p.data, | ||||
|  |                deviceType: DeviceTypes[objRslt ? objRslt.deviceType : p.deviceType], | ||||
|  |                iotCardStatus: | ||||
|  |                   devicesCardStatusList && devicesCardStatusList.length | ||||
|  |                      ? devicesCardStatusList.find(v => v.deviceId == p.sensorId).status === 0 | ||||
|  |                         ? '正常' | ||||
|  |                         : devicesCardStatusList.find(v => v.deviceId == p.sensorId).status === 1 | ||||
|  |                            ? '未激活' | ||||
|  |                            : '停机' | ||||
|  |                      : '--', | ||||
|  |                status: | ||||
|  |                   deviceListAlarms && deviceListAlarms.length | ||||
|  |                      ? deviceListAlarms?.find(v => v.deviceId == p.sensorId) | ||||
|  |                         ? '异常' | ||||
|  |                         : '正常' | ||||
|  |                      : '--', | ||||
|  |                option: objRslt ? objRslt.option : p.option, | ||||
|  |             } | ||||
|  |          }) | ||||
|  |          const typeList = dataD.reduce((p, c) => { | ||||
|  |             let isExist = p.some(q => q.label === c.deviceType) | ||||
|  |             if (!isExist) { | ||||
|  |                p.push({ label: c.deviceType, value: c.sensorId }) | ||||
|  |             } | ||||
|  |             return p | ||||
|  |          }, []) | ||||
|  |          setTypeList(typeList) | ||||
|  |          setLastData(dataD) | ||||
|  |          setLastDataCopy(dataD) | ||||
|       } |       } | ||||
|       setTableData(tableData) |    }, [deviceData]) | ||||
|     } |    //   const lastDataCopy=useMemo(()=>{
 | ||||
|   }, [sensorId]) |    //       return lastData
 | ||||
|   useEffect(() => { |    //   },[thingId])
 | ||||
|     if (deviceData && deviceData.length ) { |    const scroll = useMemo(() => ({ y: clientHeight - 600 + 175 + 175 }), []) | ||||
|       const dataD = deviceData?.map(p => { |    //名称回调事件
 | ||||
|         const objRslt = tableData?.find(q => q.sensorId == p.sensorId) |    const inputChange = e => { | ||||
|         return { |       setSearchName(e.target.value) | ||||
|           sensorId: objRslt ? objRslt.sensorId : p.sensorId, |    } | ||||
|           sensorName: objRslt ? objRslt.sensorName : p.sensorName, |    //选择设备类型下拉框回调
 | ||||
|           collectTime: objRslt ? objRslt.collectTime : p.collectTime, |    const selectChange = e => { | ||||
|           data: objRslt ? objRslt.data : p.data, |       let rslt = typeList.find(f => f.value == e) | ||||
|           deviceType: DeviceTypes[objRslt ? objRslt.deviceType : p.deviceType], |       setSearchType(rslt ? rslt.label : undefined) | ||||
|           iotCardStatus: |    } | ||||
|             devicesCardStatusList && devicesCardStatusList.length |  | ||||
|               ? devicesCardStatusList.find(v => v.deviceId == p.sensorId).status === 0 |  | ||||
|                 ? '正常' |  | ||||
|                 : devicesCardStatusList.find(v => v.deviceId == p.sensorId).status === 1 |  | ||||
|                 ? '未激活' |  | ||||
|                 : '停机' |  | ||||
|               : '--', |  | ||||
|           status: |  | ||||
|             deviceListAlarms && deviceListAlarms.length |  | ||||
|               ? deviceListAlarms?.find(v => v.deviceId == p.sensorId) |  | ||||
|                 ? '异常' |  | ||||
|                 : '正常' |  | ||||
|               : '--', |  | ||||
|           option: objRslt ? objRslt.option : p.option, |  | ||||
|         } |  | ||||
|       }) |  | ||||
|       const typeList = dataD.reduce((p, c) => { |  | ||||
|         let isExist = p.some(q => q.label === c.deviceType) |  | ||||
|         if (!isExist) { |  | ||||
|           p.push({ label: c.deviceType, value: c.sensorId }) |  | ||||
|         } |  | ||||
|         return p |  | ||||
|       }, []) |  | ||||
|       setTypeList(typeList) |  | ||||
|       setLastData(dataD) |  | ||||
|       setLastDataCopy(dataD) |  | ||||
|     } |  | ||||
|   }, [deviceData]) |  | ||||
|   //   const lastDataCopy=useMemo(()=>{
 |  | ||||
|   //       return lastData
 |  | ||||
|   //   },[thingId])
 |  | ||||
|   const scroll = useMemo(() => ({ y:clientHeight-600+175+175 }), []) |  | ||||
|   //名称回调事件
 |  | ||||
|   const inputChange = e => { |  | ||||
|     setSearchName(e.target.value) |  | ||||
|   } |  | ||||
|   //选择设备类型下拉框回调
 |  | ||||
|   const selectChange = e => { |  | ||||
|     let rslt=typeList.find(f => f.value == e) |  | ||||
|     setSearchType(rslt?rslt.label:undefined) |  | ||||
|   } |  | ||||
| 
 | 
 | ||||
|   //查询事件回调
 |    //查询事件回调
 | ||||
|   const searchHandler = () => { |    const searchHandler = () => { | ||||
|     setLastData( |       setLastData( | ||||
|       lastDataCopy.filter(f =>  |          lastDataCopy.filter(f => | ||||
|         (!searchName || f.sensorName.includes(searchName)) && |             (!searchName || f.sensorName.includes(searchName)) && | ||||
|         (!searchType|| f.deviceType===searchType) |             (!searchType || f.deviceType === searchType) | ||||
|  |          ) | ||||
|       ) |       ) | ||||
|     ) |    } | ||||
|   } |  | ||||
| 
 | 
 | ||||
|   const columns = [ |    const columns = [ | ||||
|     { |       { | ||||
|       title: '设备名称', |          title: '设备名称', | ||||
|       dataIndex: 'sensorName', |          dataIndex: 'sensorName', | ||||
|       width: '20%', |          width: '20%', | ||||
|       key: 'sensorName', |          key: 'sensorName', | ||||
|       render: (_, r) => { |          render: (_, r) => { | ||||
|         return ( |             return ( | ||||
|           <> |                <> | ||||
|             <Tooltip title={r.sensorName}> |                   <Tooltip title={r.sensorName}> | ||||
|               <div>{r.sensorName.length > 7 ? `${r.sensorName.substr(0, 7)}...` : r.sensorName}</div> |                      <div>{r.sensorName.length > 7 ? `${r.sensorName.substr(0, 7)}...` : r.sensorName}</div> | ||||
|             </Tooltip> |                   </Tooltip> | ||||
|           </> |                </> | ||||
|         ) |             ) | ||||
|  |          }, | ||||
|  |       }, | ||||
|  |       { | ||||
|  |          title: '设备类型', | ||||
|  |          dataIndex: 'deviceType', | ||||
|  |          width: '15%', | ||||
|  |          key: 'deviceType', | ||||
|  |       }, | ||||
|  |       { | ||||
|  |          title: '最后采集时间', | ||||
|  |          dataIndex: 'collectTime', | ||||
|  |          width: '15%', | ||||
|  |          key: 'collectTime', | ||||
|  |       }, | ||||
|  |       { | ||||
|  |          title: '数据', | ||||
|  |          dataIndex: 'data', | ||||
|  |          width: '20%', | ||||
|  |          key: 'data', | ||||
|  |          render: (_, r) => { | ||||
|  |             return ( | ||||
|  |                <> | ||||
|  |                   <Tooltip title={r.data}> | ||||
|  |                      <div>{r.data.length > 6 ? `${r.data.substr(0, 6)}...` : r.data}</div> | ||||
|  |                   </Tooltip> | ||||
|  |                </> | ||||
|  |             ) | ||||
|  |          }, | ||||
|  |       }, | ||||
|  |       { | ||||
|  |          title: '物联网卡状态', | ||||
|  |          width: '15%', | ||||
|  |          dataIndex: 'iotCardStatus', | ||||
|  |          key: 'iotCardStatus', | ||||
|  |       }, | ||||
|  |       { | ||||
|  |          title: '状态', | ||||
|  |          width: '10%', | ||||
|  |          dataIndex: 'status', | ||||
|  |          key: 'status', | ||||
|       }, |       }, | ||||
|     }, |       { | ||||
|     { |          title: '操作', | ||||
|       title: '设备类型', |          width: '10%', | ||||
|       dataIndex: 'deviceType', |          dataIndex: 'option', | ||||
|       width:  '15%', |          key: 'option', | ||||
|       key: 'deviceType', |  | ||||
|     }, |  | ||||
|     { |  | ||||
|       title: '最后采集时间', |  | ||||
|       dataIndex: 'collectTime', |  | ||||
|       width:  '15%', |  | ||||
|       key: 'collectTime', |  | ||||
|     }, |  | ||||
|     { |  | ||||
|       title: '数据', |  | ||||
|       dataIndex: 'data', |  | ||||
|       width: '20%', |  | ||||
|       key: 'data', |  | ||||
|       render: (_, r) => { |  | ||||
|         return ( |  | ||||
|           <> |  | ||||
|             <Tooltip title={r.data}> |  | ||||
|               <div>{r.data.length > 6 ? `${r.data.substr(0, 6)}...` : r.data}</div> |  | ||||
|             </Tooltip> |  | ||||
|           </> |  | ||||
|         ) |  | ||||
|       }, |       }, | ||||
|     }, |    ] | ||||
|     { |    return ( | ||||
|       title: '物联网卡状态', |       <> | ||||
|       width: '15%', |          <div style={{ marginBottom: 12, display: 'flex' }}> | ||||
|       dataIndex: 'iotCardStatus', |             <div> | ||||
|       key: 'iotCardStatus', |                <Input // suffix={<IconSearch />}
 | ||||
|     }, |                   label='名称' | ||||
|     { |                   placeholder='请输入设备名称' | ||||
|       title: '状态', |                   pure | ||||
|       width:  '10%', |                   allowClear | ||||
|       dataIndex: 'status', |                   style={{ width: 260, marginRight: 12 }} | ||||
|       key: 'status', |                   onChange={inputChange} /> | ||||
|     }, |                <Select options={typeList} label='设备类型' | ||||
|     { |                   pure | ||||
|       title: '操作', |                   allowClear | ||||
|       width: '10%', |                   onChange={selectChange} | ||||
|       dataIndex: 'option', |                   style={{ width: 260, marginLeft: 12, marginRight: 12 }} | ||||
|       key: 'option', |                   placeholder='请选择设备类型'></Select> | ||||
|     }, |                <Button theme='solid' type='primary' htmlType='submit' onClick={searchHandler}> | ||||
|   ] |                   查询 | ||||
|   return ( |                </Button> | ||||
|     <> |             </div> | ||||
|       <div style={{ marginBottom: 12, display: 'flex' }}> |             <div style={{ marginLeft: 10 }}> | ||||
|         <div> |                {' '} | ||||
|             <Input // suffix={<IconSearch />}
 |                {lastData.length ? ( | ||||
|               label='名称'  |                   <ExportData | ||||
|               placeholder='请输入设备名称' |                      //  showIcon
 | ||||
|               pure |                      fileName='设备列表' | ||||
|               allowClear |                      exportType='fileSaver' | ||||
|               style={{ width: 260, marginRight: 12 }} |                      data={lastData} | ||||
|               onChange={inputChange}/> |                      columns={columns} | ||||
|               <Select options={typeList} label='设备类型' |                      key='export' | ||||
|               pure |                   /> | ||||
|               allowClear |                ) : ( | ||||
|               onChange={selectChange} |                   '' | ||||
|               style={{ width: 260, marginLeft: 12, marginRight: 12 }} |                )} | ||||
|               placeholder='请选择设备类型'></Select> |             </div> | ||||
|             <Button theme='solid' type='primary' htmlType='submit' onClick={searchHandler}> |          </div> | ||||
|               查询 |          <Table | ||||
|             </Button> |             // scroll={scroll}
 | ||||
|         </div> |             columns={columns} | ||||
|         <div style={{ marginLeft: 10 }}> |             dataSource={lastData}></Table> | ||||
|           {' '} |       </> | ||||
|           {lastData.length ? ( |    ) | ||||
|             <ExportData |  | ||||
|               //  showIcon
 |  | ||||
|               fileName='设备列表' |  | ||||
|               exportType='fileSaver' |  | ||||
|               data={lastData} |  | ||||
|               columns={columns} |  | ||||
|               key='export' |  | ||||
|             /> |  | ||||
|           ) : ( |  | ||||
|             '' |  | ||||
|           )} |  | ||||
|         </div> |  | ||||
|       </div> |  | ||||
|       <Table |  | ||||
|         // scroll={scroll}
 |  | ||||
|         columns={columns} |  | ||||
|         dataSource={lastData}></Table> |  | ||||
|     </> |  | ||||
|   ) |  | ||||
| } | } | ||||
| 
 | 
 | ||||
| function mapStateToProps(state) { | function mapStateToProps (state) { | ||||
|   const { auth, global, members, webSocket, deviceListAlarms, devicesCardStatus } = state |    const { auth, global, members, webSocket, deviceListAlarms, devicesCardStatus } = state | ||||
|   return { |    return { | ||||
|     user: auth.user, |       user: auth.user, | ||||
|     actions: global.actions, |       actions: global.actions, | ||||
|     clientHeight: global.clientHeight, |       clientHeight: global.clientHeight, | ||||
|     deviceListAlarms: deviceListAlarms?.data || [], |       deviceListAlarms: deviceListAlarms?.data || [], | ||||
|     devicesCardStatusList: devicesCardStatus?.data || [], |       devicesCardStatusList: devicesCardStatus?.data || [], | ||||
|   } |    } | ||||
| } | } | ||||
| 
 | 
 | ||||
| export default connect(mapStateToProps)(Network) | export default connect(mapStateToProps)(Network) | ||||
|  | |||||
					Loading…
					
					
				
		Reference in new issue