/**
 * 数据管理接口
 */
import request from '@/utils/request'
// 内涝评估分析数据查询
export function getWaterData(params) {
  return request({
    url: 'analysis/levelAnalysisLogs',
    method: 'get',
    params
  })
}

// 燃气管线泄漏点分析数据
export function getGasLeakageData(params) {
  return request({
    url: 'analysis/rtuAnalysisLogs',
    method: 'get',
    params
  })
}
// 开挖
export function getHotLeakageData(params) {
  return request({
    url: 'analysis/digAnalysisLogs',
    method: 'get',
    params
  })
}

// 批量导出内涝
export function batchExportWaterData(params) {
  return request({
    url: 'analysis/exportLevelAnalysisLogs',
    method: 'get',
    timeout: 120000,
    params,
    responseType: 'blob' // 这一步也很关键，一定要加上 responseType 值为 blob
  })
}

// 批量导出燃气
export function batchExportGasLeakageData(params) {
  return request({
    url: 'analysis/exportRtuAnalysisLogs',
    method: 'get',
    timeout: 120000,
    params,
    responseType: 'blob' // 这一步也很关键，一定要加上 responseType 值为 blob
  })
}

// 批量导出燃气数据
export function batchExportHotLeakageData(params) {
  return request({
    url: 'analysis/exportLevelAnalysisLogs',
    method: 'get',
    timeout: 120000, // 120s，2分钟
    params,
    responseType: 'blob' // 这一步也很关键，一定要加上 responseType 值为 blob
  })
}

// 内涝报警查询
export function getWaterAlarm(params) {
  return request({
    url: 'level/alarm/list',
    method: 'get',
    params
  })
}
// 燃气泄漏报警查询
export function getGasAlarm(params) {
  return request({
    url: 'gas/alarm/list',
    method: 'get',
    params
  })
}
// 热力泄漏报警查询
export function getHotAlarm(params) {
  return request({
    url: 'hot/alarm/list',
    method: 'get',
    params
  })
}
// 内涝计算
export function getWaterCompute(params) {
  return request({
    url: 'smartAnalysis/waterlogging/detail',
    method: 'get',
    params
  })
}
// 燃气泄漏计算
export function getGasCompute(params) {
  return request({
    url: 'smartAnalysis/gasLeakage/detail',
    method: 'get',
    params
  })
}
// 热力泄漏计算
export function getHotCompute(params) {
  return request({
    url: 'smartAnalysis/hotLeakage/detail',
    method: 'get',
    params
  })
}

// 某井上游阀门
export function getValvesByWell(params) {
  return request({
    url: 'smartAnalysis/valvesByWell',
    method: 'get',
    params
  })
}

// 某井关阀影响区域
export function getAffectAreaByWell(params) {
  return request({
    url: 'smartAnalysis/valve/affectAreas',
    method: 'get',
    params
  })
}
