import request from '@/utils/request'

// 查询楼栋列表
export function listBuilding(query) {
  return request({
    url: '/laboratory/building/list',
    method: 'get',
    params: query
  })
}
// 查询楼层 通过楼栋ID(组织架构优化后废弃2023/6/20)
export function listFloorByBuildId(id) {
  return request({
    url: `/laboratory/building/${id}/list`,
    method: 'get'
  })
}
// 查询楼栋详细
// export function getBuilding(id) {
//   return request({
//     url: '/laboratory/building/' + id,
//     method: 'get'
//   })
// }
export function getBuilding(id) {
  return request({
    url: '/laboratory/building/lablayout?showHazard=false&deptId=' + id,
    method: 'get'
  })
}

// 修改实验室布局
export function updateSubject(data) {
  return request({
    url: '/laboratory/layout',
    method: 'put',
    data: data
  })
}

// 新增楼栋
export function addBuilding(data) {
  return request({
    url: '/laboratory/building',
    method: 'post',
    data: data
  })
}

// 修改楼栋
export function updateBuilding(data) {
  return request({
    url: '/laboratory/building',
    method: 'put',
    data: data
  })
}

// 删除楼栋
export function delBuilding(id) {
  return request({
    url: '/laboratory/building/' + id,
    method: 'delete'
  })
}

//查询楼栋/根据楼栋ID查询楼层(无权限)
export function buildFloorGetlist(query) {
  return request({
    url: '/laboratory/buildFloor/getlist',
    method: 'get',
    params: query
  })
}
