PerformanceDataQuaryAPI.js 2.01 KB
Newer Older
YazhouChen's avatar
YazhouChen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
import Axios from 'axios'

import {REQUEST_CONFIG, TOP_PERFORM_COUNT, PERFORMANCE_COUNT, PERFORMANCE_QUERY, PERFORMANCE_DOWNLOAD_CSV, PERFORMANCE_DOWNLOAD, HISTORY_DATA} from '../../utils/RequestUrls'

var staticMethods = {

  // 性能数据按条件查询:总条数
  putPerformanceCounts: function (selectList) {
    return Axios.put(PERFORMANCE_COUNT, selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : topn性能查询总数
   * @author       : ls
   * @date         : 2020/6/29 9:52
   * @param        :
   * @return       :
   */
  putTopNPerformanceCounts: function (num, selectList) {
    return Axios.put(TOP_PERFORM_COUNT + num, selectList, REQUEST_CONFIG)
  },

  // 性能数据按条件查询:分页性能
  putPerformanceQueryterms: function (beginItem, endItem, selectList) {
    return Axios.put(PERFORMANCE_QUERY + beginItem + '/' + endItem + '/', selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : top查询
   * @author       : ls
   * @date         : 2020/6/29 10:45
   * @param        :
   * @return       :
   */
  putPerformanceQuery: function (num, selectList) {
    return Axios.put(PERFORMANCE_QUERY + num, selectList, REQUEST_CONFIG)
  },
  // 导出excel
  putDownloadPerformance: function (selectList) {
    return Axios.put(PERFORMANCE_DOWNLOAD, selectList, {
      headers: {
        'Content-Type': 'application/json'
      },
      responseType: 'arraybuffer'
    })
  },
  putDownloadPerformanceCsv: function (selectList) {
    return Axios.put(PERFORMANCE_DOWNLOAD_CSV, selectList, {
      headers: {
        'Content-Type': 'application/json'
      },
      responseType: 'arraybuffer'
    })
  },
  putQueryPerformTaskData: function (val) {
    return Axios.put(HISTORY_DATA, val, REQUEST_CONFIG)
  }
}

function PerformanceDataQuaryAPI (websocketService = null) {
  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}
// inject static methods
Object.assign(PerformanceDataQuaryAPI, staticMethods)
export default PerformanceDataQuaryAPI