import request from '@/utils/request'
//获取接口list编码
export function getBlockPage(params) {
    return request({
        url: '/panoramic/block/page',
        method: 'get',
        params
    })
}
//通用list查询
export function getResultList(params) {
    return request({
        url: '/panoramic/common/list',
        method: 'get',
        params
    })
}
//公共请求方法
export function getRequestResult(params) {
    let returnData = new Promise((resolve, reject) => {
        getResultList(params)
            .then((res) => {
                if (res.code == 1) resolve(res.result)
            })
            .catch((err) => { })
    })
    return returnData
}
//字典查询
export function getByKeys(params) {
    return request({
        url: '/base/code/getByKeys',
        method: 'get',
        params
    })
}
//指标管理查询
export function getIndexList(params) {
    return request({
        url: '/tofly-sxgk/bigScreenData/list',
        method: 'get',
        params
    })
}
//新增指标管理
export function addIndexData(data) {
    return request({
        url: '/tofly-sxgk/bigScreenData',
        method: 'post',
        data
    })
}
//修改指标管理
export function editIndexData(data) {
    return request({
        url: '/tofly-sxgk/bigScreenData',
        method: 'put',
        data
    })
}
//删除单个指标
export function deleteIndexDataById(data) {
    return request({
        url: `/tofly-sxgk/bigScreenData/${data.id}`,
        method: 'DELETE',
    })
}
//批量删除指标
export function deleteIndexData(data) {
    return request({
        url: '/tofly-sxgk/bigScreenData/deleteByIds',
        method: 'DELETE',
        params: data
    })
}
//带范围的工程结构树
// export function getPbsListWithRange(params) {
//     return request({
//         url: '/tofly-sxgk/structure/listWithRange',
//         method: 'get',
//         params
//     })
// }
export function getPbsListWithRange(params) {
    return request({
        url: '/tofly-sxgk/structure/structuredetailList',
        method: 'get',
        params
    })
}
//工程管理编辑
export function updatePbsList(data) {
    return request({
        url: '/tofly-sxgk/structure/updata',
        method: 'PUT',
        data: data,
    })
}
// ======================================================================>
//预警指标管理（列表查询）
export function getWarnIndexList(params) {
    return request({
        url: '/tofly-sxgk/warnIndexManage/list',
        method: 'get',
        params
    })
}
//预警指标管理（分页查询）
export function getWarnIndexPage(params) {
    return request({
        url: '/tofly-sxgk/warnIndexManage/page',
        method: 'get',
        params
    })
}
//新增预警指标
export function addWarnIndex(data) {
    return request({
        url: '/tofly-sxgk/warnIndexManage',
        method: 'post',
        data
    })
}
//修改预警指标
export function editWarnIndex(data) {
    return request({
        url: '/tofly-sxgk/warnIndexManage',
        method: 'put',
        data
    })
}
//预警指标管理（删除单个）
export function deleteWarningIndexById(data) {
    return request({
        url: `/tofly-sxgk/warnIndexManage/${data.id}`,
        method: 'DELETE',
    })
}
//预警指标管理（批量删除）
export function deleteWarningIndex(data) {
    return request({
        url: '/tofly-sxgk/warnIndexManage/deleteByIds',
        method: 'DELETE',
        params: data
    })
}
// ======================================================================>
//预警指标阈值管理（分页查询）
export function getWarnIndexThresholdPage(params) {
    return request({
        url: '/tofly-sxgk/indexThreshold/page',
        method: 'get',
        params
    })
}
//新增预警指标阈值
export function addWarnIndexThreshold(data) {
    return request({
        url: '/tofly-sxgk/indexThreshold',
        method: 'post',
        data
    })
}
//修改预警指标阈值
export function editWarnIndexThreshold(data) {
    return request({
        url: '/tofly-sxgk/indexThreshold',
        method: 'put',
        data
    })
}
//预警指标阈值管理（删除单个）
export function deleteWarningIndexThresholdById(data) {
    return request({
        url: `/tofly-sxgk/indexThreshold/${data.id}`,
        method: 'DELETE',
    })
}
//预警指标阈值管理（批量删除）
export function deleteWarningIndexThreshold(data) {
    return request({
        url: '/tofly-sxgk/indexThreshold/deleteByIds',
        method: 'DELETE',
        params: data
    })
}
// ======================================================================>
//预警信息管理（分页查询）
export function getWarnInfoPage(params) {
    return request({
        url: '/tofly-sxgk/warningInfo/page',
        method: 'get',
        params
    })
}
//修改预警指标阈值
export function editWarnInfo(data) {
    return request({
        url: '/tofly-sxgk/warningInfo',
        method: 'put',
        data
    })
}
