/**
 * 首页接口
 */
// import QS from 'qs'
import request from '@/api/index'

// 检定统计
export function getMeasureDetail() {
  return request({
    url: '/board/check/summary',
    method: 'get',
  })
}
// 检定统计趋势 - echart数据
export function getMeasureDetailTrend() {
  return request({
    url: '/board/check/trend',
    method: 'get',
  })
}
// 日历列表
export function getCalendarList(params: object) {
  return request({
    url: '/board/calendar/list',
    method: 'get',
    params,
  })
}
// 删除日历
export function delSchedule(params: object) {
  return request({
    url: `/board/calendar/remove?id=${params.id}`,
    method: 'post',
  })
}
// 编辑日历
export function editSchedule(data: object) {
  return request({
    url: '/board/calendar/save',
    method: 'post',
    data,
  })
}
// 设备分类统计
export function getDeviceClassify(params: object) {
  return request({
    url: '/board/overview/equipmentCategory',
    method: 'get',
    params,
  })
}
// 设备状态统计
export function getDeviceStatus(params: object) {
  return request({
    url: '/board/overview/equipmentUsageStatus',
    method: 'get',
    params,
  })
}
// 设备类型统计
export function getDeviceType(params: object) {
  return request({
    url: '/board/overview/equipmentName',
    method: 'get',
    params,
  })
}
// 首页看板消息
export function getBoardMessage(data: any) {
  return request({
    url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`,
    method: 'post',
    data,
  })
}
// 审批列表-待处理
export function getBoardApprove(data: any) {
  if (data.readStatus === '0') {
    // 未
    return request({
      url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`,
      method: 'post',
      data,
    })
  }
  else {
    // 已
    return request({
      url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`,
      method: 'post',
      data,
    })
  }
}
// 在用设备信息
export function inUseInfo(params: object) {
  return request({
    url: '/board/equipment/inUseInfo',
    method: 'get',
    params,
  })
}
// 在检设备
export function inCheckInfo(params: object) {
  return request({
    url: '/board/equipment/inCheckInfo',
    method: 'get',
    params,
  })
}
// 待检设备
export function toCheckInfo(params: object) {
  return request({
    url: '/board/equipment/toCheckInfo',
    method: 'get',
    params,
  })
}
// 将消息置为已读

export function setRead(data: object) {
  return request({
    url: '/board/message/setRead',
    method: 'post',
    data,
  })
}
