import { parseStrEmpty } from '/@/utils/index'
import request from '/@/utils/request'

export function getList(params?: any) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params,
  })
}

export const doAdd = (data: any) => {
  return request({
    url: '/system/user',
    method: 'post',
    data,
  })
}

export const doEdit = (data: any) => {
  return request({
    url: '/system/user',
    method: 'put',
    data,
  })
}

export const doDelete = (userId: any) => {
  return request({
    url: `/system/user/${userId}`,
    method: 'delete',
  })
}

// 查询用户详细
export function getUser(userId: any) {
  return request({
    url: `/system/user/${parseStrEmpty(userId)}`,
    method: 'get',
  })
}

// 用户状态修改
export function changeUserStatus(userId: any, status: any) {
  const data = {
    userId,
    status,
  }
  return request({
    url: '/system/user/changeStatus',
    method: 'put',
    data,
  })
}
