From b0379edfce842cf521edd555269412f8cd0ec11b Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期日, 29 九月 2024 17:33:09 +0800
Subject: [PATCH] 1. 评估记录批量修改监测数据得分

---
 src/views/fysp/evaluation/EvalutationRecord.vue |   43 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/src/views/fysp/evaluation/EvalutationRecord.vue b/src/views/fysp/evaluation/EvalutationRecord.vue
index 00077c9..ad93e21 100644
--- a/src/views/fysp/evaluation/EvalutationRecord.vue
+++ b/src/views/fysp/evaluation/EvalutationRecord.vue
@@ -104,7 +104,12 @@
             @click="scoreShow = true"
             >鐩戞祴鏁版嵁寰楀垎</el-button
           >
-          <el-button v-show="scoreShow" size="small" type="primary" @click="updateMultipleScore"
+          <el-button
+            v-show="scoreShow"
+            size="small"
+            type="primary"
+            @click="updateMultipleScore"
+            :loading="updateLoading"
             >涓婁紶</el-button
           >
           <el-button v-show="scoreShow" size="small" type="error" @click="scoreShow = false"
@@ -161,7 +166,8 @@
           name: '鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�'
         }
       },
-      scoreShow: false
+      scoreShow: false,
+      updateLoading: false
     };
   },
   computed: {
@@ -208,8 +214,21 @@
         evaluateApi.fetchAutoEvaluation(this.area).then((res) => {
           if (res.data) {
             this.tableData = res.data;
+            this.tableData.forEach((v) => {
+              // 灏嗗師濮嬬殑寰楀垎灞曠ず鍒拌〃鏍间腑
+              if (v.itemEvaluations) {
+                for (const key in this.ruleName) {
+                  const value = this.ruleName[key];
+                  const itemEva = v.itemEvaluations.find((ie) => {
+                    return ie.esrguid == value.id && ie.extension1 == 'true';
+                  });
+                  if (itemEva) {
+                    v[key] = itemEva.value;
+                  }
+                }
+              }
+            });
             this.orginData = useCloned(this.tableData).cloned;
-            console.log(this.orginData);
             this.getFilters(res.data);
             if (typeof func === 'function') {
               func({ data: this.tableData });
@@ -245,29 +264,35 @@
     },
     // 鎵归噺鏇存柊鐩戞祴鏁版嵁寰楀垎
     updateMultipleScore() {
+      this.updateLoading = true;
       useMessageBoxTip({
         confirmMsg: '鏄惁涓婁紶鐩戞祴鏁版嵁寰楀垎',
         confirmTitle: '涓婁紶鐩戞祴鏁版嵁寰楀垎',
-        onConfirm: () => {
+        onConfirm: async () => {
           if (this.evaluationRule) {
-            const param = this.tableData.map((v) => {
+            const subTaskEvaList = this.tableData.map((v) => {
               const subRule = [];
               for (const key in this.ruleName) {
                 const value = this.ruleName[key];
                 subRule.push({
-                  first: value.id,
-                  second: v[key].trim() != ''
+                  id: value.id,
+                  selected: v[key] && (v[key] + '').trim() != ''
                 });
               }
               return {
-                ...this.area,
                 subTaskId: v.subTaskId,
                 ruleId: this.evaluationRule.guid,
                 subRule
               };
             });
+            const param = {
+              ...this.area,
+              subTaskEvaList
+            };
 
-            evaluateApi.updateMultipleScore(param);
+            return await evaluateApi
+              .updateMultipleScore(param)
+              .finally(() => (this.updateLoading = false));
           }
         }
       });

--
Gitblit v1.9.3