import { axios } from '@/utils/request'
import { stringify } from 'qs'

/**
 * page func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function getPurchaseDemandPlanAddPage (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/page?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * add func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function addPurchaseDemandPlanAdd (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updatePurchaseDemandPlanAdd (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

/**
 * fetch single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function fetchPurchaseDemandPlanAdd (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/' + parameter.id,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * query list func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function queryPurchaseDemandPlanAdd (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * delete batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deletePurchaseDemandPlanAdds (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds',
    method: 'DELETE',
    data: parameter
  })
}

/**
 * delete single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deletePurchaseDemandPlanAdd (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/' + parameter.id,
    method: 'DELETE',
    data: parameter
  })
}

/**
 * export file
 * parameter: { }
 * @param parameter :
 * @returns {*}
 */
export function exportPurchaseDemandPlanAdd (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/export?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    responseType: 'blob'
  })
}

/**
 * submit func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function submit (id) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/' + id + '/submit',
    method: 'PUT'
  })
}

/**
 * audit func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function audit (parameter) {
  return axios({
    url: '/purchase/purchase-demand-plan-adds/' + parameter.id + '/audit',
    method: 'PUT',
    data: parameter
  })
}