riku
2025-09-17 4aa86b1ec441c4e358e1cc488d8f021fb80f1355
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { Base64 } from 'js-base64';
import { $fysp } from '../index';
 
export default {
  /**
   * 获取自动评估历史记录
   */
  fetchAutoEvaluation(param) {
    return $fysp.post(`evaluation/auto/record`, param).then((res) => res.data);
  },
 
  /**
   * 根据巡查任务获取评分细则
   */
  fetchItemEvaluation(subTaskId) {
    const params = `?subTaskId=${subTaskId}`;
    return $fysp.get(`evaluationsubrule/score${params}`).then((res) => res.data);    
  },
 
 
  /**
   * 批量更新评分细则得分
   */
  updateItemEvaluation(param) {
    return $fysp.post(`itemevaluation/uplist`, 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, forceUpdate) {
    return $fysp
      .post(`evaluation/auto/record/download?forceUpdate=${forceUpdate}`, param, { responseType: 'blob' })
      .then((res) => {
        // 文档未生成,已启动文档生成后台任务
        if (res.data.type == 'application/json') {
          return false
        } 
        // 文档已存在,直接下载
        else {
          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);
        }
      });
  },
 
  /** 
   * 批量修改最小项得分
   */
  updateMultipleScore(evaVo) {
    return $fysp.post(`itemevaluation/update/multiple`, evaVo).then((res) => res.data);
  },
  /** 
   * 修改最小项得分
   */
  updateScore({itemList, subTaskId}) {
    const param = `?subTaskId=${subTaskId}`
    return $fysp.post(`itemevaluation/update${param}`, itemList).then((res) => res.data);
  },
  /** 
   * 获得所有规则父节点
   */
  getAllParentRules() {
    return $fysp.get("evaluationrule").then((res) => res.data);
  },
  /** 根据父节点id获取子规则 */
  getSubRules(id) {
    const param = `?id=${id}`
    return $fysp.get(`evaluationsubrule/byRule${param}`).then((res) => res.data);
  },
  /** 
   * 更新父节点规则
   */
  updateParentRule(data) {
    return $fysp.post("evaluationrule", data).then((res) => res.data);
  },
  /** 
   * 删除父节点规则
   */
  deleteParentRuleById(id) {
    return $fysp.delete(`evaluationrule/${id}`).then((res) => res.data);
  },
 
  /** 
   * 更新子节点规则
   */
  updateSubRule(data) {
    return $fysp.post("evaluationsubrule", data).then((res) => res.data);
  },
  /** 
   * 删除子节点规则
   */
  deleteSubRuleById(id) {
    return $fysp.delete(`evaluationsubrule/${id}`).then((res) => res.data);
  },
};