import fetch from '../fetch'
import { getBaseUrl } from '@/utils/index'

export const uploadExcel = (data, projectId) => {
  // return utils.checkAuth(()=>{
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/v2/role/importRoleFile?projectId=' + projectId),
    method: 'post',
    data: data,
    description: '上传excel文件',
  })
  // })
}
export const uploadOrgExcel = (data, projectId) => {
  // return utils.checkAuth(()=>{
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/new/scope/org/v1/' + projectId + '/import'),
    method: 'put',
    data: data,
    description: '上传excel文件',
  })
  // })
}
export const uploadPersonExcel = (data, projectId) => {
  // return utils.checkAuth(()=>{
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/new/scope/doctor/v1/' + projectId + '/import'),
    method: 'put',
    data: data,
    description: '上传excel文件',
  })
  // })
}
