// 督查问题模块

import axios from 'axios'; // 引入axios
import request from '../utils/gw_ajax_request.js';

const baseurl = '';
// const baseurl = 'http://10.8.4.135:8872'
// const baseurl = 'http://36.250.234.48:8105'

// 督查问题
export function findPageInfo(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page',
    method: 'POST',
    data: data,
  });
}
// 删除添加描述
export function updateMiaoshu(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/insertPblmLog',
    method: 'POST',
    data: data,
  });
}
// 获取统计问题数
export function findPageCount(persId, adCode) {
  return request({
    url: baseurl + '/dc/insp/pblm/count/' + persId + '/' + adCode,
    method: 'get',
  });
}
export function getArithmeticCaptcha() {
  return request({
    url: '/dc/org/base/getArithmeticCaptcha',
    method: 'get',
    params: {},
  });
}
// 小水库问题
export function findPageInfoShuiKu() {
  return request({
    url: baseurl + 'dc/insp/pblms/getPblmsType',
    method: 'get',
  });
}
// 行政村/水源地/饮水工程/水毁/问题类别/
export function findPageInfoRenYin(type, pguid) {
  return request({
    url: baseurl + 'dc/insp/pblms/getPblmType?type=' + type + '&pguid=' + pguid,
    method: 'get',
  });
}
export function getTypeInfo(type) {
  return request({
    url: baseurl + 'dc/insp/pblms/getPblmType?type=' + type,
    method: 'get',
  });
}

// 根据id查询督查信息
export function getSupervisdByID(persGuid, objType) {
  return request({
    url:
      baseurl +
      '/dc/insp/obj/getObjByPersId?persGuid=' +
      persGuid +
      '&objType=' +
      objType,
    method: 'GET',
  });
}
// 获取engid
export function getEngId(objId, persId) {
  return request({
    url:
      baseurl +
      '/dc/insp/villRgstr/getEngId?objId=' +
      objId +
      '&persId=' +
      persId,
    method: 'GET',
  });
}

// 修改督查信息

export function changeInfo(data) {
  return request({
    url: baseurl + '/dc/insp/pblm',
    method: 'post',
    data: data,
  });
}
// 更新
export function updatelist(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/update',
    method: 'post',
    data: data,
  });
}
// 详情/修改/问题
export function showDetailsXq(id) {
  return request({
    url: baseurl + '/dc/insp/pblm/' + id,
    method: 'get',
  });
}
// 详情/修改/问题
export function showPblmDetails(id) {
  return request({
    url: baseurl + '/bis/insp/zg/pblm/' + id,
    method: 'get',
  });
}

// 详情/修改/问题/市级下发业务详情
export function showPblmCityDetails(id) {
  return request({
    url: baseurl + '/bis/insp/BisInspZgPblmCity/' + id,
    method: 'get',
  });
}
// 稽查详情/修改/问题
export function showDetailsJc(id) {
  return request({
    url: baseurl + '/tac/pblm/info/' + id,
    method: 'post',
  });
}
// 获取小水库的问题类别
export function getShuiKuWenTi(type) {
  return request({
    url: baseurl + '/dc/insp/pblms/getPblmType',
    method: 'get',
    params: {
      type,
    },
  });
}
// 添加问题s
export function creatSupervise(data) {
  return request({
    url: baseurl + '/dc/insp/pblm',
    method: 'POST',
    data: data,
  });
}

// 删除
export function removeSupervise(id, userId) {
  return request({
    url: baseurl + '/dc/insp/pblm/delete/' + id + '/' + userId,
    method: 'get',
  });
}

// 获取分组列表信息
export function getSuperviseGroup(crId) {
  return request({
    url: baseurl + '/dc/insp/pblm/findPageInfo',
    method: 'POST',
    data: {
      crId,
    },
  });
}

// 创建分组
export function createGroup(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/insert',
    method: 'POST',
    data: data,
  });
}

// 获取文件列表
export function getFileByBiz(id) {
  return request({
    url: baseurl + '/dc/insp/pblm/getFileByBiz',
    method: 'GET',
    params: {
      id,
    },
  });
}

// 下载文件
export function downloadFile(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/download',
    method: 'GET',
    params: data,
  });
}

