import createAxios from '@/utils/request'

// 设备基础数据和模板数据
export function getDeviceData(deviceId: string, type: string, lineId: string) {
    let form = new FormData()
    form.append('deviceId', deviceId)
    form.append('lineId', lineId)
    form.append('type', type)
    return createAxios({
        url: '/cs-device-boot/EquipmentDelivery/deviceData',
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: form
    })
}

//获取趋势数据、暂态数据、实时数据
export function getTabsDataByType(data: any) {
    return createAxios({
        url: '/cs-device-boot/csGroup/deviceDataByType',
        method: 'POST',
        data
    })
}

/**** 获取基础实施数据 ****/
export function getBasicRealData(id: any) {
    return createAxios({
        url: `/cs-harmonic-boot/realData/getBaseRealData?lineId=${id}`,
        method: 'POST'
    })
}

/**** 获取谐波实时数据 ****/
export function getHarmRealData(id: any, target: any) {
    return createAxios({
        url: `/cs-harmonic-boot/realData/getHarmRealData?lineId=${id}&target=${target}`,
        method: 'POST'
    })
}

/**** 获取国标限值 ****/
export function getOverLimitData(id: any) {
    return createAxios({
        url: `/cs-device-boot/csline/getOverLimitData?id=${id}`,
        method: 'POST'
    })
}

//获取实时数据列表数据
export function getRealTimeTableList() {
    return createAxios({
        url: '/cs-device-boot/csGroup/getGroupPortableStatistical',
        method: 'GET'
    })
}

//离线数据导入
export function uploadOffLineDataFile(data: any) {
    return createAxios({
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        url: '/cs-device-boot/portableOfflLog/importEquipment',
        method: 'POST',
        data
    })
}

//查询实时数据中实时趋势中指标分组
export function getDeviceTrendDataGroup() {
    return createAxios({
        url: '/cs-device-boot/csGroup/getDeviceTrendDataGroup',
        method: 'GET'
    })
}

//根据指标分组查询实时数据中实时趋势
export function getDeviceTrendData(query: any) {
    return createAxios({
        url: '/cs-device-boot/csGroup/getDeviceTrendData',
        method: 'GET',
        params: query
    })
}

//查询实时数据-谐波频谱-稳态指标
export function getGroupPortableStatistical() {
    return createAxios({
        url: '/cs-device-boot/csGroup/getGroupPortableStatistical',
        method: 'GET'
    })
}

//查询实时数据-谐波频谱
export function getDeviceHarmonicSpectrumData(data: any) {
    return createAxios({
        url: '/cs-device-boot/csGroup/getDeviceHarmonicSpectrumData',
        method: 'POST',
        data: data
    })
}
//获取指标类型-谐波频谱
export function queryDictType(data?: any) {
    return createAxios({
        url: '/system-boot/dictTree/queryDictType',
        method: 'GET',
        params: data
    })
}
//根据监测点id获取监测点详情
export function getById(data?: any) {
    return createAxios({
        url: '/cs-device-boot/csline/getById',
        method: 'POST',
        params: data
    })
}
//测试项日志修改
export function updateRecordData(data?: any) {
    return createAxios({
        url: '/cs-device-boot/wlRecord/updateRecordData',
        method: 'POST',
        data
    })
}
//模块数据
export function allModelData(data?: any) {
    return createAxios({
        url: '/cs-harmonic-boot/data/allModelData',
        method: 'POST',
        data
    })
}
//刷新状态
export function getModuleState(data?: any) {
    return createAxios({
        url: '/cs-harmonic-boot/data/getModuleState',
        method: 'POST',
        params: data
    })
}
//获取运行取数
export function getRawData(data?: any) {
    return createAxios({
        url: '/cs-device-boot/pqsCommunicate/getRawData',
        method: 'POST',
         data
    })
}

