|  | @@ -53,7 +53,7 @@ var DataObjectList = function(name){
 | 
	
		
			
				|  |  |          quickSort(this.preSort, 0, this.preSort.length - 1, function(l, r){});
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    function clearData() {
 | 
	
		
			
				|  |  | +    this.clearData = function () {
 | 
	
		
			
				|  |  |          this.isSorted = false;
 | 
	
		
			
				|  |  |          this.preSort = null;
 | 
	
		
			
				|  |  |          this.list = null;
 | 
	
	
		
			
				|  | @@ -132,27 +132,28 @@ var DataObjectService = function(controlName, syncType, extparm){
 | 
	
		
			
				|  |  |      this.list       = new DataObjectList(controlName);
 | 
	
		
			
				|  |  |      this.autoUpdateTimer = 0;
 | 
	
		
			
				|  |  |      this.autoInterval = 1000;
 | 
	
		
			
				|  |  | +    this.callerThis = this;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    function setUpInterval() {
 | 
	
		
			
				|  |  | +    this.setUpInterval = function() {
 | 
	
		
			
				|  |  |          //URL + exparm
 | 
	
		
			
				|  |  |          if(this.autoUpdateTimer != 0) clearInterval(this.autoUpdateTimer);
 | 
	
		
			
				|  |  | -        this.autoUpdateTimer = setInterval(this.selfUpdateTick, this.autoInterval);
 | 
	
		
			
				|  |  | -        setTimeout(this.selfUpdateTick, 100);
 | 
	
		
			
				|  |  | +        this.autoUpdateTimer = setInterval(this.selfUpdateTick, this.autoInterval, this);
 | 
	
		
			
				|  |  | +        setTimeout(this.selfUpdateTick, 1000, this);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.init = function(){
 | 
	
		
			
				|  |  | -        this.appUrl = "/server/"+ controlName + "/list" + extparm;
 | 
	
		
			
				|  |  | +        this.appUrl = controlName + "/list" + extparm;
 | 
	
		
			
				|  |  |          if(!this.isFast || this.isOnDemand){
 | 
	
		
			
				|  |  | -            this.autoInterval = 30000;
 | 
	
		
			
				|  |  | +            this.autoInterval = 300;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if(this.isFast) {
 | 
	
		
			
				|  |  | -            this.appUrl = "/server/"+ controlName + "/get" + extparm;
 | 
	
		
			
				|  |  | +            this.appUrl = controlName + "/get" + extparm;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if(this.isAuto){
 | 
	
		
			
				|  |  |              // timer
 | 
	
		
			
				|  |  | -            setUpInterval();
 | 
	
		
			
				|  |  | +            this.setUpInterval();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -161,35 +162,40 @@ var DataObjectService = function(controlName, syncType, extparm){
 | 
	
		
			
				|  |  |          this.autoUpdateTimer = 0;
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    this.selfUpdateTick = function(){
 | 
	
		
			
				|  |  | -        get_data(this.appUrl, this.onDataReceived);
 | 
	
		
			
				|  |  | +    /***
 | 
	
		
			
				|  |  | +     * Automatica Update Tick, where obj is a replacement for "this" where "this" might be incorrect
 | 
	
		
			
				|  |  | +     * @param obj : DataObjectService
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    this.selfUpdateTick = function(obj){
 | 
	
		
			
				|  |  | +        get_data(obj.appUrl, obj.onDataReceived, obj);
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    this.onDemandUpdate = function(){
 | 
	
		
			
				|  |  | -        get_data(this.appUrl, this.onDataReceived);
 | 
	
		
			
				|  |  | +    this.onDemandUpdate = function(obj){
 | 
	
		
			
				|  |  | +        get_data(obj.appUrl, obj.onDataReceived, obj);
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.onDataReceived = function(data, sta){
 | 
	
		
			
				|  |  | -        let output = first_parse(this, obj);
 | 
	
		
			
				|  |  | +        let obj = this.callerThis;
 | 
	
		
			
				|  |  | +        if(obj == undefined){console.error("Cannot get callerThis in onDataReceived, please check"); console.error(this)}
 | 
	
		
			
				|  |  | +        let output = first_parse(this, data);
 | 
	
		
			
				|  |  |          if (output.list == undefined || output.list.length == 0) {
 | 
	
		
			
				|  |  | -            this.failedCount++;
 | 
	
		
			
				|  |  | -            if(this.failedCount > 100){
 | 
	
		
			
				|  |  | -                this.failedCount = 0;
 | 
	
		
			
				|  |  | -                this.stopTimers();
 | 
	
		
			
				|  |  | -                console.log("【错误次数过多");
 | 
	
		
			
				|  |  | -                setTimeout(this.setUpInterval, 10000);
 | 
	
		
			
				|  |  | +            obj.failedCount++;
 | 
	
		
			
				|  |  | +            if(obj.failedCount > 100){
 | 
	
		
			
				|  |  | +                obj.failedCount = 0;
 | 
	
		
			
				|  |  | +                obj.stopTimers();
 | 
	
		
			
				|  |  | +                console.log("【错误次数过多】,暂停");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if(this.failedCount == 2) {
 | 
	
		
			
				|  |  | +            if(obj.failedCount == 2) {
 | 
	
		
			
				|  |  |                  send_alert("没有数据,请尝试重新加载!【DataService】: ctlName[" + controlName + "],  extParm[" + extparm + "]");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }else{
 | 
	
		
			
				|  |  | -            this.list.assignJsonData(output.list);
 | 
	
		
			
				|  |  | +            obj.list.assignJsonData(output.list);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.getList = function () {
 | 
	
		
			
				|  |  |          return this.list;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.passiveUpdate = function(data){
 | 
	
		
			
				|  |  |          this.failedCount = 0;
 | 
	
	
		
			
				|  | @@ -268,7 +274,7 @@ RedRankTable.showPart = function(slide, part, data){
 | 
	
		
			
				|  |  |      redrankvue.part[part] = partList;
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -RedRankTable.tickInterval = 10000;
 | 
	
		
			
				|  |  | +RedRankTable.tickInterval = 1000;
 | 
	
		
			
				|  |  |  RedRankTable.tick = function(){
 | 
	
		
			
				|  |  |      var totalDataLen = this.activeData != null ? this.activeData.len() : 0;
 | 
	
		
			
				|  |  |      if(this.slides != Math.ceil(totalDataLen / this.slideLen)){
 | 
	
	
		
			
				|  | @@ -378,14 +384,14 @@ var FlowRealTime = new (function () {
 | 
	
		
			
				|  |  |              console.warn(obj);
 | 
	
		
			
				|  |  |              send_alert("发送清空请求成功, 正在等待采集端进行处理...");
 | 
	
		
			
				|  |  |              this.finished = false;
 | 
	
		
			
				|  |  | -            setTimeout(this.resultVerifyTimeout, 8000);
 | 
	
		
			
				|  |  | -            setTimeout(this.getVerify, 300);
 | 
	
		
			
				|  |  | +            setTimeout(this.resultVerifyTimeout, 8000, this);
 | 
	
		
			
				|  |  | +            setTimeout(this.getVerify, 300, this);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        this.getVerify = function () {
 | 
	
		
			
				|  |  | -            if (this.finished) return;
 | 
	
		
			
				|  |  | -            get_data("endpoint/heartbeat?flowId=" + flowId, this.onVerifyResult);
 | 
	
		
			
				|  |  | -            setTimeout(this.getVerify, 100);
 | 
	
		
			
				|  |  | +        this.getVerify = function (obj) {
 | 
	
		
			
				|  |  | +            if (obj.finished) return;
 | 
	
		
			
				|  |  | +            get_data("endpoint/heartbeat?flowId=" + flowId, obj.onVerifyResult);
 | 
	
		
			
				|  |  | +            setTimeout(obj.getVerify, 100, obj);
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          this.onVerifyResult = function (obj, sta) {
 | 
	
	
		
			
				|  | @@ -423,7 +429,7 @@ var FlowRealTime = new (function () {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        this.resultVerifyTimeout = function () {
 | 
	
		
			
				|  |  | +        this.resultVerifyTimeout = function (obj) {
 | 
	
		
			
				|  |  |              finished = true;
 | 
	
		
			
				|  |  |              if (executed) {
 | 
	
		
			
				|  |  |                  // 执行成功
 | 
	
	
		
			
				|  | @@ -447,11 +453,13 @@ var FlowRealTime = new (function () {
 | 
	
		
			
				|  |  |  var redrankvue = new Vue({
 | 
	
		
			
				|  |  |      el: '#redrank',
 | 
	
		
			
				|  |  |      data: {
 | 
	
		
			
				|  |  | -        part:[
 | 
	
		
			
				|  |  | -            [],
 | 
	
		
			
				|  |  | -            []
 | 
	
		
			
				|  |  | -        ],
 | 
	
		
			
				|  |  | -        message: 'Hello Vue.js!'
 | 
	
		
			
				|  |  | +        part:[],
 | 
	
		
			
				|  |  | +        title: '本厂今日生产能手榜'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    methods: {
 | 
	
		
			
				|  |  | +        clicktitle: function () {
 | 
	
		
			
				|  |  | +            alert("Hello! This is Title");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 |