Explorar el Código

还原工分排名

ouyj hace 4 meses
padre
commit
a53382c46b
Se han modificado 1 ficheros con 30 adiciones y 33 borrados
  1. 30 33
      ygtx-ui/src/views/index5.vue

+ 30 - 33
ygtx-ui/src/views/index5.vue

@@ -129,7 +129,7 @@
                   <div class="ranking-section">
                     <!-- 第一行:东山风电场 -->
                     <div class="ranking-row" @click="showRankingList('dept')">{{ homePageData.deptName }}</div>
-                    
+
                     <!-- 第二行:3/15 和 第3名 -->
                     <div class="ranking-row" @click="showRankingList('dept')">
                       <div class="ranking-item">
@@ -137,22 +137,22 @@
                           <span class="circle-text blue-bold">{{ homePageData.deptSort+'/'+homePageData.scoreDept.length }}</span>
                         </div>
                         <span class="black-bold" style="margin-right: 5px;">第{{ homePageData.deptSort }}名</span>
-                        <i 
-                          v-if="homePageData.deptSort < 4" 
-                          class="fa fa-trophy" 
+                        <i
+                          v-if="homePageData.deptSort < 4"
+                          class="fa fa-trophy"
                           :style="{ color: homePageData.deptSort === 1 ? '#FFD700' : homePageData.deptSort === 2 ? '#C0C0C0' : '#CD7F32' , 'font-size': '20px'} "
                         ></i>
                       </div>
                     </div>
                   </div>
                 </div>
-                
+
                 <!-- 中心排名 -->
                 <div class="ranking-info horizontal-ranking">
                   <div class="ranking-section">
                     <!-- 第三行:陆上设备维保中心 -->
                     <div class="ranking-row" @click="showRankingList('center')">{{ homePageData.center }}</div>
-                    
+
                     <!-- 第四行:12/86 和 第12名 -->
                     <div class="ranking-row" @click="showRankingList('center')">
                       <div class="ranking-item">
@@ -160,22 +160,22 @@
                           <span class="circle-text blue-bold">{{ homePageData.centerSort+'/'+homePageData.scoreCenter.length }}</span>
                         </div>
                         <span class="black-bold" style="margin-right: 5px;">第{{ homePageData.centerSort }}名</span>
-                        <i 
-                          v-if="homePageData.centerSort < 4" 
-                          class="fa fa-trophy" 
+                        <i
+                          v-if="homePageData.centerSort < 4"
+                          class="fa fa-trophy"
                           :style="{ color: homePageData.centerSort === 1 ? '#FFD700' : homePageData.centerSort === 2 ? '#C0C0C0' : '#CD7F32' , 'font-size': '20px'}"
                         ></i>
                       </div>
                     </div>
                   </div>
                 </div>
-                
+
                 <!-- 公司排名 -->
                 <div class="ranking-info horizontal-ranking">
                   <div class="ranking-section">
                     <!-- 第五行:公司 -->
                     <div class="ranking-row" @click="showRankingList('company')">{{ homePageData.companyName }}</div>
-                    
+
                     <!-- 第六行:45/320 和 第45名 -->
                     <div class="ranking-row" @click="showRankingList('company')">
                       <div class="ranking-item">
@@ -183,9 +183,9 @@
                           <span class="circle-text blue-bold">{{ homePageData.companySort+'/'+homePageData.scoreCompany.length }}</span>
                         </div>
                         <span class="black-bold" style="margin-right: 5px;">第{{ homePageData.companySort }}名</span>
-                        <i 
-                          v-if="homePageData.companySort < 4" 
-                          class="fa fa-trophy" 
+                        <i
+                          v-if="homePageData.companySort < 4"
+                          class="fa fa-trophy"
                           :style="{ color: homePageData.companySort === 1 ? '#FFD700' : homePageData.companySort === 2 ? '#C0C0C0' : '#CD7F32' , 'font-size': '20px'}"
                         ></i>
                       </div>
@@ -195,8 +195,8 @@
               </div>
             </div>
           </el-card>
-        </div>        
-        
+        </div>
+
       </div>      <!-- 第三行:工单数据列表 -->
       <div class="list-row">
         <el-card class="list-card floating-card">
@@ -318,7 +318,7 @@ export default {
   created() {
     this.loadHomePageData(); // 首次加载首页统计数据
     this.applyFilter();
-    
+
     // 设置定时器,每3秒执行一次loadHomePageData函数
     this.timer = setInterval(() => {
       this.loadHomePageData();
@@ -343,7 +343,7 @@ export default {
         // 否则显示对应类型的排名列表
         this.currentRankingType = type;
         this.showRankingTable = true;
-        
+
         // 根据类型设置数据并按finalScore排序实现RANK模式
         let rankingData = [];
         if (type === 'dept') {
@@ -353,31 +353,28 @@ export default {
         } else if (type === 'company') {
           rankingData = [...this.homePageData.scoreCompany];
         }
-        
+
         // 按finalScore降序排序
         rankingData.sort((a, b) => (b.finalScore || 0) - (a.finalScore || 0));
-        
+
         // 实现RANK模式排名
         const rankedData = [];
-        let currentRank = 1;
         rankingData.forEach((item, index) => {
           // 计算RANK排名
-          /*let rank = index + 1;
+          let rank = index + 1;
           // 如果当前项的finalScore与前一项相同,则排名也相同
           if (index > 0 && item.finalScore === rankingData[index - 1].finalScore) {
             rank = rankedData[index - 1].rank;
-          }*/
-          if (index > 0 && item.finalScore !== rankingData[index - 1].finalScore) {
-            currentRank = currentRank + 1;
           }
+
           rankedData.push({
-            rank: currentRank,
+            rank: rank,
             name: item.nickName,
             station: item.deptName,
             finalScore: item.finalScore || 0
           });
         });
-        
+
         this.currentRankingData = rankedData;
       }
     },
@@ -441,7 +438,7 @@ export default {
           }
         }
       });
-      
+
       // 获取我的待办数量
       listMyTodo({ pageNum: 1, pageSize: 1 }).then(response => {
         if (response.code === 200) {
@@ -466,7 +463,7 @@ export default {
           if (response && response.msg) {
             timeoutValue = parseInt(response.msg) || 30;
           }
-          
+
           // 加密参数并传递到目标路由页面
           const params = {
             timeOutNum: timeoutValue,
@@ -1073,20 +1070,20 @@ export default {
     flex-direction: column;
     align-items: flex-start;
   }
-  
+
   .top-aligned .card-header {
     align-self: stretch;
   }
-  
+
   .top-aligned .card-content {
     align-self: stretch;
     justify-content: flex-start;
   }
-  
+
   .top-aligned .data-description {
     align-self: stretch;
   }
-  
+
   /* 新增的排名列表卡片样式 */
   .ranking-table-card {
     width: 100%;