Przeglądaj źródła

培训看板修改文字描述

cyy 1 rok temu
rodzic
commit
df935f6d5f

+ 17 - 2
src/views/business/trainManagement/components/jobPlanChart.vue

@@ -211,8 +211,23 @@
        option && jobPie.setOption(option)
       },
       calculatedPercentage(up, down){
-        // console.log((up*100/down).toFixed(2),(up/down).toFixed(2)*100,'(up/down).toFixed(2)')
-        return (up*100/down).toFixed(2)
+        console.log(typeof (up*100/down),'(up/down).toFixed(2)')
+        if(down !== 0){
+          let a = (up*100/down).toFixed(2)
+
+          if(this.isInfinit(a)){
+            return '0.00'
+          }else{
+            return a
+          }
+          
+        }else{
+          return '0.00'
+        }
+        
+      },
+      isInfinit(num) {
+        return isNaN(num) || Math.abs(num) === Infinity;
       }
     }
   }

+ 2 - 2
src/views/business/trainManagement/components/trainingStaffChart.vue

@@ -120,7 +120,7 @@
                 }else if(item.seriesName === 'numReal'){
                   nameNum = '实际参训人数'
                 }else if(item.seriesName === 'numAll'){
-                  nameNum = '培训人数'
+                  nameNum = '培训人数'
                 }
                 str += `<br /> ${item.marker} ${nameNum}  ${item.data}`
               })
@@ -140,7 +140,7 @@
               }else if(name === 'numReal'){
                 return '实际参训人数';
               }else if(name === 'numAll'){
-                return '培训人数';
+                return '培训人数';
               }
             }
           },