81041
2019-01-18 5fe2efb71f6ad809a1cfc59beab18bbea99fff5e
gx_tieta/WebRoot/js/elecircle.content.js
@@ -1,5 +1,18 @@
var eleCircle = new EleCircle('eleCircle', {});
var signalGood = new Image();
signalGood.src="image/eleCircle/signalGood.gif";
var signalBad = new Image();
signalBad.src="image/eleCircle/signalBad.gif";
$(function() {
   eleCircle.drawImg({
      startX: 10,
      startY: 30,
      width: 30,
      height: 30,
      isShow:false,
      id: 'signal'
   });
   // 最上方的横线
   eleCircle.drawLine({
      startX: 120,
@@ -463,12 +476,12 @@
   });
   
   // 拓扑图名称
   eleCircle.drawText({
   /*eleCircle.drawText({
      id: 'title',
      startX: 400,
      startY: 40,
      name: '设备浮充状态电流方向',
   });
   });*/
   
   // 设备内部温度
   eleCircle.drawText({
@@ -476,6 +489,14 @@
      startX: 270,
      startY: 100,
      name: '设备温度:0℃',
   });
   // dcdc模块告警
   eleCircle.drawText({
      id: 'dcdcWarn',
      startX: 250,
      startY: 390,
      name: 'DCDC模块告警:0x8000/0x8000',
   });
   
   var currentObj = {
@@ -799,7 +820,18 @@
        }
        this.ele.append(_ul);
    };
    // 设置配置项
    _prop.setOpts = function(options) {
       this.options = options;
        this._init();
        if(this.options.length != 0) {
            this.show();
        }
    };
    // 根据配置项的值获取li
    _prop._setLi = function(li, option) {
        var _i, _a = $('<a></a>');
@@ -825,6 +857,9 @@
           }
           var list = option.content.list[option.status]?option.content.list[option.status]:'未知';
           var txt = option.content.text+list;
           _a.append(txt);
        }else if(option.type == 'text') {
           var txt = option.content.text;
           _a.append(txt);
        }
        
@@ -871,6 +906,41 @@
            }
        }
    };
    // 设置文本内容
    _prop.setText = function(name, text, notShow) {
       var _itemList = this.ele.find('li');
       // 遍历配置项
        for(var i =0; i<this.options.length; i++) {
           var _opts = this.options[i];    // 获取当前循环的变量
           // 根据名称确定更改的内容
            if(_opts.name == name) {
                var _tmp = $.extend({}, _opts); // 获取全新对象,避免引用传递
                _tmp.content.text = text;
                // 设置是否显示
                if(notShow) {
                   _tmp.notShow = true;
                }else {
                   _tmp.notShow = false;
                }
                this._setLi(_itemList.eq(i), _tmp); // 更新li的内容
            }
        }
    };
    // 更新配置项的值
    _prop.updateOpts = function(name, options, update) {
       // 遍历配置项
        for(var i =0; i<options.length; i++) {
           var _opts = options[i];    // 获取当前循环的变量
           // 根据名称确定更改的内容
            if(_opts.name == name) {
               $.extend(_opts, update);
            }
        }
    };
    var options = [
      {
@@ -922,8 +992,87 @@
           }
        }
    ];
    // 61850配置项
    gl.circleStatus.e61850Opts = options;
    var optionsBts = [
      {
         name: 'workstatus',
         type: 'list',
         notShow: false,
         //imgCallback: gl.statusImg.getImg,
         status: 0,
         content: {
            list:gl.BTS9100.workstates,
            text: '设备状态:'
         }
      },
      {
         name: 'stop',
         type: 'list',
         status: 0,
         notShow: false,
         content: {
            list:gl.BTS9100.alarmstates,
            text: '上一次核容终止原因:'
         }
      },
      {
         name: 'count',
         type: 'text',
         status: 0,
         notShow: false,
         content: {
            text: '通信计数:'
         }
      },
      {
         name: 'percent',
         type: 'text',
         status: 0,
         notShow: false,
         content: {
            text:'通信丢包率:'
         }
      },
      {
         name: 'sdCard',
         type: 'text',
         status: 0,
         notShow: false,
         content: {
            text: 'SD卡状态:???'
         }
      },
      {
         name:'devVersion',
         type: 'text',
         status: 0,
         notShow: false,
         content: {
            text: '设备版本号:???'
         }
      },
      {
         name: 'signal',
         type: 'text',
         status: 0,
         notShow: true,
         content:  {
            text: '信号强度:'
         }
      }
    ];
    // bts9100配置项
    gl.circleStatus.btsOpts = optionsBts;
    // 61850拓扑图状态
    var status = new Status($('#eleCircleStatus'), options);
    gl.circleStatus.status = status;
    // BTS9100拓扑图状态
    var statusBts = new Status($('#eleCircleStatus'), optionsBts);
    gl.circleStatus.statusBts = statusBts;
    
    // 设置全局验证设备类型的正则表达式
   var globalPattern = {
@@ -942,10 +1091,9 @@
          var data = model.data[0];
           var alarmstatus = data.dev_alarmstate;   //[0:'无',1:'暂停',2:'放电测试',3:'放电等待',4:'限流充电',5:'直流充电',6:'充电等待',7:'测试时间到',8:'测试容量到',9:'单体下限到',10:'组端下限到',11:'市电异常',12:'存储卡不足',13:'负载温度高',14:'电流异常',15:'远程通信坏',16:'负载通信坏',17:'选择通信坏',18:'负载电流坏',19:'内存申请坏',20:'未知'];
          var workstatus =parseInt(data.dev_workstate) ;   //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
           if(typeof callback == 'function') {
              callback.call({}, data);
           }
           // 判断workstatus
           // console.log(workstatus);
           // console.log(data.dev_testgroupnum+'***'+(batt.GroupIndexInFBSDevice+1)+'***'+mygraph.battstate);
          // 判断workstatus
           switch(workstatus) {
              case 0:   {   // 浮充状态
                 mygraph.graphtype = 0;
@@ -1007,7 +1155,13 @@
              }
              break;
           }
           // 设置左上方内容
           if(typeof callback == 'function') {
              callback.apply({}, [batt, data, mygraph]);
           }
       }else {
          // console.log(123);
          mygraph.graphtype = 4 ;
         _str = '(未连接)';
          // 回调函数
@@ -1015,6 +1169,7 @@
            callback();
         }
       }
       // console.log(lasttype+"**"+mygraph.graphtype);
       // 判断是否更新拓扑图
       if(lasttype != mygraph.graphtype){
         mygraph.ischange = 1;