import request from '@/utils/request';
//获取仪器状态
export function getInstrumentStatus() {
  return request({
    url: '/api/self_inspection',
    method: 'get'
  });
}

// 获取老样品试验设置
export function getOldSampleSet(data) {
  return request({
    url: '/api/get_history',
    method: 'post',
    data
  });
}

// 新增校准试验
export function additionalJZTest(data) {
  return request({
    url: '/api/insertExperimentJZ',
    method: 'post',
    data
  });
}
// 新增正式试验
export function additionalTest(data) {
  return request({
    url: '/api/insertExperiment',
    method: 'post',
    data
  });
}

// 保压实验
export function baoyaExper(data) {
  return request({
    url: '/api/insertExperimentBaoYa',
    method: 'post',
    data
  });
}

//结束后端进程
export function stopExperThread() {
  return request({
    url: '/api/kill_thread',
    method: 'get'
  });
}

//问询是否结束上次实验

export function bdstopExper() {
  return request({
    url: '/api/get_experiment_status',
    method: 'get'
  });
}

//修改比热
export function updateLossRate(data) {
  return request({
    url: '/api/specific_heat',
    method: 'post',
    data
  });
}

//修改热损失
export function updateHeatLoss(data) {
  return request({
    url: '/api/loss_rate',
    method: 'post',
    data
  });
}

//获取校准试验的详情
export function getJZExperimentDetailApi({ experimentjz_id }) {
  return request({
    url: `/api/experimentjz_info?experimentjz_id=${experimentjz_id}`,
    method: 'get'
  });
}

// 结束试验
export function stopExperimentApi(data) {
  return request({
    url: '/api/stopExperiment',
    method: 'post',
    data
  });
}
//获取试验列表数据
export function getExpData(data) {
  return request({
    url: '/api/get_experiment_list',
    method: 'post',
    data
  });
}

//查看试验曲线
export function getExperimentDataApi(data) {
  return request({
    url: '/api/get_data',
    method: 'post',
    data
  });
}

//导出
export function exportDataApi(data) {
  return request({
    url: 'api/export_table',
    method: 'post',
    data
  });
}

//浏览器导出
export function exportDataBrowserApi(data) {
  return request({
    url: 'api/export_table',
    method: 'post',
    data,
    responseType: 'blob'
  });
}

//设备自检
export function selfInspection() {
  return request({
    url: '/api/self_check',
    method: 'get'
  });
}

//获取试验次数
export function getExperimentTimes() {
  return request({
    url: '/api/experiment_count',
    method: 'get'
  });
}

// 删除实验报表项
export function delExperimentApi(data) {
  return request({
    url: '/api/del_experiment/',
    method: 'post',
    data
  });
}

// 获取一个试验的所有记录
export function getExperimentRecordApi(data) {
  return request({
    url: `/api/get_experiment_record`,
    method: 'post',
    data
  });
}

// // 获取实验记录的录像
// export function getExperimentVideoApi(data) {
//   return request({
//     url: `/api/view_video`,
//     method: 'post',
//     data
//   });
// }

// // 导出实验记录的录像
// export function exportExperimentVideoApi(data) {
//   return request({
//     url: `/api/export_video`,
//     method: 'post',
//     data
//   });
// }

// 导出实验记录的录像
export function addSampleApi(data) {
  return request({
    url: `/api/add_sample`,
    method: 'post',
    data
  });
}

// 获取试验记录的录像
export function getExperimentVideoApi(data) {
  return request({
    url: `/api/view_video`,
    method: 'post',
    data
  });
}

// 导出试验记录的录像
export function exportExperimentVideoApi(data) {
  return request({
    url: `/api/export_video`,
    method: 'post',
    data
  });
}

// 新增校准试验
export function additionalJZTest(data) {
  return request({
    url: '/api/insertExperimentJZ',
    method: 'post',
    data
  });
}