You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
import request from '@/config/axios'
|
|
|
|
// 物联设备 VO
|
|
export interface DeviceVO {
|
|
id: number // ID
|
|
deviceCode: string // 设备编号
|
|
deviceName: string // 设备名称
|
|
deviceType: string // 设备类型
|
|
status: string // 状态
|
|
readTopic: string // 读主题
|
|
writeTopic: string // 写主题
|
|
gatewayId: number // 网关id
|
|
deviceBrandId: number // 设备品牌id
|
|
offLineDuration: number // 离线间隔
|
|
lastOnlineTime: Date // 最后上线时间
|
|
remark: string // 备注
|
|
isEnable: boolean // 是否启用
|
|
deviceModelId: number // 关联设备模型
|
|
protocol: string // 通讯协议
|
|
sampleCycle: number // 采集周期
|
|
url: string // 端点url
|
|
username: string // 用户名
|
|
password: string // 密码
|
|
}
|
|
|
|
// 物联设备 API
|
|
export const DeviceApi = {
|
|
// 查询物联设备分页
|
|
getDevicePage: async (params: any) => {
|
|
return await request.get({ url: `/iot/device/page`, params })
|
|
},
|
|
// 查询物联设备
|
|
getDeviceList: async () => {
|
|
return await request.get({ url: `/iot/device/deviceList` })
|
|
},
|
|
// 查询物联设备详情
|
|
getDevice: async (id: number) => {
|
|
return await request.get({ url: `/iot/device/get?id=` + id })
|
|
},
|
|
|
|
// 新增物联设备
|
|
createDevice: async (data: DeviceVO) => {
|
|
return await request.post({ url: `/iot/device/create`, data })
|
|
},
|
|
|
|
// 修改物联设备
|
|
updateDevice: async (data: DeviceVO) => {
|
|
return await request.put({ url: `/iot/device/update`, data })
|
|
},
|
|
|
|
// 删除物联设备
|
|
deleteDevice: async (id: number) => {
|
|
return await request.delete({ url: `/iot/device/delete?id=` + id })
|
|
},
|
|
|
|
// 导出物联设备 Excel
|
|
exportDevice: async (params) => {
|
|
return await request.download({ url: `/iot/device/export-excel`, params })
|
|
},
|
|
|
|
// ==================== 子表(设备属性) ====================
|
|
|
|
// 获得设备属性分页
|
|
getDeviceAttributePage: async (params) => {
|
|
return await request.get({ url: `/iot/device/device-attribute/page`, params })
|
|
},
|
|
// 新增设备属性
|
|
createDeviceAttribute: async (data) => {
|
|
return await request.post({ url: `/iot/device-contact-model/create`, data })
|
|
},
|
|
|
|
// 修改设备属性
|
|
updateDeviceAttribute: async (data) => {
|
|
return await request.put({ url: `/iot/device-contact-model/update`, data })
|
|
},
|
|
|
|
// 删除设备属性
|
|
deleteDeviceAttribute: async (id: number) => {
|
|
return await request.delete({ url: `/iot/device-contact-model/delete?id=` + id })
|
|
},
|
|
|
|
// 获得设备属性
|
|
getDeviceAttribute: async (id: number) => {
|
|
return await request.get({ url: `/iot/device-contact-model/get?id=` + id })
|
|
}
|
|
}
|