import request from '@/utils/request'
import { download } from '@/utils/request'

// 查询传感器列表
export function listSensor(query) {
    return request({
        url: '/SensorCategory/category/list',
        method: 'get',
        params: query
    })
}

// 查询传感器详细
export function getSensor(sensorId) {
    return request({
        url: '/SensorCategory/category/' + sensorId,
        method: 'get'
    })
}
// 查询传感器实时数据
export function getSensorLatestData(query) {
    return request({
        url: '/SensorCategory/category/latestData',
        method: 'get',
        params: query
    })
}
// 查询传感器历史数据
export function getSensorHistoryData(query) {
    return request({
        url: '/SensorCategory/category/historyData',
        method: 'get',
        params: query
    })
}
// 根据焚烧炉查询传感器路径
export function getSensorByIncine(query) {
    return request({
        url: '/SensorCategory/category/listByIncineratorSn',
        method: 'get',
		params: query
    })
}
// 根据焚烧炉查询传感器路径
export function getTimeSeries(query) {
    return request({
        url: '/SensorCategory/category/timeSeries',
        method: 'get',
		params: query
    })
}

// 新增传感器
export function addSensor(data) {
    return request({
        url: '/SensorCategory/category',
        method: 'post',
        data: data
    })
}

// 修改传感器
export function updateSensor(data) {
    return request({
        url: '/SensorCategory/category',
        method: 'put',
        data: data
    })
}

// 删除传感器
export function delSensor(sensorId) {
    return request({
        url: '/SensorCategory/category/' + sensorId,
        method: 'delete'
    })
}

// 导出传感器列表
export function downloadSensor(data) {
    download(
        '/SensorCategory/category/export',
        data,
        `sensor_${new Date().getTime()}.xlsx`)
}
