import request from '@/axios';

const baseUrl = '/blade-transport/loading-manage';

export const exportUrl = `${baseUrl}/export-loading-manage`;

export const getList = (current, size, params) =>
  request({
    url: `${baseUrl}/list`,
    method: 'get',
    params: {
      ...params,
      current,
      size,
    },
  });

export const getDetail = id =>
  request({
    url: `${baseUrl}/detail`,
    method: 'get',
    params: {
      id,
    },
  });

export const saveDraft = row =>
  request({
    url: `${baseUrl}/save-draft`,
    method: 'post',
    data: row,
  });

export const submit = row =>
  request({
    url: `${baseUrl}/submit`,
    method: 'post',
    data: row,
  });

export const remove = ids =>
  request({
    url: `${baseUrl}/remove`,
    method: 'post',
    params: {
      ids,
    },
  });

export const copy = id =>
  request({
    url: `${baseUrl}/copy`,
    method: 'post',
    params: {
      id,
    },
  });

export const reassign = row =>
  request({
    url: `${baseUrl}/reassign`,
    method: 'post',
    data: row,
  });

export const cancel = id =>
  request({
    url: `${baseUrl}/cancel`,
    method: 'post',
    params: {
      id,
    },
  });

export const complete = id =>
  request({
    url: `${baseUrl}/complete`,
    method: 'post',
    params: {
      id,
    },
  });

export const batchComplete = ids =>
  request({
    url: `${baseUrl}/batch-complete`,
    method: 'post',
    params: {
      ids,
    },
  });
