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

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

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

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

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

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

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

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