import axios from 'axios'
// if (process.env.NODE_ENV === 'development') {
//     axios.defaults.baseURL = '/api'
// } else if (process.env.NODE_ENV === 'production') {
//     axios.defaults.baseURL = '/api'
// }
// 设置请求头参数 common 为设置所有的接口  post为设置post请求的接口
// axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access_token')}`;

//根据等级获取报警数据
export const GetLevelAlarm = (params) => {
    return axios.get('api/GetLevelAlarm', {
        params,
        // timeout:5000
    })
};
//获取昨天、今天报警数量
export const getSecurityAlarmCount = (params) => {
    return axios.get('api/GetSecurityAlarmCount', {
        params,
        // timeout:5000
    })
};
//获取报警统计接口
export const getAlarmStatistics = (params) => {
    return axios.get('api/GetAlarmStatistics', {
        params,
        // timeout:5000
    })
};
// 获取建筑信息接口
export const getBuildinginfos = (params) => {
    return axios.get('ecs-server/services/getBuildinginfos', {
        params,
        // timeout:5000
    })
};
// 获取分项用能信息接口
export const getSubitemList = (data) => {
    return axios.post('ecs-server/services/ecm/subitemList', 
        data,
    )
};
// 获取所有设备信息
export const getAllDevices = (params) => {
    return axios.get('ecs-server/services/getAllDevices', {
        params,
        // timeout:5000
    })
};
// 获取设备实时数据信息
export const getRealData = (data) => {
    return axios.post('ecs-server/services/getRealData', 
        data,
    )
};
// 获取区域用能数据信息
export const getAreaList = (data) => {
    return axios.post('ecs-server/services/ecm/areaList', 
        data
        // headers:{'Content-Type':'application/json;charset=utf-8'}
    )
};