dedsudiyu 3 kuukautta sitten
vanhempi
commit
09fa530ced

+ 13 - 8
src/views/safetyOverview/pageComponent/troubleRankingComponents.vue

@@ -70,19 +70,24 @@ import {
           let tempNum = [];
           let num = 0;
           if (response.data[0]){
+            for(let i=0;i<response.data.length;i++){
+              response.data[i].maxNum = response.data[i].notRectifyNum+response.data[i].rectifyNum+response.data[i].tempNum;
+            }
+            let len = response.data.length;
+            for (let i = 0; i < len; i++) {
+              for (let j = 0; j < len - 1 - i; j++) {
+                if (response.data[j].maxNum < response.data[j + 1].maxNum) {
+                  [response.data[j], response.data[j + 1]] = [response.data[j + 1], response.data[j]];
+                }
+              }
+            }
             for(let i=0;i<response.data.length;i++){
               deptSortName.push(response.data[i].deptSortName)
               notRectifyNum.push(response.data[i].notRectifyNum)
               rectifyNum.push(response.data[i].rectifyNum)
               tempNum.push(response.data[i].tempNum)
-              if(response.data[i].notRectifyNum > num){
-                num = response.data[i].notRectifyNum;
-              }
-              if(response.data[i].rectifyNum > num){
-                num = response.data[i].rectifyNum;
-              }
-              if(response.data[i].tempNum > num){
-                num = response.data[i].tempNum;
+              if(response.data[i].maxNum > num){
+                num = response.data[i].maxNum;
               }
             }
           } else {