import axios from '@/common/services/axios-instance'
class MasterDataService {
  // 获取组织父节点
  getOrgNodeList() {
    return axios({
      url: 'api/xcoa-mobile/v1/group-manger/root-node',
      method: 'get',
    })
  }

  // 获取组织子节点
  getOrgChildNodeList(id) {
    return axios({
      url: 'api/xcoa-mobile/v1/group-manger/getChildren?parent=' + id + '&hierarchical=0',
      method: 'get',
    })
  }

  // 保存关联操作记录接口
  saveMasterData(params) {
    return axios({
      url: `api/xcoa-mobile/v1/iamoperationrecord/save`,
      method: 'post',
      data: params,
    })
  }

  getGlData(params) {
    return axios({
      url: `api/xcoa-mobile/v1/iamoperationrecord/list?systemName=${params.systemName}&code=${params.code}&name=${params.name}&page=${params.page}&size=${params.size}`,
      method: 'get',
    })
  }

  // 查询系统名称列表
  getSystemNameList() {
    return axios({
      url: `api/xcoa-mobile/v1/iamoperationrecord/sys-names`,
      method: 'get',
    })
  }

  // 保存组织数据
  saveOrgData(params) {
    // api/framework/v1/page/handleData
    return axios({
      url: `api/xcoa-mobile/v1/group-manger/save`,
      method: 'post',
      data: params,
    })
  }

  // 获取分类列表
  getOrgTypeList() {
    return axios({
      url: `api/xcoa-mobile/v1/group-manger/all`,
      method: 'get',
    })
  }

  // 删除组织
  deleteOrgData(ids) {
    return axios({
      url: `api/xcoa-mobile/v1/group-manger/delete/?ids=${ids}`,
      method: 'get',
    })
  }

  // 编辑组织
  exitOrgData(params) {
    return axios({
      url: `api/xcoa-mobile/v1/group-manger/update`,
      method: 'post',
      data: params,
    })
  }

  // 撤销关联记录
  revokeOrgData(id) {
    return axios({
      url: `api/xcoa-mobile/v1/iamoperationrecord/delete?id=${id}`,
      method: 'get',
    })
  }

  // 获取系统列表树
  getSystemTree(params) {
    return axios({
      url: `api/xcoa-mobile/v1/iamoperationrecord/queryCompanyBasedOnSystem`,
      method: 'post',
      data: params,
    })
  }

  // 获取组织保存数据
  getSystemInfo(params) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-page/businessList`,
      method: 'post',
      data: params,
    })
  }
}
export default new MasterDataService()
