import request from '@/utils/request'
import commonUtil from "@/utils/common";

// 查询出库申请单列表
export function listOutbound(query) {
  return request({
    url: '/outbound/list',
    method: 'get',
    params: query
  })
}

// 查询出库申请单详细
export function getOutbound(id) {
  return request({
    url: '/outbound/' + id,
    method: 'get'
  })
}

// 新增出库申请单
export function addOutbound(data) {
  return request({
    url: '/outbound',
    method: 'post',
    data: data
  })
}

// 修改出库申请单
export function updateOutbound(data) {
  return request({
    url: '/outbound',
    method: 'put',
    data: data
  })
}
export const delOutbound = data => {
  const fd = commonUtil.objectToFormData(data)
  return request({
    url: '/outbound/remove',
    method: 'post',
    data: fd
  });
}

// 启用
export function enabled(id) {
  return request({
    url: '/outbound/enable/' + id,
    method: 'delete'
  })
}

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

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

// 导出
export function exportOutbound(query) {
  return request({
    url: '/outbound/export',
    method: 'get',
    params: query
  })
}
