nayota-show-sdk 1.3.111 → 1.3.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1111,9 +1111,25 @@ function createDeviceClassOperations() {
|
|
|
1111
1111
|
},
|
|
1112
1112
|
fromResponse(response) {
|
|
1113
1113
|
const payload = response && response.data && response.status ? response.data : response
|
|
1114
|
-
|
|
1115
|
-
? payload
|
|
1116
|
-
:
|
|
1114
|
+
const data = payload?.data?.data !== undefined
|
|
1115
|
+
? payload.data.data
|
|
1116
|
+
: payload?.data !== undefined
|
|
1117
|
+
? payload.data
|
|
1118
|
+
: payload
|
|
1119
|
+
const normalizedData = {
|
|
1120
|
+
...(data && typeof data === 'object' && !Array.isArray(data) ? data : {}),
|
|
1121
|
+
items: Array.isArray(data?.items)
|
|
1122
|
+
? data.items.map(item => ({
|
|
1123
|
+
...item,
|
|
1124
|
+
deviceClassName: item?.deviceClassName || item?.deviceName || item?.name || '未分类设备'
|
|
1125
|
+
}))
|
|
1126
|
+
: []
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
return {
|
|
1130
|
+
code: Number(payload?.code ?? 0),
|
|
1131
|
+
data: normalizedData
|
|
1132
|
+
}
|
|
1117
1133
|
}
|
|
1118
1134
|
}
|
|
1119
1135
|
|
|
@@ -62,11 +62,12 @@ describe('iotModuleSpecs deviceClass UI compatibility', () => {
|
|
|
62
62
|
|
|
63
63
|
expect(
|
|
64
64
|
deviceClass.onlineRate.fromResponse({
|
|
65
|
-
|
|
65
|
+
success: true,
|
|
66
66
|
data: {
|
|
67
67
|
year: 2026,
|
|
68
68
|
month: 7,
|
|
69
|
-
summary: { onlineRate: 1 }
|
|
69
|
+
summary: { onlineRate: 1 },
|
|
70
|
+
items: [{ deviceName: '摄像头', summary: { onlineRatePercent: 99 } }]
|
|
70
71
|
}
|
|
71
72
|
})
|
|
72
73
|
).toEqual({
|
|
@@ -74,7 +75,8 @@ describe('iotModuleSpecs deviceClass UI compatibility', () => {
|
|
|
74
75
|
data: {
|
|
75
76
|
year: 2026,
|
|
76
77
|
month: 7,
|
|
77
|
-
summary: { onlineRate: 1 }
|
|
78
|
+
summary: { onlineRate: 1 },
|
|
79
|
+
items: [{ deviceName: '摄像头', deviceClassName: '摄像头', summary: { onlineRatePercent: 99 } }]
|
|
78
80
|
}
|
|
79
81
|
})
|
|
80
82
|
})
|