import request from '@/utils/request'

// 公用接口

// 公用导出
export function exportApi(url, data, method) {
  let option = {
    url: url,
    method: method,
    responseType: 'blob'
  }
  if (method == 'get') {
    option.params = data
  } else {
    option.data = data
  }
  return request(option)
}

// 公用导入
export function importApi(url, data, method) {
  let option = {
    url: url,
    method: method ? method : 'get'
  }
  if (method == 'get') {
    option.params = data
  } else {
    option.data = data
  }
  return request(option)
}

// 获取Excel导入模板
export function getExcelTemplate(type) {
  return request({
    url: '/file/exportExcel/' + type,
    method: 'get',
    responseType: 'blob'
  })
}

// 根据登录信息获取用户权限
export function getResources(params) {
  return request({
    url: '/getResources',
    method: 'get',
    params
  })
}
