From 5ad61d6ad3a0ce12c7fe0808527069b09a7c9c0d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 16 九月 2025 17:31:05 +0800
Subject: [PATCH] 新增基础产品

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

diff --git a/src/views/fysp/evaluation/EvalutationRecord.vue b/src/views/fysp/evaluation/EvalutationRecord.vue
index 00077c9..40735b6 100644
--- a/src/views/fysp/evaluation/EvalutationRecord.vue
+++ b/src/views/fysp/evaluation/EvalutationRecord.vue
@@ -23,7 +23,11 @@
         v-model:value="formSearch.scenetype"
       ></FYOptionScene>
       <!-- 鏃堕棿 -->
-      <FYOptionTime :initValue="false" type="month" v-model:value="formSearch.time"></FYOptionTime>
+      <FYOptionTime
+        :initValue="false"
+        type="month"
+        v-model:value="formSearch.time"
+      ></FYOptionTime>
     </template>
     <template #buttons>
       <!-- <el-button icon="Download" size="default" type="success" @click="download"
@@ -43,9 +47,20 @@
     </template>
 
     <template #table-column="{ size }">
-      <el-table-column fixed="left" sortable="custom" prop="sceneIndex" label="缂栧彿" width="80">
+      <el-table-column
+        fixed="left"
+        sortable="custom"
+        prop="sceneIndex"
+        label="缂栧彿"
+        width="80"
+      >
       </el-table-column>
-      <el-table-column prop="sceneName" :show-overflow-tooltip="true" label="鍚嶇О" width="300">
+      <el-table-column
+        prop="sceneName"
+        :show-overflow-tooltip="true"
+        label="鍚嶇О"
+        width="300"
+      >
       </el-table-column>
       <el-table-column
         prop="subTaskTime"
@@ -54,10 +69,21 @@
         sortable="custom"
         :formatter="timeFormat"
       />
-      <el-table-column prop="evaluation.resultscorebef" label="寰楀垎" width="90" sortable="custom" />
-      <el-table-column prop="evaluation.resultscorebef" label="鐜俊鐮�" width="100">
+      <el-table-column
+        prop="evaluation.resultscorebef"
+        label="寰楀垎"
+        width="90"
+        sortable="custom"
+      />
+      <el-table-column
+        prop="evaluation.resultscorebef"
+        label="鐜俊鐮�"
+        width="100"
+      >
         <template #default="{ row }">
-          <span :style="`color: ${toCode(row).color};`">{{ toCode(row).name }}</span>
+          <span :style="`color: ${toCode(row).color};`">{{
+            toCode(row).name
+          }}</span>
         </template>
       </el-table-column>
 
@@ -104,15 +130,26 @@
             @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"
+          <el-button
+            v-show="scoreShow"
+            size="small"
+            type="error"
+            @click="scoreShow = false"
             >鍙栨秷</el-button
           >
         </template>
         <template #default="{ row }">
-          <el-button type="primary" size="small" @click="editRow(row)">鏌ョ湅</el-button>
+          <el-button type="primary" size="small" @click="editRow(row)"
+            >鏌ョ湅</el-button
+          >
         </template>
       </el-table-column>
     </template>
@@ -130,12 +167,25 @@
 
 export default {
   setup() {
-    const { cellClick, cellClassName, handlePaste, setTableData, addRefreshEvent, tableData } =
-      useTablePaste({
-        score1: 8,
-        score2: 9
-      });
-    return { cellClick, cellClassName, handlePaste, setTableData, addRefreshEvent, tableData };
+    const {
+      cellClick,
+      cellClassName,
+      handlePaste,
+      setTableData,
+      addRefreshEvent,
+      tableData
+    } = useTablePaste({
+      score1: 8,
+      score2: 9
+    });
+    return {
+      cellClick,
+      cellClassName,
+      handlePaste,
+      setTableData,
+      addRefreshEvent,
+      tableData
+    };
   },
   components: { CompReport },
   data() {
@@ -161,7 +211,8 @@
           name: '鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�'
         }
       },
-      scoreShow: false
+      scoreShow: false,
+      updateLoading: false
     };
   },
   computed: {
@@ -208,9 +259,28 @@
         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 });
+            }
+          } else {
+            this.tableData = [];
+            this.orginData = [];
             if (typeof func === 'function') {
               func({ data: this.tableData });
             }
@@ -229,45 +299,55 @@
         if (res.data.length > 0) {
           this.evaluationRule = res.data[0];
           // 鑾峰彇鍏蜂綋瀛愯鍒�
-          return evaluateApi.getSubRules(this.evaluationRule.guid).then((res) => {
-            this.evaluationSubRule = res.data;
-            // 鏌ユ壘鍙鍏ュ緱鍒嗙殑瑙勫垯id
-            for (const key in this.ruleName) {
-              const value = this.ruleName[key];
-              const subrule = this.evaluationSubRule.find((v) => {
-                return v.itemname == value.name;
-              });
-              value.id = subrule.guid;
-            }
-          });
+          return evaluateApi
+            .getSubRules(this.evaluationRule.guid)
+            .then((res) => {
+              this.evaluationSubRule = res.data;
+              // 鏌ユ壘鍙鍏ュ緱鍒嗙殑瑙勫垯id
+              for (const key in this.ruleName) {
+                const value = this.ruleName[key];
+                const subrule = this.evaluationSubRule.find((v) => {
+                  return v.itemname == value.name;
+                });
+                if (subrule) {
+                  value.id = subrule.guid;
+                }
+              }
+            });
         }
       });
     },
     // 鎵归噺鏇存柊鐩戞祴鏁版嵁寰楀垎
     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