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

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

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

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

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function copy (parameter) {
  return axios({
    url: '/sb/measure-logs/copy',
    method: 'PUT',
    data: parameter
  })
}

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

/**
 * fetch single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function generateJobByCheckStandard (parameter) {
  return axios({
    url: '/sb/measure-logs/generate',
    method: 'PUT',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

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

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

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

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

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

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