import request from '@/utils/request'

// 查询安全培训列表
export function listTrain(query) {
  return request({
    url: '/exam/train/list',
    method: 'get',
    params: query
  })
}
// 查询我的安全培训列表
export function myListTrain(query) {
  return request({
    url: '/exam/train/list/my',
    method: 'get',
    params: query
  })
}
// 查询安全培训下拉框
export function optionTrain(data) {
  return request({
    url: '/exam/train/queryOption',
    method: 'post',
    data: data
  })
}
// 查询安全培训详细
export function getTrainLearn(id) {
  return request({
    url: '/exam/train/' + id+'/learn',
    method: 'get'
  })
}
// 查询安全培训详细
export function getTrain(id) {
  return request({
    url: '/exam/train/' + id,
    method: 'get'
  })
}

// 新增安全培训
export function addTrain(data) {
  return request({
    url: '/exam/train',
    method: 'post',
    data: data
  })
}
// 完成安全培训
export function learnTrain(id) {
  return request({
    url: `/exam/learnrecord/${id}`,
    method: 'post'
  })
}


// 修改安全培训
export function updateTrain(data) {
  return request({
    url: '/exam/train',
    method: 'put',
    data: data
  })
}

// 删除安全培训
export function delTrain(id) {
  return request({
    url: '/exam/train/' + id,
    method: 'delete'
  })
}
