import request from '@/config/axios'

//用户分页列表
export const getUserList = (params) => {
  return request.get({ url: '/system/user/v2/page', params })
}
// 归属机构
export const getSimpleDeptList = (params) => {
  return request.get({ url: '/system/dept/v2/list', params })
}

// 角色简单列表
export const getroleList = () => {
  return request.get({ url: '/system/role/v2/list-all-simple' })
}


// 用户新增
export const userCreate = (data) => {
  return request.post({ url: '/system/user/v2/create', data })
}

// 用戶详情 
export const getDetails = (params) => {
  return request.get({ url: '/system/user/v2/get', params })
}


// 用户更新
export const updateUser = (data) => {
  return request.put({ url: '/system/user/v2/update', data })
}


//用戶单个删除
export const deleteOne = (params) => {
  return request.delete({ url: '/system/user/v2/delete', params })
}

// 用户批量删除
export const deleteBatch = (data) => {
  return request.post({ url: '/system/user/v2/deleteBatch', data })
}

// 获取免登链接
export const getLoginPath = (params) => {
  return request.get({ url: '/freelogin/sdgkFreePath', params })
}

// 用户密码重置
export const resetUserPwd = (id: number, password: string) => {
  const data = {
    id,
    password
  }
  return request.put({ url: '/system/user/update-password', data: data })
}
