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

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

/**
 * page func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function getSbAllocateApplyPageApply (parameter) {
  return axios({
    url: '/sb/allocate-applies/apply/page?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * add func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function addSbAllocateApply (parameter) {
  return axios({
    url: '/sb/allocate-applies',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updateSbAllocateApply (parameter) {
  return axios({
    url: '/sb/allocate-applies/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

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

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

/**
 * delete batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deleteSbAllocateApplys (parameter) {
  return axios({
    url: '/sb/allocate-applies',
    method: 'DELETE',
    data: parameter
  })
}

/**
 * delete single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deleteSbAllocateApply (parameter) {
  return axios({
    url: '/sb/allocate-applies/' + parameter.id,
    method: 'DELETE',
    data: parameter
  })
}

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

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function auditSbAllocateApply (parameter) {
  return axios({
    url: '/sb/allocate-applies/audit/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}
