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
import { Base64 } from 'js-base64';
import { $fysp } from '../index';
 
export default {
  /**
   * 获取自动评估历史记录
   */
  fetchAutoEvaluation(param) {
    return $fysp.post(`evaluation/auto/record`, param).then((res) => res.data);
  },
 
  /**
   * 查询评估总规则
   * @param {Object} param
   * @returns
   */
  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);
      });
  },
};