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

/**
 * 更新库存
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function checkIn (parameter) {
  return axios({
    url: '/sb/sb-check-forms/in/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

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

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

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

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

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

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

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

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