// 删除文件
export function deleteFileById(id) {
  return request({
    url: baseurl + '/file/' + id,
    method: 'POST',
  });
}

// 分组详情
export function SuperviseGroupInfo(ccgId) {
  return request({
    url: baseurl + '/dc/insp/pblm/findPageInfo',
    method: 'POST',
    data: {
      ccgId,
    },
  });
}

// 查询分组信息
export function supervisegroup(id) {
  return request({
    url: baseurl + '/biz/hzz/basic/supervisedivision/getDivisionByCrId',
    method: 'GET',
    params: {
      id,
    },
  });
}

// 添加地区
export function addgrouparea(data) {
  return request({
    url: baseurl + '/biz/hzz/basic/supervisedivision/insertAll',
    method: 'POST',
    data: data,
  });
}

// 修改地区
export function updategrouparea(data) {
  return request({
    url: baseurl + '/biz/hzz/basic/supervisedivision/update',
    method: 'POST',
    data: data,
  });
}

// 添加检查结果
export function insertResult(data) {
  return request({
    url: baseurl + '/biz/hzz/basic/superviseinspect/insert',
    method: 'POST',
    data: data,
  });
}

// 修改检查结果
export function changeResult(data) {
  return request({
    url: baseurl + '/biz/hzz/basic/superviseinspect/update',
    method: 'POST',
    data: data,
  });
}

// 查询检查结果
export function getResult(data) {
  return request({
    url: baseurl + '/biz/hzz/basic/superviseinspect/' + data,
    method: 'GET',
  });
}

// 修改地区
export function updateshenhe(data) {
  return request({
    url: baseurl + '/biz/hzz/basic/supervisecourse/update',
    method: 'POST',
    data: data,
  });
}

// /dc/org/base/getProvincialOrgList
export function getProvincialOrgList(code = '', type = '') {
  return request({
    url: '/dc/org/base/getOrgOrAdByCodeAndType',
    method: 'GET',
    params: {
      code: code,
      type: type,
    },
  });
}

export function getNodeByPidAndCode(pid = '', code = '', type = '') {
  return request({
    url: '/dc/organization/base/getNodeByPidAndCode',
    method: 'POST',
    params: {
      pid: pid,
      code: code,
      type: type,
    },
  });
}
// 根据presId获取adCodes
export function getadCodeByPresId(userId = '', type = '') {
  return request({
    url: '/dc/gd/base/getadCodeByPresId',
    method: 'POST',
    params: {
      presId: userId,
      ptype: type,
    },
  });
}
// 根据presId获取adCodes
export function getPidByPresId(userId = '', type = '') {
  return request({
    url: '/dc/gd/base/getPidByPresId',
    method: 'POST',
    params: {
      presId: userId,
      type: type,
    },
  });
}

export function getAdData(adCode) {
  return request({
    url: '/dc/ad/base/getAdData',
    method: 'GET',
    params: {
      adCode: adCode,
    },
  });
}

// /dc/bis/insp/org/getByPid?pid=11
export function getOrgByPid(code = '') {
  return request({
    url: '/dc/bis/insp/org/getByPid',
    method: 'GET',
    params: {
      pid: code,
    },
  });
}

// 机构管理New
export function getOrgByPidNew() {
  return request({
    url: '/dc/bis/insp/org/getNodeOne',
    method: 'GET',
  });
}
export function getOrgByPidNewNext(code = '') {
  return request({
    url: '/dc/bis/insp/org/getNodeNext',
    method: 'GET',
    params: {
      pid: code,
    },
  });
}
// 根据id查询督查信息
export function getRygcPlm(type, pguid) {
  return request({
    url: baseurl + 'dc/insp/pblms/getPblmType?type=' + type + '&pguid=' + pguid,
    method: 'GET',
  });
}

// export function getRygcPlm(type, pguid) {
//     return request({
//         url: '/dc/insp/pblms/getPblmType',
//         method: 'GET',
//         params: {
//             'type': pguid,
//             'type': pguid,
//         }
//     })
// }

