import request from '@/utils/request'

// 查询危险源列表
export function listHazard(query) {
  return request({
    url: '/laboratory/hazard/list',
    method: 'get',
    params: query
  })
}
// 查询实验室已有危险源列表
export function subjectListHazard(subId) {
  return request({
    url: '/laboratory/hazard/'+subId+'/list',
    method: 'get',
  })
}

// 查询危险源下拉列表
export function optionHazard(data) {
  return request({
    url: '/laboratory/hazard/queryOption',
    method: 'post',
    data: data
  })
}

// 查询危险源详细
export function getHazard(id) {
  return request({
    url: '/laboratory/hazard/' + id,
    method: 'get'
  })
}

// 新增危险源
export function addHazard(data) {
  return request({
    url: '/laboratory/hazard',
    method: 'post',
    data: data
  })
}

// 修改危险源
export function updateHazard(data) {
  return request({
    url: '/laboratory/hazard/edit',
    method: 'post',
    data: data
  })
}

// 删除危险源
export function delHazard(id) {
  return request({
    url: '/laboratory/hazard/' + id,
    method: 'delete'
  })
}
//获取实验室布局尺寸
export function getHazardLayout(id) {
  return request({
    url: '/laboratory/layout/' + id,
    method: 'get'
  })
}

// 关联实验室与危险源
export function addRelation(data) {
  return request({
    url: '/laboratory/hazard/addRelation',
    method: 'post',
    data: data
  })
}
