Jason(Fruit Of Eden) %!s(int64=6) %!d(string=hai) anos
pai
achega
06b5768f53
Modificáronse 1 ficheiros con 41 adicións e 14 borrados
  1. 41 14
      js/lazhang-data.js

+ 41 - 14
js/lazhang-data.js

@@ -86,7 +86,7 @@ function first_success(obj, sta) {
 
     }
 
-    for (i = 1; i < 5; i++) {
+    for (i = 1; i <= 3; i++) {
         load_flows_history_data(i);
     }
 
@@ -102,12 +102,17 @@ function first_success(obj, sta) {
 
 function request_data_realtime() {
     get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, realtime_success);
+    load_flows_history_realtime_data();
 }
 
 function load_flows_history_data(nnm) {
     get_data("fcBiFlowDaily/list?type=" + nnm + "&flowId=" + flowId, history_success);
 }
 
+function load_flows_history_realtime_data() {
+    get_data("fcBiFlowDaily/list?type=1&flowId=" + flowId, history_success);
+}
+
 function load_table_red_rank() {
     get_data("fcBiWorkerDaily/get?type=0&limit=3", on_red_rank_success);
 }
@@ -139,22 +144,44 @@ function history_success(obj, sta) {
     }else{
         t = 0;
     }
-    hispass[t] = 0;
-    hisfail[t] = 0;
-    hisstack[t] = 0;
-    hisrate[t] = 0;
-    for (i = 0; i < history.length; i++) {
-        hispass[t] = history[i].passNum + hispass[t];
-        hisfail[t] = history[i].failNum + hisfail[t];
-        hisstack[t] = history[i].avgDue + hisstack[t];
-    }
-    if (history.length != 1) {
-        if (hispass[t] + hisfail[t] == 0) {
-            hisrate[t] = 0;
+
+    if(t == 2 || t == 3) {
+        hispass[t] = 0;
+        hisfail[t] = 0;
+        hisstack[t] = 0;
+        hisrate[t] = 0;
+        for (i = 0; i < history.length; i++) {
+            hispass[t] = history[i].passNum + hispass[t];
+            hisfail[t] = history[i].failNum + hisfail[t];
+            hisstack[t] = history[i].avgDue + hisstack[t];
+        }
+        if (history.length != 1) {
+            if (hispass[t] + hisfail[t] == 0) {
+                hisrate[t] = 0;
+            } else {
+                hisrate[t] = Math.floor(hisfail[t] / (hispass[t] + hisfail[t]) * 10000) / 100;
+            }
+        }
+    }else if(t == 1){
+        hispass[1] = history[0].passNum;
+        hisfail[1] = history[0].failNum;
+        hisstack[1] = history[0].avgDue;
+        if (hispass[1] + hisfail[1] == 0) {
+            hisrate[1] = 0;
         } else {
-            hisrate[t] = Math.floor(hisfail[t] / (hispass[t] + hisfail[t]) * 10000) / 100;
+            hisrate[1] = Math.floor(hisfail[1] / (hispass[1] + hisfail[1]) * 10000) / 100;
         }
     }
+
+    hispass[0] = history[history.length - 1].passNum;
+    hisfail[0] = history[history.length - 1].failNum;
+    hisstack[0] = history[history.length - 1].avgDue;
+    if (hispass[0] + hisfail[0] == 0) {
+        hisrate[0] = 0;
+    } else {
+        hisrate[0] = Math.floor(hisfail[0] / (hispass[0] + hisfail[0]) * 10000) / 100;
+    }
+
 }
 
 function on_red_rank_success(obj, sta) {