import request from '@/utils/request'

// 查询仓库库区列表
export function listStorageArea(query) {
  return request({
    url: '/system/storageArea/list',
    method: 'get',
    params: query
  })
}

// 查询仓库库区详细
export function getStorageArea(id) {
  return request({
    url: '/system/storageArea/' + id,
    method: 'get'
  })
}

// 新增仓库库区
export function addStorageArea(data) {
  return request({
    url: '/system/storageArea',
    method: 'post',
    data: data
  })
}

// 修改仓库库区
export function updateStorageArea(data) {
  return request({
    url: '/system/storageArea',
    method: 'put',
    data: data
  })
}

// 删除仓库库区
export function delStorageArea(id) {
  return request({
    url: '/system/storageArea/' + id,
    method: 'delete'
  })
}
// 启用
export function enabled(id) {
  return request({
    url: '/system/storageArea/enable/' + id,
    method: 'delete'
  })
}

// 禁用
export function disabled(id) {
  return request({
    url: '/system/storageArea/disable/' + id,
    method: 'delete'
  })
}

// 状态修改
export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/system/storageArea/changeStatus',
    method: 'put',
    data: data
  })
}