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

class PermissionService {
  // 获取顶节点 api/xcoa-mobile/v1/iamorg/getCurrentAuditOrg
  // /api/xcoa-mobile/v1/iamorg/getManagedHierarchyOrg
  getParentOrgInfo() {
    return axios({
      url: 'api/xcoa-mobile/v1/iamorg/getManagedHierarchyOrg',
      method: 'post',
    }).then((res) => {
      return res
    })
  }

  // 获取节点下情况
  getOrgInf(id) {
    return axios({
      url: 'api/xcoa-mobile/v1/iamorg/getAuditOrgTreeNodeById/' + id,
      method: 'post',
    }).then((res) => {
      return res
    })
  }

  // 获取模块配置
  // getConfigList() {
  //   return axios({
  //     url: 'api/xcoa-mobile/v1/iam-module-config/getConfigList',
  //     method: 'post',
  //   }).then((res) => {
  //     return res
  //   })
  // }

  // 获取当前用户查阅权限
  getAllPermission(formId) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-view-permission/getAllPermission/' + formId,
      method: 'post',
    }).then((res) => {
      return res
    })
  }

  // 获取维护配置接口
  getEditPermission(id, params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iameditpermission/getEditPermission/' + id,
      method: 'post',
      params,
    }).then((res) => {
      return res
    })
  }

  // 保存维护接口
  saveEditPermission(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iameditpermission/save',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 获取维护配置接口
  getViewPermission(id, params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iamviewpermission/getViewPermission/' + id,
      method: 'post',
      params,
    }).then((res) => {
      return res
    })
  }

  // 保存查看接口
  saveViewPermission(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iamviewpermission/save',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }
}
export default new PermissionService()
