You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.5 KiB

import type { Device, DevicePropertie, GetDeviceListParams } from './types'
import { defHttp } from '@/utils/http/axios'
export function getDeviceList(params: GetDeviceListParams) {
return defHttp.get<PageResult<Device>>({
url: '/device/page',
params,
})
}
export function createDevice(data: Partial<Device>) {
return defHttp.post({
url: '/device/save',
data,
})
}
export function updateDevice(data: Partial<Device>) {
return defHttp.post({
url: '/device/update',
data,
})
}
export function deleteDevice(id: string) {
return defHttp.post({
url: `/device/remove?id=${id}`,
})
}
export function getDeviceDetail(id: string) {
return defHttp.get<Device>({
url: '/device/detail',
params: {
id,
},
})
}
export function getDeviceProperties(modelId: string, deviceSn: string) {
return defHttp.get<{
properties?: DevicePropertie[]
updateTime?: string
}>({
url: '/device/properties',
params: {
deviceSn,
modelId,
},
})
}
export function getDeviceTopicList(params: PageParam & { deviceId: string }) {
return defHttp.get({
url: '/device/topic/page',
params,
})
}
export function getMqttConnectParams(deviceId: string) {
return defHttp.get({
url: '/device/mqttLinkInfo',
params: {
deviceId,
},
})
}
export function getReportExample(productId: string, deviceSn: string) {
return defHttp.get({
url: '/device/messageExample',
params: {
productId,
deviceSn,
},
})
}