import request from '@/utils/request'

// 查询实验室信息列表
export function bookLabList(query) {
  return request({
    url: '/labbooking/lab/bookLabList',
    method: 'get',
    params: query
  })
}

// 管理员查询实验室信息列表
export function labList(query) {
  return request({
    url: '/labbooking/lab/labList',
    method: 'get',
    params: query
  })
}

// 预约状态修改
export function changeUserStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/labbooking/lab/changeStatus',
    method: 'put',
    data: data
  })
}

export function labUse(year, term) {
  return request({
    url: '/labbooking/lab/labUse',
    method: 'get',
    params: year, term
  })
}

// 查询实验室信息详细
export function getLab(id) {
  return request({
    url: '/labbooking/lab/' + id,
    method: 'get'
  })
}

// 新增实验室信息
export function addLab(data) {
  return request({
    url: '/labbooking/lab',
    method: 'post',
    data: data
  })
}

// 修改实验室信息
export function updateLab(data) {
  return request({
    url: '/labbooking/lab',
    method: 'put',
    data: data
  })
}

// 删除实验室信息
export function delLab(ids) {
  return request({
    url: '/labbooking/lab/' + ids,
    method: 'delete'
  })
}

// 导出实验室信息
export function bookLabExport(query) {
  return request({
    url: '/labbooking/lab/bookLabExport',
    method: 'get',
    params: query
  })
}

// 管理员导出实验室信息
export function labExport(query) {
  return request({
    url: '/labbooking/lab/labExport',
    method: 'get',
    params: query
  })
}

// 根据用户查询学院
export function getMyDept() {
  return request({
    url: '/labbooking/lab/getDept',
    method: 'get'
  })
}