import axios from 'axios';

function getOpenSourceReport(_ref) {
  var time = _ref.time,
    bgName = _ref.bgName,
    centerName = _ref.centerName,
    groupName = _ref.groupName;
  return new Promise(function (resolve, reject) {
    var params = {
      page: 1,
      page_size: 1000,
      method: 'getProjectDetailV2',
      sort_direction: 'asc',
      sort_column: 'code_specification_score',
      bg_name: bgName,
      center_name: centerName,
      data_date: "".concat(time)
    };
    if (groupName) {
      params.group_name = groupName;
    }
    axios({
      method: 'POST',
      url: '/eplus-data-report/api/query',
      data: {
        jsonrpc: '2.0',
        method: 'noop',
        params: params
      }
    }).then(function (res) {
      var arr = res.data.result.data.data || [];
      resolve(arr);
    })["catch"](function (err) {
      console.log('[getOpenSourceReport] err: ', err);
      reject(err);
    });
  });
}

export { getOpenSourceReport };
