/**
 * 工作台
 */

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

export default {
  // page
  page: data => http.post('meter/v1/sample/page', data).then(res => res),
  templateList: data =>
    http.post('base/v1/file_template_classify/list', data).then(res => res),
  pageSubSample: data =>
    http.post('/meter/v1/sub_sample/page', data).then(res => res),
  pageSampleProgress: data =>
    http.post('meter/v1/sample/page_sample_progress', data).then(res => res),
  pageOutSampleProgress: data =>
    http
      .post('meter/v1/sample/page_out_sample_progress', data)
      .then(res => res),
  pageSampleReceive: data =>
    http.post('meter/v1/sample/page_sample_receive', data).then(res => res),
  pageSampleReceiveHis: data =>
    http.post('meter/v1/sample/page_sample_receive_his', data).then(res => res),

  pageSampleDistribute: data =>
    http.post('meter/v1/sample/page_sample_distribute', data).then(res => res),
  pageSampleDistributeHis: data =>
    http
      .post('meter/v1/sample/page_sample_distribute_his', data)
      .then(res => res),
  pageSampleFlow: data =>
    http.post('meter/v1/sample/page_sample_flow', data).then(res => res),

  // 报告模板
  pageReport: data =>
    http.post('/base/v1/file_template/page', data).then(res => res),
  // 车辆管理
  pageCarManage: data =>
    http.post('/res/v1/car_info/page_car_manage', data).then(res => res),
  pageCarList: data =>
    http.post('meter/v1/test_car/page', data).then(res => res),
  // 仪器列表
  pageInstrutEdit: data =>
    http.post('meter/v1/test_device/page', data).then(res => res),
  pageSubpackageSample: data =>
    http.post('meter/v1/sample/page_subpackage_sample', data).then(res => res),
  pageSubpackageSampleQuery: data =>
    http
      .post('meter/v1/sample/page_subpackage_sample_query', data)
      .then(res => res),
  pageSubpackageSampleInput: data =>
    http
      .post('meter/v1/sample/page_subpackage_sample_input', data)
      .then(res => res),
  pageOutDistribute: data =>
    http.post('meter/v1/sample/page_distribute', data).then(res => res),
  pageOutDistributeHis: data =>
    http.post('meter/v1/sample/page_distribute_his', data).then(res => res),
  pageOutPersonalTask: data =>
    http.post('meter/v1/sample/page_out_personal_task', data).then(res => res),
  pageOutPersonalTaskHis: data =>
    http
      .post('meter/v1/sample/page_out_personal_task_his', data)
      .then(res => res),
  pageSampleInput: data =>
    http.post('meter/v1/sample/page_sample_input', data).then(res => res),

  pageSampleInputHis: data =>
    http.post('meter/v1/sample/page_sample_input_his', data).then(res => res),
  pageSampleInStock: data =>
    http.post('meter/v1/sample/page_sample_in_stock', data).then(res => res),
  pageSampleInStockHis: data =>
    http
      .post('meter/v1/sample/page_sample_in_stock_his', data)
      .then(res => res),

  pageSampleOutStock: data =>
    http.post('meter/v1/sample/page_sample_out_stock', data).then(res => res),
  pageSampleOutStockHis: data =>
    http
      .post('meter/v1/sample/page_sample_out_stock_his', data)
      .then(res => res),

  pageCertificateMake: data =>
    http.post('meter/v1/sample/page_certificate_make', data).then(res => res),

  pageCertificateMakeHis: data =>
    http
      .post('meter/v1/sample/page_certificate_make_his', data)
      .then(res => res),

  pageCertificateCheck: data =>
    http.post('meter/v1/sample/page_certificate_check', data).then(res => res),
  pageCertificateCheckHis: data =>
    http
      .post('meter/v1/sample/page_certificate_check_his', data)
      .then(res => res),
  pageCertificateIssue: data =>
    http.post('meter/v1/sample/page_certificate_issue', data).then(res => res),
  pageCertificateIssueHis: data =>
    http
      .post('meter/v1/sample/page_certificate_issue_his', data)
      .then(res => res),
  pageCertificatePrint: data =>
    http.post('meter/v1/sample/page_certificate_print', data).then(res => res),
  pageCertificatePrinted: data =>
    http
      .post('meter/v1/sample/page_certificate_printed', data)
      .then(res => res),
  pageCertificateEnd: data =>
    http.post('meter/v1/sample/page_certificate_end', data).then(res => res),
  getById: data => http.get('meter/v1/sample/' + data).then(res => res),
  reportPreview: data =>
    http
      .post('meter/v1/sample/report_preview_login?id=' + data)
      .then(res => res),
  deleteById: data =>
    http.delete('meter/v1/sample/?ids=' + data).then(res => res),
  // 保存
  save: data =>
    https
      .post('meter/v1/sample/add_send_entrust', JSON.stringify(data))
      .then(res => res),
  addSample: data => http.post('meter/v1/sample/', data).then(res => res),
  chaseAddSample: data =>
    http.post('meter/v1/sample/chase_add_sample', data).then(res => res),
  saveSampleEnv: data =>
    http
      .put('meter/v1/sample/save_sample_env/' + data.ids, data.obj)
      .then(res => res),
  // 取消分包
  subpackageCancel: data =>
    http
      .post('meter/v1/sample/subpackage_cancel_sample?ids=' + data.ids)
      .then(res => res),
  subpackageSample: data =>
    http.post('meter/v1/sample/subpackage_sample?ids=' + data).then(res => res),

  submitReportToCheck: data =>
    http
      .post('meter/v1/sample/submit_report_to_check?ids=' + data)
      .then(res => res),
  submitReportToIssue: data =>
    http
      .post('meter/v1/sample/submit_report_to_issue?ids=' + data)
      .then(res => res),
  submitReportToEnd: data =>
    http
      .post('meter/v1/sample/submit_report_to_end?ids=' + data)
      .then(res => res),

  printEnd: data =>
    http.post('meter/v1/sample/print_end?ids=' + data).then(res => res),

  endReport: data =>
    http.post('meter/v1/sample/end_report?ids=' + data).then(res => res),
  submitFlow: data =>
    https
      .post('meter/v1/sample/sample_flow', JSON.stringify(data))
      .then(res => res),

  generateReport: data =>
    https
      .post('meter/v1/sample/report_generate', JSON.stringify(data))
      .then(res => res),
  generateExcelReport: data =>
    http
      .post(
        'meter/v1/sample/excel_report_generate?sampleId=' +
          data.sampleId +
          '&templateId=' +
          data.id
      )
      .then(res => res),
  subpackageInfoReg: data =>
    http
      .post('meter/v1/sample/subpackage_info_reg?ids=' + data.ids, data.reg)
      .then(res => res),

  subpackageOutStock: data =>
    http
      .post('meter/v1/sample/subpackage_out_stock?ids=' + data.ids, data.obj)
      .then(res => res),

  sampleInStock: data =>
    http
      .put('meter/v1/sample/sample_in_stock/' + data.ids, data.obj)
      .then(res => res),

  sampleOutStock: data =>
    http
      .put('meter/v1/sample/sample_out_stock/' + data.ids, data.obj)
      .then(res => res),

  subpackageInStock: data =>
    http
      .post('meter/v1/sample/subpackage_in_stock?ids=' + data.ids, data.obj)
      .then(res => res),

  submitReceive: data =>
    http.post('meter/v1/sample/submit_receive?ids=' + data).then(res => res),
  toReportCheck: data =>
    http.post('meter/v1/sample/to_report_check?ids=' + data).then(res => res),
  selectToReportCheck: data =>
    http
      .post(
        'meter/v1/sample/select_to_report_check?ids=' +
          data.ids +
          '&userId=' +
          data.userId +
          '&user=' +
          data.user
      )
      .then(res => res),

  toReportMake: data =>
    http.post('meter/v1/sample/to_report_make?ids=' + data).then(res => res),
  taskTransfer: data =>
    http
      .post(
        'meter/v1/sample/task_transfer?ids=' +
          data.ids +
          '&user=' +
          data.user +
          '&userId=' +
          data.userId
      )
      .then(res => res),

  distributeAgain: data =>
    http
      .post(
        'meter/v1/sample/distribute_again?ids=' +
          data.ids +
          '&user=' +
          data.user +
          '&userId=' +
          data.userId
      )
      .then(res => res),

  reportCheckBack: data =>
    http
      .post(
        'meter/v1/sample/report_check_back?ids=' +
          data.ids +
          '&reason=' +
          data.reason
      )
      .then(res => res),
  reportIssueBack: data =>
    http
      .post(
        'meter/v1/sample/report_issue_back?ids=' +
          data.ids +
          '&reason=' +
          data.reason
      )
      .then(res => res),

  certificateOk: data =>
    http
      .post(
        'meter/v1/sample/certificate_record?sampleId=' +
          data.sampleId +
          '&formId=' +
          data.formId
      )
      .then(res => res),

  certificateEdit: data =>
    http
      .post(
        'meter/v1/sample/certificate_record_edit?sampleId=' +
          data.sampleId +
          '&formId=' +
          data.formId
      )
      .then(res => res),

  distributeOutSample: data =>
    http
      .post(
        'meter/v1/sample/out_task_distribute?ids=' +
          data.ids +
          '&userId=' +
          data.userId +
          '&user=' +
          data.user
      )
      .then(res => res),

  sendTaskDistribute: data =>
    http
      .post(
        'meter/v1/sample/send_task_distribute?ids=' +
          data.ids +
          '&userId=' +
          data.userId +
          '&user=' +
          data.user
      )
      .then(res => res),

  pagePersonalTaskStatistics: data =>
    http
      .post('meter/v1/sample/page_personal_task_statistics', data)
      .then(res => res),
  pageAnnualEntrustStatistics: data =>
    http
      .post('meter/v1/sample/page_annual_entrust_statistics', data)
      .then(res => res),
  pageCustomerEntrustStatistics: data =>
    http
      .post('meter/v1/sample/page_customer_entrust_statistics', data)
      .then(res => res),
  pageCertificateRateStatistics: data =>
    http
      .post('meter/v1/sample/page_certificate_rate_statistics', data)
      .then(res => res),
  pageCertificateRateSample: data =>
    http
      .post('meter/v1/sample/page_certificate_rate_sample', data)
      .then(res => res),
  pageSampleQuantityStatistics: data =>
    http
      .post('meter/v1/sample/page_sample_quantity_statistics', data)
      .then(res => res),
  pageAnnualEntrustDetail: data =>
    http
      .post('meter/v1/entrust/page_annual_entrust_detail', data)
      .then(res => res),
  makeCode: data =>
    http
      .post(
        'meter/v1/sample/make_report_code?sampleId=' +
          data.sampleId +
          '&remark=' +
          data.remark
      )
      .then(res => res),
  getCertificateReport: data =>
    http.post('meter/v1/sample/get_certificate_report?sampleId=' + data),
  generatePdfAuto: data =>
    http.get('meter/v1/report/generate_pdf_auto?id=' + data),

  pageCertificate: data =>
    http.post('meter/v1/report/page', data).then(res => res),
  testingCount: data =>
    http.post('meter/v1/sample/testing_count', data).then(res => res),
  inspectionCount: data =>
    http.post('meter/v1/sample/inspection_count', data).then(res => res),
  makingCount: data =>
    http.post('meter/v1/sample/making_count', data).then(res => res),
  issueCount: data =>
    http.post('meter/v1/sample/issue_count', data).then(res => res)
}
