import axios from '@/common/services/axios-instance'
import { getUserInfo } from '@/common/store-mixin'

class IamAuditDscService {
  // 获取整体数量
  getAllNumResult(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getAllNumResult',
      data: params,
    })
  }

  // 获取项目总览
  getOverallResult(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getOverallResult',
      data: params,
    })
  }

  // 获取问题整改情况
  getQuestionRectResult(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getQuestionRectResult',
      data: params,
    })
  }

  // 获取项目趋势分析
  getProjectTrends(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getProjectTrendAnalysisList',
      data: params,
    })
  }

  // 获取审计发现统计
  getAuditProjectList(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getAuditProjectList',
      data: params,
    })
  }

  // 获取审计发现类别统计--仅在审计发现类别使用
  getReportFindList(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getReportFindList',
      data: params,
    })
  }

  // 获取问题涉及金额
  getAuditFindMoneyList(params) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/iam-statistics/getAuditFindMoneyList',
      data: params,
    })
  }

  // 项目列表导出
  exportProjectList(data) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-statistics/exportProjectTrendPassList`,
      method: 'POST',
      data,
      responseType: 'blob',
    }).then((res) => {
      return res.data
    })
  }

  //  审计发现统计_审计发现列表导出
  exportFindList(data) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-statistics/exportAuditFindList`,
      method: 'POST',
      data,
      responseType: 'blob',
    }).then((res) => {
      return res.data
    })
  }

  //  已整改问题列表导出
  exportRectifyList(data) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-statistics/exportFindRectifyList`,
      method: 'POST',
      data,
      responseType: 'blob',
    }).then((res) => {
      return res.data
    })
  }

  // 根据code获取ordId
  getOrgId(code) {
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/iamorg/findIamOrgId?orgId=${code}`,
    })
  }

  // 获取用户信息
  getUserInfo(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iamorg/findIamOrgId',
      method: 'post',
      params,
    })
  }

  // 根据parentId获取审计发现类别
  getFindAuditTree(parentId) {
    return axios({
      url: `api/xcoa-mobile/v1/audit-report-find/find-audit-tree?parentId=${parentId}`,
      method: 'post',
    })
  }
}

export default new IamAuditDscService()
