Commit 1fd3005261f3298ea52d7023ef276af09a3f9d8b
1 parent
a89b1174
fix: device detail model of matter fetch params update
Showing
2 changed files
with
8 additions
and
6 deletions
@@ -228,8 +228,10 @@ export const commandIssuanceApi = (type, tbDeviceId, data) => { | @@ -228,8 +228,10 @@ export const commandIssuanceApi = (type, tbDeviceId, data) => { | ||
228 | ); | 228 | ); |
229 | }; | 229 | }; |
230 | 230 | ||
231 | -export const getDeviceAttrs = (profileId: string, id: string) => { | 231 | +export const getDeviceAttrs = (params: { deviceProfileId: string; dataType?: string }) => { |
232 | + const { deviceProfileId, dataType } = params; | ||
232 | return defHttp.get<DeviceModelOfMatterAttrs[]>({ | 233 | return defHttp.get<DeviceModelOfMatterAttrs[]>({ |
233 | - url: `${DeviceManagerApi.DEVICE_ATTR}/${profileId}/${id}`, | 234 | + url: `${DeviceManagerApi.DEVICE_ATTR}/${deviceProfileId}`, |
235 | + params: { dataType }, | ||
234 | }); | 236 | }); |
235 | }; | 237 | }; |
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | import { DeviceModelOfMatterAttrs } from '/@/api/device/model/deviceModel'; | 17 | import { DeviceModelOfMatterAttrs } from '/@/api/device/model/deviceModel'; |
18 | import { computed } from '@vue/reactivity'; | 18 | import { computed } from '@vue/reactivity'; |
19 | import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel'; | 19 | import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel'; |
20 | - import { isObject } from '/@/utils/is'; | 20 | + import { isArray, isObject } from '/@/utils/is'; |
21 | 21 | ||
22 | interface ReceiveMessage { | 22 | interface ReceiveMessage { |
23 | data: { | 23 | data: { |
@@ -137,9 +137,9 @@ | @@ -137,9 +137,9 @@ | ||
137 | 137 | ||
138 | const { send, close, data } = useWebSocket(socketInfo.origin, { | 138 | const { send, close, data } = useWebSocket(socketInfo.origin, { |
139 | async onConnected() { | 139 | async onConnected() { |
140 | - const { id, deviceProfileId } = props.deviceDetail; | ||
141 | - const value = await getDeviceAttrs(deviceProfileId, id); | ||
142 | - socketInfo.attrKeys = value; | 140 | + const { deviceProfileId } = props.deviceDetail; |
141 | + const value = await getDeviceAttrs({ deviceProfileId }); | ||
142 | + socketInfo.attrKeys = isArray(value) ? value : []; | ||
143 | send(JSON.stringify(unref(getSendValue))); | 143 | send(JSON.stringify(unref(getSendValue))); |
144 | }, | 144 | }, |
145 | async onMessage() { | 145 | async onMessage() { |