diff --git a/web-network/client/src/sections/network/components/device-tree/index.js b/web-network/client/src/sections/network/components/device-tree/index.js
index 48f8c6b..579934e 100644
--- a/web-network/client/src/sections/network/components/device-tree/index.js
+++ b/web-network/client/src/sections/network/components/device-tree/index.js
@@ -17,7 +17,7 @@ const { ModifyEquipmentNetworking } = AuthorizationCode;
export default function ({ ...props }) {
const {
- dispatch, actions, clientHeight, deviceMetasWithFollow, deviceList, dimensionlist, struct, token
+ dispatch, actions, clientHeight, deviceMetasWithFollow, deviceList, dimensionlist, struct, token, thingStatus
} = props;
const [g6TreeDirection, setG6TreeDirection] = useSafeState('TB');
const [devices, setDevices] = useSafeState(null);
@@ -256,7 +256,7 @@ export default function ({ ...props }) {
{
- devices?.instances
+ devices?.instances && thingStatus.length > 0 && deviceMetasWithFollow?.devices?.length > 0
&& (
)
}
diff --git a/web-network/client/src/sections/network/components/device-tree/zuwang-main.js b/web-network/client/src/sections/network/components/device-tree/zuwang-main.js
index 5d7143d..c21dc66 100644
--- a/web-network/client/src/sections/network/components/device-tree/zuwang-main.js
+++ b/web-network/client/src/sections/network/components/device-tree/zuwang-main.js
@@ -20,7 +20,7 @@ export default function ({ ...props }) {
const {
struct, data, resetFoldAllG6ToCenter, foldAllG6ToCenter, g6TreeDirection, emitChange, emitDataChange_,
width, height, collapseAll, collapsed, expanded, expandAll, changeFinish, targetNode, inputSearching, setInputSearching,
- onCollapse, handleNodeEnter, handelNodeClick, token, dispatch, actions
+ onCollapse, handleNodeEnter, handelNodeClick, token, dispatch, actions, thingStatus
} = props;
const [isGetLinkStateDone, { setTrue, setFalse }] = useBoolean(false);
const [devicesLinkState, setDevicesLinkState] = useSafeState(null);
@@ -242,21 +242,21 @@ export default function ({ ...props }) {
defaultTreeNodesCheckedKeys.push(a.id);
} else if (deviceInfo[deviceIds[i]].type == 's.d') {
let linkState = null;
- if (devicesLinkState) {
- linkState = devicesLinkState.find((dls) => dls.deviceId == deviceIds[i]);
- if (linkState) {
- linkState = linkState.status;
- }
- }
let linkStateMsg = '';
let LinlStateColor = '#666666';
- if ((linkState != null || linkState != undefined)) {
- if (linkState == 1) {
- // linkStateMsg = "(在线)"
- } else if (linkState == 0) {
- linkStateMsg = '(离线)';
- LinlStateColor = 'red';
+ let thingStatusFind = thingStatus?.find(d => d.deviceId == deviceIds[i])
+ if (thingStatusFind) {
+ linkState = thingStatusFind?.status
+ if (thingStatusFind?.status == 0) {
+ LinlStateColor = 'red'
+ linkStateMsg = '(离线)'
+ if (deviceInfo[deviceIds[i]]?.instance?.properties?.deviceType == "sensor") {
+ linkStateMsg += `\n 最后一条数据时间: \n ${moment(thingStatusFind?.latestTime).format("YYYY-MM-DD HH:mm:ss")}`
+ } else {
+ linkStateMsg += `\n 离线时间:\n ${moment(thingStatusFind?.offsetTime).format("YYYY-MM-DD HH:mm:ss")}`
+ }
}
+
}
const a = {
diff --git a/web-network/client/src/sections/network/containers/device-monitor.js b/web-network/client/src/sections/network/containers/device-monitor.js
index 8289e52..cb9cad8 100644
--- a/web-network/client/src/sections/network/containers/device-monitor.js
+++ b/web-network/client/src/sections/network/containers/device-monitor.js
@@ -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 }) {
设备总数:
{' '}
- {dataSource.length}
+ {thingStatus?.length || 0}
{' '}
个;
异常设备:
- {dataSource.filter((f) => f.status === 'alarm').length}
+ {thingStatus.filter((f) => f.status == 0)?.length || 0}
{' '}
个;
正常设备:
- {dataSource.filter((f) => f.status === 'normal').length}
+ {thingStatus.filter((f) => f.status != 0)?.length || 0}
{' '}
个;
@@ -117,12 +117,12 @@ function DeviceMonitor ({ ...props }) {
return (
-
+
{
extraType === 'tree'
? deviceMetasWithFollow?.devices?.length > 0
- && devices.instances
+ && devices.instances && thingStatus.length > 0
? (
) :
: (
@@ -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 || []
};
}