|
|
@ -18,7 +18,7 @@ import TableShow from './tableShow' |
|
|
|
function DeviceMonitor ({ ...props }) { |
|
|
|
const { |
|
|
|
dispatch, actions, user, clientWidth, clientHeight, loading, |
|
|
|
myStructList, deviceMetasWithFollow, devices, dimensions, deviceListAlarms, factorStations, |
|
|
|
myStructList, deviceMetasWithFollow, devices, dimensions, deviceListAlarms, factorStations, thingStatus, |
|
|
|
} = props; |
|
|
|
|
|
|
|
const { analysis } = actions |
|
|
@ -101,15 +101,15 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
<div className="device-monitor"> |
|
|
|
设备总数: |
|
|
|
{' '} |
|
|
|
{dataSource.length} |
|
|
|
{thingStatus?.length || 0} |
|
|
|
{' '} |
|
|
|
个; |
|
|
|
异常设备: |
|
|
|
<span className="title-alarm">{dataSource.filter((f) => f.status === 'alarm').length}</span> |
|
|
|
<span className="title-alarm">{thingStatus.filter((f) => f.status == 0)?.length || 0}</span> |
|
|
|
{' '} |
|
|
|
个; |
|
|
|
正常设备: |
|
|
|
<span className="title-normal">{dataSource.filter((f) => f.status === 'normal').length}</span> |
|
|
|
<span className="title-normal">{thingStatus.filter((f) => f.status != 0)?.length || 0}</span> |
|
|
|
{' '} |
|
|
|
个; |
|
|
|
</div> |
|
|
@ -117,12 +117,12 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<Spin spinning={false}> |
|
|
|
<Spin spinning={loading}> |
|
|
|
<ProCard title={renderTitle()} extra={renderExtra()} headerBordered> |
|
|
|
{ |
|
|
|
extraType === 'tree' |
|
|
|
? deviceMetasWithFollow?.devices?.length > 0 |
|
|
|
&& devices.instances |
|
|
|
&& devices.instances && thingStatus.length > 0 |
|
|
|
? ( |
|
|
|
<DeviceTree |
|
|
|
deviceMetasWithFollow={deviceMetasWithFollow} |
|
|
@ -134,7 +134,7 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
clientHeight={clientHeight} |
|
|
|
clientWidth={clientWidth} |
|
|
|
token={token} |
|
|
|
|
|
|
|
thingStatus={thingStatus} |
|
|
|
/> |
|
|
|
) : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> |
|
|
|
: ( |
|
|
@ -148,10 +148,10 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
const { |
|
|
|
auth, global, myStructList, deviceMeta, deviceList, dimensionsList, deviceListAlarms, factorStations, |
|
|
|
auth, global, myStructList, deviceMeta, deviceList, dimensionsList, deviceListAlarms, factorStations, thingStatus |
|
|
|
} = state; |
|
|
|
return { |
|
|
|
loading: myStructList?.isRequesting || deviceMeta?.isRequesting || deviceList?.isRequesting || dimensionsList?.isRequesting, |
|
|
|
loading: deviceMeta?.isRequesting || deviceList?.isRequesting || dimensionsList?.isRequesting || thingStatus?.isRequesting, |
|
|
|
user: auth?.user, |
|
|
|
actions: global?.actions, |
|
|
|
clientWidth: global?.clientWidth, |
|
|
@ -162,6 +162,7 @@ function mapStateToProps (state) { |
|
|
|
dimensions: dimensionsList?.data || { dimensions: [], total: 0 }, |
|
|
|
deviceListAlarms: deviceListAlarms?.data || [], |
|
|
|
factorStations: factorStations?.data || [], |
|
|
|
thingStatus: thingStatus?.data || [] |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|