Browse Source

[UPDATE] fix flow status bug in *Screen

11868 1 year ago
parent
commit
bc8a61e7e3
3 changed files with 44 additions and 24 deletions
  1. 14 9
      src/views/historicTaskScreen.vue
  2. 15 13
      src/views/situationScreen.vue
  3. 15 2
      src/views/taskScreen.vue

+ 14 - 9
src/views/historicTaskScreen.vue

@@ -50,7 +50,7 @@
                               {{  item.subjectName ||'-'  }}
                             </div>
                             <div class="SubjectNumber_style" style="color: #F1D73A;">
-                              {{ Number(item.overallScore).toFixed(2) || '-' }}
+                              {{item.overallScore==null?'-':Number(item.overallScore).toFixed(2)}}
                             </div>
                             <div class="orgainzers">
                               参与人员:{{  item.participatingPeople && item.participatingPeople.join(',') || '-' }}
@@ -556,13 +556,13 @@ export default {
     }
   },
   methods:{
+    /**
+     * 保留两位小数
+     */
     formatScore(score) {
-      // score = Number(
-      // console.log("score1",score)
       if (isNaN(score)) {
         return score;
       }
-      // console.log("score3",score.toFixed(2))
       return Number(score).toFixed(2);
     },
     showMoreInfo(type){
@@ -1072,9 +1072,11 @@ export default {
             this.wholeOutTaskId=data[index].taskId
             this.currentTaskName= data[index].taskName
 
-            // this.currentTaskGrade= data[index].syntheticTaskScore
-            this.currentTaskGrade = Number(data[index].syntheticTaskScore).toFixed(2);
-            // this.currentTaskGrade = Number(this.currentTaskGrade).toFixed(2);
+            if(data[index].syntheticTaskScore==null){
+              this.currentTaskGrade = data[index].syntheticTaskScore
+            }else{
+              this.currentTaskGrade = Number(data[index].syntheticTaskScore).toFixed(2)
+            }
 
             if(data.length){
               // 获取任务的单位列表
@@ -1165,8 +1167,11 @@ export default {
       this.unitSubjectValue=''
       this.currentTaskName = this.taskOPtion.find( item => item.value== this.wholeOutTaskId ).label
 
-      this.currentTaskGrade = Number(this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore).toFixed(2);
-      // this.currentTaskGrade = Number(this.currentTaskGrade).toFixed(2);
+      if(this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore==null){
+        this.currentTaskGrade = this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore
+      }else{
+        this.currentTaskGrade = Number(this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore).toFixed(2)
+      }
 
       this.getUnitListByTaskId(this.wholeOutTaskId)
       // 获取任务的系统列表

+ 15 - 13
src/views/situationScreen.vue

@@ -113,8 +113,7 @@
                               </div>
                             </div>
                             <div class="grade_item">
-<!--                              {{  item.syntheticTaskScore }}-->
-                              {{ Number(item.syntheticTaskScore).toFixed(2) }}
+                              {{item.syntheticTaskScore==null?'-':Number(item.syntheticTaskScore).toFixed(2)}}
                             </div>
                           </div>
                           <div class="task_date_box">
@@ -193,8 +192,7 @@
                               {{  item.subjectName ||'-'  }}
                             </div>
                             <div class="SubjectNumber_style" style="color: #F1D73A;">
-<!--                              {{ item.overallScore || '-' }}-->
-                              {{  Number(item.overallScore).toFixed(2) || '-' }}
+                              {{item.overallScore==null?'-':Number(item.overallScore).toFixed(2)}}
                             </div>
                             <div class="orgainzers">
                               参与人员:{{  item.participatingPeople && item.participatingPeople.join(',') || '-' }}
@@ -770,7 +768,6 @@ export default {
       console.log("动态计算当前页的数据",this.gridData2)
       const start = (this.gridData2.currentPage - 1) * this.gridData2.pageSize
       const end = start + this.gridData2.pageSize
-      // if(this.gridData.data!=null){
       if(this.gridData2.data.length!=0){
         return this.gridData2.data.slice(start, end)
       }else{
@@ -779,13 +776,13 @@ export default {
     }
   },
   methods:{
+    /**
+     * 保留两位小数
+     */
     formatScore(score) {
-      // score = Number(
-      // console.log("score1",score)
       if (isNaN(score)) {
         return score;
       }
-      // console.log("score3",score.toFixed(2))
       return Number(score).toFixed(2);
     },
     /**
@@ -1285,9 +1282,11 @@ export default {
           this.wholeOutTaskId = data[0].taskId
           this.currentTaskName = data[0].taskName
 
-          // this.currentTaskGrade = 14.77777777
-          this.currentTaskGrade = Number(data[0].syntheticTaskScore).toFixed(2)
-          // this.currentTaskGrade = Number(this.currentTaskGrade).toFixed(2);
+          if(data[0].syntheticTaskScore==null){
+            this.currentTaskGrade = data[0].syntheticTaskScore
+          }else{
+            this.currentTaskGrade = Number(data[0].syntheticTaskScore).toFixed(2)
+          }
 
           // 获取地图的信息
           if (data.length) {
@@ -1380,8 +1379,11 @@ export default {
       this.unitSubjectValue=''
       this.currentTaskName = this.taskOPtion.find( item => item.value== this.wholeOutTaskId ).label
 
-      this.currentTaskGrade = Number(this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore).toFixed(2)
-      // this.currentTaskGrade = Number(this.currentTaskGrade).toFixed(2);
+      if(this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore==null){
+        this.currentTaskGrade = this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore
+      }else{
+        this.currentTaskGrade = Number(this.taskList.find( item=> item.taskId==this.wholeOutTaskId).syntheticTaskScore).toFixed(2)
+      }
 
       this.getUnitListByTaskId(this.wholeOutTaskId)
       // 获取任务的系统列表

+ 15 - 2
src/views/taskScreen.vue

@@ -266,7 +266,12 @@
                 <el-table :data="pagedData" :header-cell-style="changeHeaderCellStyle" :cell-style="changeCellStyle" stripe:border="true">
                   <el-table-column align="center" label="序号" header-align="center" type="index" width="55px" :index="getTableIndex" />
                   <el-table-column align="center" property="participantName" label="姓名" max-width="350"></el-table-column>
-                  <el-table-column align="center" property="score" label="成绩" max-width="300"></el-table-column>
+<!--                  <el-table-column align="center" property="score" label="成绩" max-width="300"></el-table-column>-->
+                  <el-table-column align="center" label="成绩" max-width="300">
+                    <template slot-scope="scope">
+                      {{ formatScore(parseFloat(scope.row.score)) }}
+                    </template>
+                  </el-table-column>
                   <el-table-column align="center" property="uploadTime" label="上报时间" max-width="300"></el-table-column>
                 </el-table>
                 <el-row type="flex" justify="end" style="margin-top: 10px;">
@@ -407,6 +412,15 @@ export default {
     }
   },
   methods:{
+    /**
+     * 保留两位小数
+     */
+    formatScore(score) {
+      if (isNaN(score)) {
+        return score;
+      }
+      return Number(score).toFixed(2);
+    },
     /**
      * 获取每一行的index信息
      * @param {Integer} index 表格在本页位置
@@ -650,7 +664,6 @@ export default {
       // console.log('获取任务的课目信息param taskId', params,taskId);
       const res = await request(`/dt_screen/rest/v2/subject/list/${taskId}`, 'get', params, false)
       const { errorCode, errorMessage, success,data } = res.data;
-      // console.log('获取任务的课目信息res', res);
       if (success) {
         // console.log('获取任务的课目信息', data);
         if(data.length !== 0){