Forráskód Böngészése

Change stuff and realtime JS made

Guichuan Yu 6 éve
szülő
commit
40d4bf0d09
3 módosított fájl, 93 hozzáadás és 23 törlés
  1. 2 0
      dapingmu.html
  2. 54 21
      js/basic.js
  3. 37 2
      js/basic1.js

+ 2 - 0
dapingmu.html

@@ -249,6 +249,8 @@
 
     <!--<script src="js/demo.js"></script> -->
     <script src="js/basic1.js"></script>
+    <script src="js/getparam.js"></script>
+
     <script>
         var timeday=new Array("今日" ,"昨日" ,"本周" ,"本月");
         function getSpotHtml(htmlbody,  i) {

+ 54 - 21
js/basic.js

@@ -67,8 +67,9 @@ var badfailrate=[];
 var t=0;
 var n=0;
 var workID=[];
+var sectorID=[];
 function firsttime_load_spots_data() {
-    get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, first_success)
+    get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId , first_success)
 }
 function secondtime_load_spots_data() {
     get_data("fcBiFlowDaily/list?type=" + num +"&flowId="+flowId, second_success);
@@ -82,6 +83,11 @@ function chart1_load_spots_data() {
     get_data("fcBiWorkerDaily/get?type=4&limit=3", chart1_success);
 
 }
+function addtime_load_spots_data() {
+    num++;
+    get_data("fcBiFlowDaily/list?type=" + num +"&flowId="+flowId, add_success);
+
+}
 
 function first_success(obj, sta) {
     var output = first_parse(this, obj);
@@ -92,31 +98,31 @@ function first_success(obj, sta) {
     failnum=0;
     var x=0;
     var worksum=[];
-    workID[0]=output.list[0].userId;
+    sectorID[0]=output.list[0].sectorId;
     passNumber[0]=0;
     failNumber[0]=0;
     stackeverynum[0]=0;
     z=0;
     for(i=1;i<output.list.length;i++){
-        var thisUid = output.list[i].userId;
+        var thisUid = output.list[i].sectorId;
        x = 0;
-       for(j=0;j<workID.length;j++){
-           if(workID[j] === thisUid){
+       for(j=0;j<sectorID.length;j++){
+           if(sectorID[j] === thisUid){
                x=1;
                break;
            }
        }
        if(x===0){
-           workID.push(thisUid);
+           sectorID.push(thisUid);
        }
 
     }
     j=0;
-    for(k=0;k<workID.length;k++){
-        var uid = workID[k];
+    for(k=0;k<sectorID.length;k++){
+        var uid = sectorID[k];
         z=0;
         for(i=0;i<output.list.length;i++){
-            if(uid===output.list[i].userId){
+            if(uid===output.list[i].sectorId){
                 passNumber[k]=output.list[i].passNum+passNumber[j];
                 failNumber[k]=output.list[i].failNum+failNumber[j];
                 stackeverynum[k]=output.list[i].due+stackeverynum[j];
@@ -130,13 +136,13 @@ function first_success(obj, sta) {
             failrate[k] = failNumber[k] / (failNumber[k] + passNumber[k]) * 100;
 
         }
-        stackeverynum[k]=stackeverynum[k]/z;
+        /*stackeverynum[k]=stackeverynum[k]/z;*/
 
         ///
 
     }
-
-    for(i=1;i<5;i++) {
+    addtime_load_spots_data();
+    for(i=2;i<5;i++) {
         secondtime_load_spots_data();
     }
     chart_load_spots_data();
@@ -215,7 +221,34 @@ function chart1_success(obj, sta) {
 
 
 }
+function add_success(obj, sta) {
+    var history1 = first_parse(this, obj);
+    var i, j;
+    console.log(" history1 : ");
+    console.log(history1);
+    hispass[t] = 0;
+    hisfail[t] = 0;
+    hisstack[t] = 0;
+    hisrate[t]=0;
+    var lengthnum=history1.length-1;
+    for(i=lengthnum;i<history1.length;i++){
+
 
+        hispass[t] = history1[i].passNum+hispass[t];
+        hisfail[t] = history1[i].failNum+hisfail[t];
+        hisstack[t] = history1[i].avgDue+hisstack[t];
+        hisrate[t] = history1[i].failRate;
+        hisrate[t]=hisrate[t]/100;
+
+
+    }
+
+    if(hispass[t]+hisfail[t]==0){
+        hisrate[t]=0;
+    }
+    t++;
+
+}
 
 function realtime_success(obj, sta) {
     var output = first_parse(this, obj);
@@ -226,31 +259,31 @@ function realtime_success(obj, sta) {
     failnum=0;
     var x=0;
     var worksum=[];
-    workID[0]=output.list[0].userId;
+    sectorID[0]=output.list[0].sectorId;
     passNumber[0]=0;
     failNumber[0]=0;
     stackeverynum[0]=0;
     z=0;
     for(i=1;i<output.list.length;i++){
-        var thisUid = output.list[i].userId;
+        var thisUid = output.list[i].sectorId;
         x = 0;
-        for(j=0;j<workID.length;j++){
-            if(workID[j] === thisUid){
+        for(j=0;j<sectorID.length;j++){
+            if(sectorID[j] === thisUid){
                 x=1;
                 break;
             }
         }
         if(x===0){
-            workID.push(thisUid);
+            sectorID.push(thisUid);
         }
 
     }
     j=0;
-    for(k=0;k<workID.length;k++){
-        var uid = workID[k];
+    for(k=0;k<sectorID.length;k++){
+        var uid = sectorID[k];
         z=0;
         for(i=0;i<output.list.length;i++){
-            if(uid===output.list[i].userId){
+            if(uid===output.list[i].sectorId){
                 passNumber[k]=output.list[i].passNum+passNumber[j];
                 failNumber[k]=output.list[i].failNum+failNumber[j];
                 stackeverynum[k]=output.list[i].due+stackeverynum[j];
@@ -264,7 +297,7 @@ function realtime_success(obj, sta) {
             failrate[k] = failNumber[k] / (failNumber[k] + passNumber[k]) * 100;
 
         }
-        stackeverynum[k]=stackeverynum[k]/z;
+       /*stackeverynum[k]=stackeverynum[k]/z;*/
 
         ///
 

+ 37 - 2
js/basic1.js

@@ -38,7 +38,7 @@ function on_fail(msg) {
     console.log("----------------------------")
 }
 function secondtime_load_spots_data() {
-    get_data("fcBiFactoryDaily/list?type=" + num +"&flowId="+flowID, second_success);
+    get_data("fcBiFactoryDaily/list?type=" + num +"&flowId="+flowId, second_success);
     num++;
 }
 function chart_load_spots_data() {
@@ -49,6 +49,11 @@ function chart1_load_spots_data() {
     get_data("fcBiWorkerDaily/get?type=4&limit=3", chart1_success);
 
 }
+function addtime_load_spots_data() {
+    num++;
+    get_data("fcBiFlowDaily/list?type=" + num +"&flowId="+flowId, add_success);
+
+}
 function first_parse(ajax, obj) {
     if (typeof obj === "string") {
         obj = JSON.parse(obj);
@@ -97,7 +102,9 @@ function on_load_success_spots(obj, status) {
         }
 
     }
-    for(i=1;i<5;i++) {
+    addtime_load_spots_data();
+
+    for(i=2;i<5;i++) {
         secondtime_load_spots_data();
     }
     chart_load_spots_data();
@@ -110,6 +117,34 @@ function on_load_success_spots(obj, status) {
         get_data("fcWorkScheduleLoad/get" , realtime_success);
     },1000);
 }
+function add_success(obj, sta) {
+    var history1 = first_parse(this, obj);
+    var i, j;
+    console.log(" history1 : ");
+    console.log(history1);
+    hispass[t] = 0;
+    hisfail[t] = 0;
+    hisstack[t] = 0;
+    hisrate[t]=0;
+    var lengthnum=history1.length-1;
+    for(i=lengthnum;i<history1.length;i++){
+
+
+        hispass[t] = history1[i].passNum+hispass[t];
+        hisfail[t] = history1[i].failNum+hisfail[t];
+        hisstack[t] = history1[i].avgDue+hisstack[t];
+        hisrate[t] = history1[i].failRate;
+        hisrate[t]=hisrate[t]/100;
+
+
+    }
+
+    if(hispass[t]+hisfail[t]==0){
+        hisrate[t]=0;
+    }
+    t++;
+
+}
 
 function second_success(obj, sta) {
     var history = first_parse(this, obj);