/**
 * 工作台
 */

import http from '../http'
import { https } from '../https'

export default {
  // page
  locationPage: data =>
    http.post('soil/v1/receive_location/page', data).then(res => res),
  pageRetain: data =>
    http.post('soil/v1/sample/page_retain', data).then(res => res),
  locationList: data =>
    http.post('soil/v1/receive_location/list', data).then(res => res),
  locationGetById: data =>
    http.get('soil/v1/receive_location/' + data).then(res => res),
  locationSave: data =>
    http.post('soil/v1/receive_location/', data).then(res => res),
  locationDeleteById: data =>
    http.delete('soil/v1/receive_location/?ids=' + data).then(res => res),
  removeSampleFromLocation: data =>
    http
      .post('soil/v1/sample/remove_sample_from_location/', data)
      .then(res => res),
  locationEdit: data =>
    http.put('soil/v1/receive_location/' + data.id, data.obj).then(res => res),
  // 试验室领样操作
  takeSample: data =>
    http.post('soil/v1/sample/take_sample', data).then(res => res),
  // 备样历史分页列表
  pageBackupHis: data =>
    http.post('soil/v1/sample_backup/page_backup_his', data).then(res => res),
  // 备样管理提交申请
  appleHandle: data =>
    http.post('soil/v1/sample_backup/apply_handle', data).then(res => res),
  // 样品处理分页列表
  pageBackupHandleCheck: data =>
    http
      .post('soil/v1/sample_backup/page_backup_handle_check', data)
      .then(res => res),
  pageBackupHandleCheckHis: data =>
    http
      .post('soil/v1/sample_backup/page_backup_handle_check_his', data)
      .then(res => res),
  // 样品处理审批通过
  disposalOk: data =>
    http.post('soil/v1/sample_backup/disposal_ok', data).then(res => res),
  // 样品处理审批驳回
  disposalFail: data =>
    http.post('soil/v1/sample_backup/disposal_fail', data).then(res => res),
  // 备样管理处理备样申请
  handleOk: data =>
    http.post('soil/v1/sample_backup/handle_ok', data).then(res => res),
  pageSurplus: data =>
    http.post('soil/v1/prepare/page_surplus', data).then(res => res),
  // 余样处理审批分页列表
  pageSurplusHandleCheck: data =>
    http
      .post('soil/v1/prepare/page_surplus_handle_check', data)
      .then(res => res),
  // 余样管理处理备样申请
  surplusApplyHandle: data =>
    http.post('soil/v1/prepare/apply_handle', data).then(res => res),
  // 余样管理处理备样申请
  surplusHandleOk: data =>
    http.post('soil/v1/prepare/handle_ok', data).then(res => res),
  // 余品处理审批通过
  surplusDisposalOk: data =>
    http.post('soil/v1/prepare/disposal_ok', data).then(res => res),
  // 余样处理审批驳回
  surplueDisposalFail: data =>
    http.post('soil/v1/prepare/disposal_fail', data).then(res => res),
  // 余样样品历史分页列表
  pageSurplusHis: data =>
    http.post('soil/v1/prepare/page_surplus_his', data).then(res => res),
  // 报告模板
  reportTemplate: data =>
    http.post('soil/v1/report/page', data).then(res => res),
  reportMake: data =>
    https
      .post('soil/v1/report/make_report', JSON.stringify(data))
      .then(res => res),
  getReport: data =>
    http.get('soil/v1/report/get_report_' + data).then(res => res),
  getToken: data =>
    http.get('/print/url/get_access_token', data).then(res => res),
  // 报告编制提交至报告审核
  reportMakeSubmit: data =>
    http
      .post('soil/v1/entrust/report_make_submit?ids=' + data)
      .then(res => res),
  // 报告审核提交至报告签发
  reportCheckSubmit: data =>
    http
      .post('soil/v1/entrust/report_check_submit?ids=' + data)
      .then(res => res),
  // 报告审核退回至报告编制
  reportCheckBack: data =>
    http
      .post(
        'soil/v1/entrust/report_check_back?ids=' +
          data.ids +
          '&reason=' +
          data.remark
      )
      .then(res => res),
  // 报告签发提交
  reportIssueSubmit: data =>
    http
      .post('soil/v1/entrust/report_issue_submit?ids=' + data)
      .then(res => res),
  // 报告签发退回
  reportIssueBack: data =>
    http
      .post(
        'soil/v1/entrust/report_issue_back?ids=' +
          data.ids +
          '&reason=' +
          data.remark
      )
      .then(res => res),
  expReportIssueBack: data =>
    http
      .post(
        'soil/v1/exp_report/exp_report_issue_back?ids=' +
          data.ids +
          '&remark=' +
          data.remark
      )
      .then(res => res),
  expReportCheckBack: data =>
    http
      .post(
        'soil/v1/exp_report/exp_report_check_back?ids=' +
          data.ids +
          '&remark=' +
          data.remark
      )
      .then(res => res),

  // 样品检测退回
  testInputBack: data =>
    http
      .post(
        'soil/v1/experiment/exp_data_input_back?ids=' +
          data.ids +
          '&reason=' +
          data.remark
      )
      .then(res => res),
  getDictList: data =>
    http.post('res/v1/dict/dict_query?type=' + data).then(res => res),
  editBackup: data =>
    http.put('soil/v1/sample_backup/' + data.id, data.obj).then(res => res),
  // bathUpdateBackupInfo: data =>
  //   http
  //     .post(
  //       'soil/v1/sample_backup/bath_update_backup_info/?ids=' + data.id,
  //       data.obj
  //     )
  //     .then(res => res),
  bathUpdateBackupInfo: data =>
    http
      .post('soil/v1/sample_backup/bath_update_backup_info/', data)
      .then(res => res),
  editItem: data =>
    http.post('soil/v1/experiment/bath_update_info', data).then(res => res),
  // 余样编辑
  editPrepare: data =>
    http.put('soil/v1/prepare/' + data.id, data.obj).then(res => res),
  // 批量填写余样信息
  bathUpdateSurplusInfo: data =>
    http
      .post('soil/v1/prepare/bath_update_surplus_info/', data)
      .then(res => res),
  getUserList: data => http.post('/base/v1/user/page').then(res => res),
  queryUserList: data => http.post('/base/v1/user/page', data).then(res => res),
  scanTakeSample: data =>
    http
      .post('soil/v1/sample/scan_take_sample?sampleCode=' + data)
      .then(res => res),
  pageLocationSample: data =>
    http.post('soil/v1/sample/page_location_sample', data).then(res => res),
  importExperiments: data =>
    http.post('soil/v1/experiment/import_experiments', data).then(res => res),
  pageSecondary: data =>
    http.post('soil/v1/prepare/page_secondary', data).then(res => res),
  pageSecondaryHis: data =>
    http.post('soil/v1/prepare/page_secondary_his', data).then(res => res),
  sampleDeleteById: data =>
    http.delete('soil/v1/sample/?ids=' + data).then(res => res),
  // 制备审核通过
  prepareCheckOk: data =>
    http.post('soil/v1/sample/prepare_check_ok', data).then(res => res),
  // 制备审核驳回
  // prepareCheckBack: data =>
  //   http
  //     .post(
  //       'soil/v1/sample/prepare_check_back?ids=' +
  //         data.ids +
  //         '&remark=' +
  //         data.remark
  //     )
  //     .then(res => res),
  prepareCheckBack: data =>
    http.post('soil/v1/sample/prepare_check_back', data).then(res => res),
  sampleBringOut: data =>
    http.post('soil/v1/sample/sample_bring_out', data).then(res => res),
  boxPage: data => http.post('soil/v1/box/page', data).then(res => res),
  addBox: data => http.post('soil/v1/box/', data).then(res => res),
  deleteBox: data => http.delete('soil/v1/box/?ids=' + data).then(res => res),
  editBox: data =>
    http.put('soil/v1/box/' + data.id, data.obj).then(res => res),
  getByIdBox: data => http.get('soil/v1/box/' + data).then(res => res),
  // saveExcelOriginalRecord: data =>
  //   http
  //     .post(
  //       'soil/v1/experiment/save_excel_original_record?ids=' +
  //         data.ids +
  //         '&templateId=' +
  //         data.id
  //     )
  //     .then(res => res),
  saveExcelOriginalRecord: data =>
    http
      .post('soil/v1/experiment/save_excel_original_record', data)
      .then(res => res),
  saveSeniorExcelOriginalRecord: data =>
    http
      .post('soil/v1/experiment/save_senior_excel_original_record', data)
      .then(res => res),
  saveExcelOpenSoilRecord: data =>
    http
      .post('soil/v1/experiment/save_excel_open_soil_record', data)
      .then(res => res),

  saveExcelExport: data =>
    http
      .post('soil/v1/alone_in_out_stock/save_excel_exp_report', data)
      .then(res => res),

  saveOutExcelExport: data =>
    http
      .post('soil/v1/alone_in_out_stock/save_excel_out_export', data)
      .then(res => res),

  // saveExcelExpReport: data =>
  //   http
  //     .post(
  //       'soil/v1/experiment/save_excel_exp_report?ids=' +
  //         data.ids +
  //         '&templateId=' +
  //         data.templateId +
  //         '&expName=' +
  //         data.expName +
  //         '&entrustId=' +
  //         data.entrustId
  //     )
  //     .then(res => res),
  saveExcelExpReport: data =>
    http
      .post('soil/v1/experiment/save_excel_exp_report', data)
      .then(res => res),
  generateReport: data =>
    http
      .post(
        'soil/v1/exp_report/generate_report?entrustId=' +
          data.entrustId +
          '&templateId=' +
          data.templateId +
          '&expReportIds=' +
          data.expReportIds
      )
      .then(res => res),
  aloneSamplePage: data =>
    http.post('soil/v1/alone_sample/page', data).then(res => res),
  aloneWarehouseLocation: data =>
    http.post('soil/v1/alone_warehouse_location/page', data).then(res => res),
  aloneWarehouseLocationAdd: data =>
    http.post('soil/v1/alone_warehouse_location/', data).then(res => res),
  aloneWarehouseLocationGetById: data =>
    http.get('soil/v1/alone_warehouse_location/' + data).then(res => res),
  aloneWarehouseLocationEdit: data =>
    http
      .put('soil/v1/alone_warehouse_location/' + data.id, data.obj)
      .then(res => res),
  aloneWarehouseLocationDelete: data =>
    http
      .delete('soil/v1/alone_warehouse_location/?ids=' + data)
      .then(res => res),
  pageWaitStorage: data =>
    http.post('soil/v1/alone_sample/page_wait_storage', data).then(res => res),
  inStorageSubmit: data =>
    http.post('soil/v1/alone_sample/in_storage_submit', data).then(res => res),
  pageWaitDelivery: data =>
    http.post('soil/v1/alone_sample/page_wait_delivery', data).then(res => res),
  outStorageSubmit: data =>
    http.post('soil/v1/alone_sample/out_storage_submit', data).then(res => res),
  pageStorehouseSample: data =>
    http
      .post('soil/v1/alone_sample/page_storehouse_sample', data)
      .then(res => res),
  aloneSampleDelete: data =>
    http.delete('soil/v1/alone_sample/?ids=' + data).then(res => res),
  pageWarehouseLocationSample: data =>
    http
      .post('soil/v1/sample/page_warehouse_location_sample', data)
      .then(res => res),
  storageSampleSubmit: data =>
    http
      .post('soil/v1/alone_sample/storage_sample_submit', data)
      .then(res => res),
  addSample: data =>
    http.post('soil/v1/sample/sample_split_save', data).then(res => res),
  getStayDate: data =>
    http
      .post('soil/v1/alone_in_out_stock/get_stay_date', data)
      .then(res => res),
  outStorageBack: data =>
    http.post('soil/v1/alone_sample/out_storage_back', data).then(res => res),
  editSample: data =>
    http.put('soil/v1/sample/' + data.id, data.obj).then(res => res)
}
