Jason(Fruit Of Eden) 6 years ago
parent
commit
83427a9c51
3 changed files with 30 additions and 13 deletions
  1. 3 3
      js/basic.js
  2. 25 6
      js/lazhang-data.js
  3. 2 4
      lazhang.html

+ 3 - 3
js/basic.js

@@ -1,4 +1,4 @@
-let Queue = {IS_LOADED : false, nowuse : 0, SVR_URL:"/server/", groupsCount : 0, groups:[], shouldStop : false, backup:["/server/","http://localhost:8803/server/","http://172.30.84.3:8803/server/","https://1.niimei.com/server/"] ,list:[]};
+let Queue = {IS_LOADED : false, nowuse : 0, SVR_URL:"/server/", groupsCount : 0, groups:[], shouldStop : false, backup:["http://localhost:8803/server/","/server/","http://172.30.84.3:8803/server/","https://1.niimei.com/server/"] ,list:[]};
 let Users = {list : []};
 function get_server_url() {
     let output = $.ajax({url: Queue.SVR_URL + "/fcWorker/list?userId=1", timeout:1000 }).fail(on_check_fail).done(function(){
@@ -201,13 +201,13 @@ function send_alert(a, b){
 
 function getUserName(uid){
     var uname = null;
-    Users.list.forEach(function(val, id, arr){
+    Users.list.forEach(function(val, aid, arr){
        if(val.worker.userId == uid){
            uname = worker.userName;
        }
     });
     if(uname == null) {
-        get_data("fcWorker/list?userId=" + id, on_username_retn);
+        get_data("fcWorker/list?userId=" + uid, on_username_retn);
         return "[用户:"+uid+"]";
     }else{
         return uname;

+ 25 - 6
js/lazhang-data.js

@@ -89,11 +89,6 @@ function first_success(obj, sta) {
     for (i = 1; i <= 3; i++) {
         load_flows_history_data(i);
     }
-
-    load_table_red_rank();
-    load_table_black_rank();
-
-
     showChart();
 
     lazhang.timer = setInterval(request_data_realtime, 1000);
@@ -102,7 +97,9 @@ function first_success(obj, sta) {
 
 function request_data_realtime() {
     get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, realtime_success);
-    load_flows_history_realtime_data();
+    //load_flows_history_realtime_data();
+    load_table_red_rank();
+    load_table_black_rank();
 }
 
 function load_flows_history_data(nnm) {
@@ -295,4 +292,26 @@ function realtime_success(obj, sta) {
     }
     updateChart();
 
+    var hhp = 0, hhf = 0, hhs = 0;
+    output.list.forEach(function (val,fid,arr){
+        hhp += val.passNum;
+        hhf += val.failNum;
+        hhs += val.due;
+    })
+
+    hispass[0] = hhp;
+    hisfail[0] = hhf;
+
+    if(output.list.length > 0) {
+        hisstack[0] = hhs / output.list.length;
+    }else{
+        hisstack[0] = 0;
+    }
+
+    if (hispass[0] + hisfail[0] == 0) {
+        hisrate[0] = 0;
+    } else {
+        hisrate[0] = Math.floor(hisfail[0] / (hispass[0] + hisfail[0]) * 10000) / 100;
+    }
+
 }

+ 2 - 4
lazhang.html

@@ -123,13 +123,12 @@
                     <table class="table table-bordered text-center table-striped">
                         <thead>
                         <tr>
-                            <th scope="col" colspan="4">红榜</th>
+                            <th scope="col" colspan="3">红榜</th>
 
                         </tr>
                         <tr>
                             <th>人员</th>
                             <th>良品数</th>
-                            <th>人员</th>
                             <th>不良率</th>
                         </tr>
                         </thead>
@@ -141,12 +140,11 @@
                     <table class="table table-bordered text-center table-striped">
                         <thead>
                         <tr>
-                            <th scope="col" colspan="4">黑榜</th>
+                            <th scope="col" colspan="3">黑榜</th>
                         </tr>
                         <tr>
                             <th>人员</th>
                             <th>良品数</th>
-                            <th>人员</th>
                             <th>不良率</th>
                         </tr>
                         </thead>