import request from '@/utils/request'

// 查询谐波含量实时数据
export const queryFisrtThdContent = ({ devId, statisticalName }) => {
    let form = new FormData()
    form.append('devId', devId)
    form.append('statisticalName', statisticalName)
    return request({
        url: '/cs-harmonic-boot/stable/queryFisrtThdContent',
        method: 'post',
        header: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        data: form,
    })
}

// 根据统计类型id查询已绑定指标下拉框

export const queryStatisticalSelect = (id) => {
    let form = new FormData()
    form.append('id', id)
    return request({
        url: '/system-boot/csstatisticalset/queryStatisticalSelect',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        data: form,
    })
}

// 查询实时数据

export const queryFisrtCommonStatistical = (data) => {
    return request({
        url: '/cs-harmonic-boot/stable/queryFisrtCommonStatistical',
        method: 'post',
        data: Object.assign(
            {
                devId: '',
                endTime: '',
                frequency: '',
                startTime: '',
                statisticalId: '',
                valueType: '',
            },
            data
        ),
    })
}

// 查询时间段实时数据

export const queryCommonStatisticalByTime = (data) => {
    return request({
        url: '/cs-harmonic-boot/stable/queryCommonStatisticalByTime',
        method: 'post',
        data: Object.assign(
            {
                devId: '',
                endTime: '',
                frequency: '',
                startTime: '',
                statisticalId: '',
                valueType: '',
            },
            data
        ),
    })
}

//根据设备id获取电流限值
export const getDevCapacity = (devId) => {
    let form = new FormData()
    form.append('id', devId)
    return request({
        url: '/cs-device-boot/capacity/getDevCapacity',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        data: form,
    })
}

// 查询装置拓扑图
export const queryTopologyDiagram = (devId) => {
    let form = new FormData()
    form.append('devId', devId)
    return request({
        url: '/cs-device-boot/lineTopologyDiagram/queryTopologyDiagram',
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        data: form,
    })
}
