import axios from '@/common/services/axios-instance'

class WorkbenchService {
  // 异常统计列表
  getExpection(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-abnormal`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程数量统计
  getFlowStatistics(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-count`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程时效统计
  getFlowSignStatistics(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-aging`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程会签时效统计
  getFlowAgtinStatistics(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-sign`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程异常导出接口信息
  exportAbnormalExcel(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-abnormal/export`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程数导出接口
  exportFlowCountExcel(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-count/export`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程会签导出接口
  exportFlowSignExcel(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-sign/export`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 流程时效导出接口
  exportFlowAgingExcel(params) {
    return axios({
      url: `api/framework/v1/workflow-statistics/flow-aging/export`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 导出excel文件接口
  exportExcel(params) {
    return axios({
      url: 'api/framework/v1/file-download/download/',
      method: 'get',
      responseType: 'blob',
      params,
    }).then((res) => {
      return res.data
    })
  }

  // 取得表单数量
  getTotalCount(params) {
    return axios({
      url: 'api/framework/v1/workflow-statistics/total-count',
      method: 'get',
      params: params,
    }).then((res) => {
      return res.data
    })
  }
}

export default new WorkbenchService()
