hdw
2019-01-02 d55a20bca83c456949f14cd340e40fe2c6a3bf85
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,
@@ -314,42 +327,42 @@
   });
   
   // 二极管上方的横线
   eleCircle.drawLine({
      startX: 380,
      startY: 135,
      endX: 430,
      endY: 135,
      strokeStyle: '#FF0000',
   });
//   eleCircle.drawLine({
//      startX: 380,
//      startY: 135,
//      endX: 430,
//      endY: 135,
//      strokeStyle: '#FF0000',
//   });
   // 二极管上方的竖线
   eleCircle.drawLine({
      startX: 430,
      startY: 135,
      endX: 430,
      endY: 160,
      strokeStyle: '#FF0000',
   });
//   eleCircle.drawLine({
//      startX: 430,
//      startY: 135,
//      endX: 430,
//      endY: 160,
//      strokeStyle: '#FF0000',
//   });
   
   
   
   
   // 二极管下方的竖线
   eleCircle.drawLine({
      startX: 430,
      startY: 220,
      endX: 430,
      endY: 250,
      strokeStyle: '#FF0000',
   });
//   eleCircle.drawLine({
//      startX: 430,
//      startY: 220,
//      endX: 430,
//      endY: 250,
//      strokeStyle: '#FF0000',
//   });
   
   // 二极管下方的横线
   eleCircle.drawLine({
      startX: 430,
      startY: 250,
      endX: 380,
      endY: 250,
      strokeStyle: '#FF0000',
   });
//   eleCircle.drawLine({
//      startX: 430,
//      startY: 250,
//      endX: 380,
//      endY: 250,
//      strokeStyle: '#FF0000',
//   });
   
   
   // BATC+端上方的虚线
@@ -418,11 +431,11 @@
   });
   
   // 绘制二极管Do
   eleCircle.drawDiode({
      startX: 430,
      startY: 160,
      id: 'diode'
   });
//   eleCircle.drawDiode({
//      startX: 430,
//      startY: 160,
//      id: 'diode'
//   });
   
   // 绘制ko开关
   eleCircle.drawSwitchBtn({
@@ -463,12 +476,12 @@
   });
   
   // 拓扑图名称
   eleCircle.drawText({
   /*eleCircle.drawText({
      id: 'title',
      startX: 400,
      startY: 40,
      name: '电池组浮充状态电流方向',
   });
      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 = {
@@ -487,7 +508,7 @@
         [430, 520], [430, 360],[320,360]
      ],
      clockwise: 0,
      name: '电池组浮充状态电流方向'
      name: '设备浮充状态电流方向'
   }
   
   currentObj = $.extend({}, currentObj, floatCharge);
@@ -526,6 +547,22 @@
      lineWidth: 20,
      fontWeight: 'bold',
      id: 'eleCurrent'
   });
   // 负载电流
   eleCircle.drawText({
      id: 'loaderCurr',
      startX: 600,
      startY: 50,
      name: '最大负载电流:0A',
   });
   // 最大核容电流
   eleCircle.drawText({
      id: 'disCurrMax',
      startX: 600,
      startY: 70,
      name: '最大核容电流:0A',
   });
   
   // 浮充电流方向
@@ -783,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>');
@@ -809,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);
        }
        
@@ -855,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 = [
      {
@@ -906,8 +992,78 @@
           }
        }
    ];
    // 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: '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 = {
@@ -926,11 +1082,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;
@@ -992,7 +1146,13 @@
              }
              break;
           }
           // 设置左上方内容
           if(typeof callback == 'function') {
              callback.apply({}, [batt, data, mygraph]);
           }
       }else {
          // console.log(123);
          mygraph.graphtype = 4 ;
         _str = '(未连接)';
          // 回调函数
@@ -1000,6 +1160,7 @@
            callback();
         }
       }
       // console.log(lasttype+"**"+mygraph.graphtype);
       // 判断是否更新拓扑图
       if(lasttype != mygraph.graphtype){
         mygraph.ischange = 1;