From c18772a3b843e3ca5af5e58d6570860ce1a4aa8f Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期六, 28 九月 2024 22:24:20 +0800
Subject: [PATCH] 1. 修改监测数据得分批量导入功能

---
 src/api/fysp/evaluateApi.js |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 107 insertions(+), 1 deletions(-)

diff --git a/src/api/fysp/evaluateApi.js b/src/api/fysp/evaluateApi.js
index 6e752a6..4ab4a94 100644
--- a/src/api/fysp/evaluateApi.js
+++ b/src/api/fysp/evaluateApi.js
@@ -1,3 +1,4 @@
+import { Base64 } from 'js-base64';
 import { $fysp } from '../index';
 
 export default {
@@ -6,5 +7,110 @@
    */
   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) => {
+        // 鏂囨。鏈敓鎴愶紝宸插惎鍔ㄦ枃妗g敓鎴愬悗鍙颁换鍔�
+        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);
+  },
+  /** 鏍规嵁鐖惰妭鐐筰d鑾峰彇瀛愯鍒� */
+  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);
+  },
 };

--
Gitblit v1.9.3