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.
140 lines
3.9 KiB
TypeScript
140 lines
3.9 KiB
TypeScript
import request from '@/config/axios'
|
|
|
|
// 物联设备 VO
|
|
export interface DeviceVO {
|
|
id: number // ID
|
|
deviceCode: string // 设备编号
|
|
deviceName: string // 设备名称
|
|
deviceType: string // 设备类型
|
|
status: string // 状态
|
|
isConnect?: string | number
|
|
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 // 密码
|
|
certificate?: string // 证书
|
|
secretKey?: string // 秘钥
|
|
}
|
|
|
|
export interface DeviceConnectParams {
|
|
id: string | number
|
|
isConnect: string | number
|
|
}
|
|
|
|
export interface LineDeviceVO {
|
|
id?: string | number
|
|
lineNode?: string
|
|
lineName?: string
|
|
deviceCode?: string
|
|
deviceName?: string
|
|
status?: string | number
|
|
collectionTime?: string | number
|
|
}
|
|
|
|
export interface LineDevicePageParams {
|
|
pageNo: number
|
|
pageSize: number
|
|
id?: string | number
|
|
lineNode?: string
|
|
lineName?: string
|
|
deviceCode?: string
|
|
deviceName?: string
|
|
status?: string | number
|
|
collectionTime?: string | number
|
|
collectionTimeStart?: string
|
|
collectionTimeEnd?: string
|
|
}
|
|
|
|
export interface SingleDeviceParams {
|
|
deviceId: string | number
|
|
}
|
|
|
|
// 物联设备 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 (ids: string) => {
|
|
return await request.delete({ url: `/iot/device/delete?ids=` + ids })
|
|
},
|
|
|
|
// 复制物联设备
|
|
copyDevice: async (id: number) => {
|
|
return await request.post({ url: `/iot/device/copy`, params: { id } })
|
|
},
|
|
|
|
connectDevice: async (params: DeviceConnectParams) => {
|
|
return await request.post({ url: `/iot/device/connect`, data: params })
|
|
},
|
|
|
|
// 导出物联设备 Excel
|
|
exportDevice: async (params) => {
|
|
return await request.download({ url: `/iot/device/export-excel`, params })
|
|
},
|
|
|
|
getLineDevicePage: async (params: LineDevicePageParams) => {
|
|
return await request.get({ url: `/iot/device/lineDevicePage`, params })
|
|
},
|
|
|
|
getSingleDevice: async (params: SingleDeviceParams) => {
|
|
return await request.get({ url: `/iot/device/singleDevice`, 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 (ids: string) => {
|
|
return await request.delete({ url: `/iot/device-contact-model/delete?ids=` + ids })
|
|
},
|
|
|
|
// 获得设备属性
|
|
getDeviceAttribute: async (id: number) => {
|
|
return await request.get({ url: `/iot/device-contact-model/get?id=` + id })
|
|
}
|
|
}
|