import { HcApi } from '../../request/index'

export const getList = ( params) => {
  return HcApi({
    url: '/api/blade-system/user/page',
    method: 'get',
    params:params,
     
  })
}

export const remove = ids => {
  return HcApi({
    url: '/api/blade-system/user/remove',
    method: 'post',
    params: {
      ids,
    },
  })
}

export const add = row => {
  return HcApi({
    url: '/api/blade-system/user/submit',
    method: 'post',
    data: row,
  })
}

export const update = row => {
  return HcApi({
    url: '/api/blade-system/user/update',
    method: 'post',
    data: row,
  })
}


export const getUser = id => {
  return HcApi({
    url: '/api/blade-system/user/detail',
    method: 'get',
    params: {
      id,
    },
  })
}



export const getUserInfo = () => {
  return HcApi({
    url: '/apiblade-system/user/info',
    method: 'get',
  })
}

export const resetPassword = userIds => {
  return HcApi({
    url: '/api/blade-system/user/reset-password',
    method: 'post',
    params: {
      userIds,
    },
  })
}

export const updatePassword = (oldPassword, newPassword, newPassword1) => {
  return HcApi({
    url: '/api/blade-system/user/update-password',
    method: 'post',
    params: {
      oldPassword,
      newPassword,
      newPassword1,
    },
  })
}

export const updateInfo = row => {
  return HcApi({
    url: '/api/blade-system/user/update-info',
    method: 'post',
    data: row,
  })
}

export const grant = (userIds, roleIds) => {
  return HcApi({
    url: '/api/blade-system/user/grant',
    method: 'post',
    params: {
      userIds,
      roleIds,
    },
  })
}

export const unlock = userIds => {
  return HcApi({
    url: '/api/blade-system/user/unlock',
    method: 'post',
    params: {
      userIds,
    },
  })
}
   //导出数据
   export const getExportExcel = (form, msg = true) =>{
    return HcApi({
        url: '/api/blade-system/user/export-user',
        method: 'get',
        params: form,
        responseType: 'blob',
    }, msg)
}