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.
85 lines
1.9 KiB
85 lines
1.9 KiB
5 years ago
|
import http from '@/common/request'
|
||
|
import deviceData from '@/common/deviceData'
|
||
|
|
||
|
export function getDeviceList(productId) {
|
||
|
let data = {}
|
||
|
if(productId){
|
||
|
data.productId = productId
|
||
|
}
|
||
|
return http.get('/device/list',data)
|
||
|
}
|
||
|
|
||
|
export function getDeviceInfo(productId, deviceName) {
|
||
|
return http.get(`/device/find/${productId}/${deviceName}`)
|
||
|
}
|
||
|
export function controlDeviceCmd(productId, deviceName, cmd) {
|
||
|
return deviceCmd({
|
||
|
url: '/device/cmd/simple',
|
||
|
method: 'post',
|
||
|
params: {
|
||
|
productId: productId,
|
||
|
deviceName: deviceName
|
||
|
},
|
||
|
data: cmd
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export function getDeviceLatestUpMessage(productId, deviceName) {
|
||
|
return deviceData.get(`/device/message/find/one/up/${productId}/${deviceName}`)
|
||
|
}
|
||
|
|
||
|
export function getDeviceAllUpMessage(productId, deviceName, pageNum, pageSize) {
|
||
|
let data = {};
|
||
|
if(deviceName){
|
||
|
data.deviceName = deviceName
|
||
|
}
|
||
|
if(pageNum){
|
||
|
data.pageNum = pageNum
|
||
|
}
|
||
|
if(pageSize){
|
||
|
data.pageSize = pageSize
|
||
|
}
|
||
|
return deviceData.get(`/device/message/find/all/up/${productId}`,data)
|
||
|
}
|
||
|
|
||
|
export function getDeviceAllDownMessage(productId, deviceName, pageNum, pageSize) {
|
||
|
return deviceData({
|
||
|
url: `/device/message/find/all/down/${productId}`,
|
||
|
params: {
|
||
|
deviceName: deviceName,
|
||
|
pageNum: pageNum,
|
||
|
pageSize: pageSize
|
||
|
},
|
||
|
method: 'get'
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export function statisticsDevice(productId) {
|
||
|
let data = {}
|
||
|
if(productId){
|
||
|
data.productId = productId
|
||
|
}
|
||
|
return http.get('/device/statistics',data)
|
||
|
}
|
||
|
|
||
|
export function getSubDeviceList(devicePid) {
|
||
|
return request({
|
||
|
url: `/device/list/sub/${devicePid}`,
|
||
|
method: 'get'
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export function addSubDevice(deviceId, devicePid) {
|
||
|
return request({
|
||
|
url: `/device/add/sub/${deviceId}/${devicePid}`,
|
||
|
method: 'post'
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export function deleteSubDevice(deviceId, devicePid) {
|
||
|
return request({
|
||
|
url: `/device/delete/sub/${deviceId}/${devicePid}`,
|
||
|
method: 'delete'
|
||
|
})
|
||
|
}
|