src/api/fysp/evaluateApi.js
@@ -1,3 +1,4 @@
import { Base64 } from 'js-base64';
import { $fysp } from '../index';
export default {
@@ -15,5 +16,26 @@
   */
  fetchEvaluationRule(param) {
    return $fysp.post(`evaluationrule/find`, param).then((res) => res.data);
  }
  },
  autoEvaluate(param) {
    return $fysp.post(`evaluation/auto`, param).then((res) => res.data);
  },
  downloadAutoEvaluation(param) {
    return $fysp
      .post(`evaluation/auto/record/download`, param, { responseType: 'blob' })
      .then((res) => {
        // return res.data;
        const name = Base64.decode(res.headers.get('filename'));
        const url = window.URL.createObjectURL(res.data);
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', name);
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        window.URL.revokeObjectURL(url);
      });
  },
};