import axios from '@/common/services/axios-instance'

class RiskCriteriaServices {
  // 判断组织是否存在启用的准则
  checkDept(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/riskcriteria/checkDept',
      params: params,
      method: 'get',
    })
  }

  // 判断当前用户是否有新建权限
  checkUserPermission(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/riskcriteria/findHasPermission',
      data,
      method: 'post',
    })
  }

  // 获取当前用户风控机构
  findIamOrgId(deptId, moduleId = 'riskLibraryVersion') {
    const params = {
      orgId: deptId,
      moduleId,
    }
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/iamorg/findIamOrgId`,
      params,
    })
  }

  // 获取用户有权限的风控机构
  getUserHavePermissionOrg() {
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/iam-page/getHavePermissionOrg/riskLibraryVersion`,
    })
  }
}

export default new RiskCriteriaServices()