// 通用问题列表
export function tongYongList(data) {
  return request({
    url: baseurl + '/biz/insp/compblm/list',
    method: 'POST',
    data: data,
  });
}
// 删除通用问题
export function deleteTongYong(id) {
  return request({
    url: baseurl + '/biz/insp/compblm/delete/' + id,
    method: 'POST',
    data: {},
  });
}
// 通用问题更新
export function tongYongUpdate(data) {
  return request({
    url: baseurl + '/biz/insp/compblm/update',
    method: 'POST',
    data: data,
  });
}
// 根据id获取问题详情
export function gettongYongDetail(id) {
  return request({
    url: baseurl + '/biz/insp/compblm/get/' + id,
    method: 'get',
  });
}
// 获取通用问题统计问题数
export function findTongYongCount(data) {
  return request({
    url: baseurl + '/biz/insp/compblm/count',
    method: 'POST',
    data: data,
  });
}

// 新的督查问题api
export function getXSKProblemNew(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/rever',
    method: 'POST',
    data: data,
  });
}
export function getRYProblemNew(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/vill',
    method: 'POST',
    data: data,
  });
}
export function getSHProblemNew(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/track',
    method: 'POST',
    data: data,
  });
}
export function getDXSProblemNew(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/grw',
    method: 'POST',
    data: data,
  });
}

export function getXSKProblemNewExport(data) {
  return axios.post(baseurl + '/pdcApi/dc/insp/pblm/page/rever/export', {
    data: data,
    headers: {
      persId: localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '', // 从缓存中取出

      'Content-Type': 'application/json;charset=UTF-8',
    },
    responseType: 'blob', // 二进制流
  });
  // return request({
  //     url:
  //     method: 'POST',
  //     data: data,
  //     headers:{
  //         responseType: 'blob'
  //     }

  // })
}
export function getRYProblemNewExport(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/vill/export',
    method: 'POST',
    data: data,
  });
}
export function getSHProblemNewExport(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/track/export',
    method: 'POST',
    data: data,
  });
}
// 水闸督查问题分类标准库
export function getSzProblemList(probId) {
  return request({
    // url: baseurl + '/dc/insp/pblms/getByWagaPblm',
    url: baseurl + '/dc/insp/pblms/getPblmsByQuesNum/' + probId + '/' + 6,
    method: 'GET',
  });
}

// 水源地督查问题分类标准库
export function getSydProblemList(probId) {
  return request({
    url: baseurl + '/dc/insp/pblms/getPblmsByQuesNum/' + probId + '/' + 13,
    method: 'GET',
  });
}
// 分水及管控督查问题分类标准库
export function getFsGkProblemList(probId) {
  return request({
    url: baseurl + '/dc/insp/pblms/getPblmsByQuesNum/' + probId + '/' + 14,
    method: 'GET',
  });
}
// 节水管理与评价 督查问题分类标准库
export function getJsGLProblemList(probId) {
  return request({
    url: baseurl + '/dc/insp/pblms/getPblmsByQuesNum/' + probId + '/' + 15,
    method: 'GET',
  });
}
// 小水库标准化 督查问题分类标准库
export function getXskBzhProblemList(probId) {
  return request({
    url: baseurl + '/dc/insp/pblms/getPblmsByQuesNum/' + probId + '/' + 24,
    method: 'GET',
  });
}
// 水闸督查问题列表
export function getSzwtTable(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/waga',
    method: 'POST',
    data: data,
  });
}
// 行政区划搜索组件接口
export function getAddTree(adCd, level) {
  return request({
    url: '/dc/att/adXBase/getAdTreeByAdCd',
    method: 'GET',
    params: {
      adCd: adCd,
      level: level,
    },
  });
}

// 关联列表
export function selFullCoverageRelationPblms(data) {
  return request({
    url: baseurl + '/dc/insp/pblm/page/selFullCoverageRelationPblms',
    method: 'POST',
    data: data,
  });
}

// 关联
export function relevanceAdd(data) {
  return request({
    url: baseurl + '/bis/insp/BisAssociationComparison/add',
    method: 'POST',
    data: data,
  });
}

// 取消关联
export function relevanceDelete(id) {
  return request({
    url: baseurl + `/bis/insp/BisAssociationComparison/delete/${id}`,
    method: 'POST',
  });
}
