import request from '@/utils/request'

// 查询物料bom列表
export function listBom(query) {
  return request({
    url: '/system/bom/list',
    method: 'get',
    params: query
  })
}

// 查询物料bom详细
export function getBom(id) {
  return request({
    url: '/system/bom/' + id,
    method: 'get'
  })
}

// 新增物料bom
export function addBom(data) {
  return request({
    url: '/system/bom',
    method: 'post',
    data: data
  })
}

// 修改物料bom
export function updateBom(data) {
  return request({
    url: '/system/bom',
    method: 'put',
    data: data
  })
}

// 删除物料bom
export function delBom(id) {
  return request({
    url: '/system/bom/' + id,
    method: 'delete'
  })
}
// 启用
export function enabled(id) {
  return request({
    url: '/system/bom/enable/' + id,
    method: 'delete'
  })
}

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

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