import { config, networkUtils } from '../../../utils';

const { request } = networkUtils;
const { api } = config;
const { order } = api;
const { purchasingOrder, purchaeOrderDtls, batchExamine } = order;

export async function query(params: object) {
  return request({
    url: purchasingOrder,
    method: 'get',
    data: params,
  });
}

export async function getSingle(id: number) {
  return request({
    url: `${purchasingOrder}/${id}`,
    method: 'get',
  });
}

export async function queryDtls(params: object) {
  return request({
    url: `${purchaeOrderDtls}/list`,
    method: 'get',
    data: params,
  });
}

export async function update(params: object) {
  return request({
    url: `${purchasingOrder}/batch/put`,
    method: 'post',
    data: params,
  });
}

export async function batchCheck(params: object) {
  return request({
    url: `${purchasingOrder}/batchCheck`,
    method: 'post',
    data: params,
  });
}

export async function doBatchApprove(params) {
  return networkUtils.request({
    url: batchExamine,
    method: 'post',
    data: params,
  })
}
