From 4ca375b2e3dae98d6ececc1b7b421a12f3fa8a26 Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期二, 01 七月 2025 09:00:38 +0800
Subject: [PATCH] 修改bug,验收通过

---
 laboratory/src/views/deliveryAssessment/processEngineerEvaluate/index.vue |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/laboratory/src/views/deliveryAssessment/processEngineerEvaluate/index.vue b/laboratory/src/views/deliveryAssessment/processEngineerEvaluate/index.vue
index a01cc48..57727c0 100644
--- a/laboratory/src/views/deliveryAssessment/processEngineerEvaluate/index.vue
+++ b/laboratory/src/views/deliveryAssessment/processEngineerEvaluate/index.vue
@@ -58,7 +58,7 @@
           <template #default="{ row }">
             <el-button type="text" @click="handleDetail(row)">详情</el-button>
             <el-button
-              v-if="row.status === 2"
+              v-if="row.status === 2 && roleType!=3"
               type="text"
               @click="handleEvaluate(row)"
               >评定</el-button
@@ -80,6 +80,7 @@
 <script>
 import EvaluationDialog from "./components/evaluation-dialog.vue";
 import { evaluatePageList,evaluateProcess } from './service.js';
+import moment from "moment";
 
 export default {
   name: "ProcessEngineerEvaluate",
@@ -100,6 +101,7 @@
         pageSize: 10,
         pageNum: 1,
       },
+      roleType:'',
       total: 0,
       evaluationDialogVisible: false,
       currentEvaluationData: null,
@@ -107,6 +109,8 @@
   },
   created() {
     this.getList();
+    const  userInfo= JSON.parse(sessionStorage.getItem('userInfo'));
+    this.roleType=userInfo?.roleType;
   },
   methods: {
     handleCurrentChange(page) {
@@ -151,22 +155,32 @@
       this.evaluationDialogVisible = val;
       if (!val) this.currentEvaluationData = null;
     },
+    getEvaluateValue(score) {
+      // 2分 = 良好(1), 1分 = 正确(2), 0分 = 失误(3)
+      const scoreMap = {
+        2: 2, // 良好
+        1: 1, // 正确
+        0: 0, // 失误
+        '-3':'-3'
+      };
+      return scoreMap[score] || 0; // 默认返回失误
+    },
      // 处理评价提交
      handleEvaluationSubmit(evaluationData) {
       const { activeIndex } = evaluationData;
       // 将评分数据转换为后端需要的格式
       const evaluateData = {
         evaluateType: 1, // 1=工艺工程师
-        evaluateOne: this.getEvaluateValue(activeIndex[0].score),
-        evaluateTwo: this.getEvaluateValue(activeIndex[1].score),
-        evaluateThree: this.getEvaluateValue(activeIndex[2].score),
-        evaluateFour: this.getEvaluateValue(activeIndex[3].score),
-        evaluateFive: this.getEvaluateValue(activeIndex[4].score),
-        evaluateSix: this.getEvaluateValue(activeIndex[5].score),
+        evaluateOne:activeIndex[0].score? this.getEvaluateValue(activeIndex[0].score):0,
+        evaluateTwo:activeIndex[1].score? this.getEvaluateValue(activeIndex[1].score):0,
+        evaluateThree:activeIndex[2].score? this.getEvaluateValue(activeIndex[2].score):0,
+        evaluateFour:activeIndex[3].score? this.getEvaluateValue(activeIndex[3].score):0,
+        evaluateFive:activeIndex[4].score? this.getEvaluateValue(activeIndex[4].score):0,
+        evaluateSix:activeIndex[5].score? this.getEvaluateValue(activeIndex[5].score):0,
         evaluateTime: moment().format('YYYY-MM-DD HH:mm:ss'),
         resultEvaluateJson: JSON.stringify(activeIndex),
-        resultReportId: this.currentOperationRow.id,
-        dispatchId: this.currentOperationRow.dispatchId,
+        resultReportId: this.currentEvaluationData.id,
+        dispatchId: this.currentEvaluationData.dispatchId,
         status: 1
       };
       evaluateProcess(evaluateData).then(res => {

--
Gitblit v1.7.1