/**
 * 告警工单管理接口
 */
import request from '@/utils/request'

// 查询工单状态，字典值
export function getJobStatus(params) {
  return request({
    url: 'dict/code/jobStatus',
    method: 'get',
    params
  })
}

// 告警内容列表，字典值
export function getAlarmContentType(alarmType) {
  return request({
    url: 'alarm/contentType',
    method: 'get',
    params: {
      alarmType: alarmType
    }
  })
}
// 告警工单查询
export function getJobList(params) {
  return request({
    url: 'job/list',
    method: 'get',
    params
  })
}

// 全部工单查询接口，工单搜索功能用
export function getJobSearchList(params) {
  return request({
    url: 'job/searchList',
    method: 'get',
    params
  })
}

// 超时未接收工单查询
export function getOvertimeGetList(params) {
  return request({
    url: 'job/overtimeGetList',
    method: 'get',
    params
  })
}

// 超时未处理工单查询
export function getOvertimeHandleList(params) {
  return request({
    url: 'job/overtimeHandleList',
    method: 'get',
    params
  })
}

// 工单详情
export function getJobInfo(jobId) {
  return request({
    url: 'job/info',
    method: 'get',
    params: {
      id: jobId
    }
  })
}

//根据工单状态统计工单数量
export function countByJobStatus() {
  return request({
    url: 'job/countByJobStatus',
    method: 'get'
  })
}

//接受工单
export function getJob(id) {
  return request({
    url: 'job/getJob',
    method: 'post',
    params:{
      id: id
    }
  })
}
//确认工单
export function confirmJob(params) {
  return request({
    url: 'job/confirmJob',
    method: 'post',
    params
  })
}
//转单
export function transferJob(jobId, userId) {
  return request({
    url: 'job/transferJob',
    method: 'post',
    params:{
      id: jobId,
      transferPerson: userId
    }
  })
}
//完成工单
export function overJob(params) {
  return request({
    url: 'job/overJob',
    method: 'post',
    params
  })
}

export function uploadImg(file) {
  const param = new FormData()
  param.append('file', file)
  return request({
    url: 'imageUpload',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: param
  })
}

