_private = {
    id:'',
    permission: 'n',
    htmlContent:[],
    personSummaryInfo:[],
    personDetailInfo:[],
    personHierarchy:[],
    personWorkExp:[],
    personPositionMember:[],
    personDegreeExp:[],
    personProjectExp:[],
    personPerfResultInfo:[]
  };
  
  _self.pageinit=function(){
      _private.initEvent();
    
  }
  
  _private.initEvent = function(){
    _private.appid = mbos.getRequestParams().appid;
    
    _private.hostname = window.location.origin;
    _private.storeEid = mbos.getRequestParams().storeEid;
    _private.id = decodeURIComponent(mbos.getRequestParams().dataKey);
    
    if(_private.id){
      var success = function(data){       
            _private.permission = data.permission;
              //获取我的档案
          _private.fillMyArchiveEvent();
  
          //页面控件初始化
          _private.controlEvent();
      }
      var fail = function(data){
         mbos.msgBox.showError(data);
      }
      mbos.eas.invokeScript("getPersonPermissionByPersonId", [_private.id], success,fail);
    }
  }
  
  _private.fillMyArchiveEvent = function(){
    //填写我的个人信息
    _private.fillMyPersonSummaryInfo();
    
  }
  
  _private.fillMyPersonSummaryInfo = function(){
    //获取我的信息模板
    var template = _private.getMyPersonSummaryInfoTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //通过服务端函数获取数据，进行渲染，拼接html片段
    _private.callPersonSummaryInfoService('getPersonSummaryService',compiled_tpl, _private.htmlContent);
  }
  
   _private.getMyPersonSummaryInfoTemplate = function(){   
     var myPersonalInfoTemplate1 = ['<div class="panel panel-default">',
                                      '<div class="panel-body page-title">',
                                           '<div align="center"><img src="data:image/png;base64,${photo}" alt="..." class="img-circle" style="width:60px;height:60px;border: 5px solid #fff;border-radius: 30px;" onerror="_private.showDefaultImg(this)"></div>',
                                          '<div align="center" style="color:#FFF;margin-top:5px;">',
                                            '<div>${name}</div>',
                                            '<div>${position} - ${dept}</div>',
                                          '</div>',
                                      '</div>',
                                      '<div class="bs-example" data-example-id="simple-nav-pills" id="myTab">',
                                          '<ul class="nav nav-pills">',
                                            '<li role="presentation" style="width:33%"><a href="#contact" id ="con">'+localeResource.contact+'</a></li>',
                                            '<li role="presentation" style="width:34%"><a href="#relation" id="rel">'+localeResource.relation+'</a></li>',
                                            '<li role="presentation" style="width:33%"><a href="#archive" id="arc">'+localeResource.archive+'</a></li>',
                                          '</ul>',
                                      '</div>',
                                  '</div>',
                                  '<div class="tab-content">'].join('');
     
     var myPersonalInfoTemplate2 = ['<div class="panel panel-default">',
                                    '<div class="panel-body page-title">',
                                      '<div align="center"><img src="data:image/png;base64,${photo}" alt="..." class="img-circle" style="width:60px;height:60px;border: 5px solid #fff;border-radius: 30px;" onerror="_private.showDefaultImg(this)"></div>',
                                          '<div align="center" style="margin-top:5px;color:#FFF;">',
                                            '<div>${name}</div>',
                                            '<div>${position} - ${dept}</div>',
                                          '</div>',
                                      '</div>',
                                      '<div class="bs-example" data-example-id="simple-nav-pills" id="myTab">',
                                          '<ul class="nav nav-pills">',
                                            '<li role="presentation" style="width:50%"><a href="#contact" id="con">'+localeResource.contact+'</a></li>',
                                            '<li role="presentation" style="width:50%"><a href="#relation" id="rel">'+localeResource.relation+'</a></li>',
                                          '</ul>',
                                      '</div>',
                                  '</div>',
                                  '<div class="tab-content">'].join('');
     var template = myPersonalInfoTemplate2;
     if(_private.permission === 'y'){
       template = myPersonalInfoTemplate1;
     }
     return template;
   }
   
   _private.callPersonSummaryInfoService = function(serverName, compiled_tpl, html){
    var param = [];
    param[0] = _private.id;
    var success = function(data){
      //解析人员信息
       _private.personSummaryInfo = _private.parseData(data);
      //获取人员照片
       _private.getPersonPhoto(compiled_tpl, html);   
    }
    var fail = function(data){
      //_private.callPersonSummaryInfoService(serverName,compiled_tpl, html);
      mbos.msgBox.showError(localeResource.msg1);
    }
    mbos.eas.invokeScript(serverName, param, success,fail);
  }
  
   _private.getPersonPhoto = function(compiled_tpl, html){
     var param = [];
     param[0] = _private.id;
    var success = function(data){
      _private.personSummaryInfo.photo = data.photo;
      //渲染数据
      var htmlFragment = compiled_tpl.render(_private.personSummaryInfo);
         html.push(htmlFragment);    
        _private.fillMyContactMethod();
    }
    var fail = function(data){
      mbos.msgBox.showError(localeResource.msg2);
    }
    mbos.eas.invokeScript("getSinglePersonPhotoService", param, success,fail);
   }
   
   
   _private.fillMyContactMethod = function(){
     //获取我的信息模板
    var template = _private.getMyContactMethodTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //获取数据，进行渲染，拼接html片段
    var htmlFragment = compiled_tpl.render(_private.personSummaryInfo);
    _private.htmlContent.push(htmlFragment);
     
     $('#rootpanel').eq(0).empty().append( _private.htmlContent.join(''));
     
     _private.registerListenerEvent('#con');
     //填写我的职级关系
    //_private.fillMyPositionRelation();
   }
   
   _private.getMyContactMethodTemplate  = function(){
      var myContactMethodTemplate = ['<div class="tab-pane" id="contact">',
                                               '<div class="panel panel-default">',
                                              '<div class="panel-heading">',
                                                    ''+localeResource.contactInfo+'',
                                              '</div>',
                                              '<div class="panel-body">',
                                                    '<div class="col-xs-4" align="left">'+localeResource.tel+'</div>',
                                                    '<div id="cellVal" class="col-xs-6" align="right">${cell}</div>',
                                                    '<div id="cell" class="col-xs-2"><span class="glyphicon glyphicon-phone"></span></div>',
                                              '</div>',
                                              '<div class="line"></div>',
                                              '<div class="panel-body">',
                                                  '<div class="col-xs-4" align="left">'+localeResource.officePhone+'</div>',
                                                  '<div id="officephoneVal"class="col-xs-6" align="right" style="text-overflow:ellipsis;white-space:nowrap;overflow:hidden;">${officephone}</div>',
                                                  '<div id="officephone" class="col-xs-2"><span class="glyphicon glyphicon-phone-alt"></span></div>',
                                              '</div>',
                                              '<div class="line"></div>',
                                              '<div class="panel-body">',
                                                  '<div class="col-xs-4" align="left">'+localeResource.email+'</div>',
                                                  '<div id="emailVal" class="col-xs-6" align="right" style="text-overflow:ellipsis;white-space:nowrap;overflow:hidden;">${email}</div>',
                                                  '<div id="email" class="col-xs-2"><span class="glyphicon glyphicon-envelope"></span></div>',
                                              '</div>',
                                             '</div>',
                                             '<div class="panel panel-default">',
                                              '<div class="panel-heading">'+localeResource.tag+'</div>',
                                              '<div class="panel-body" style="max-height:80px;word-wrap:break-word;word-break:break-all;overflow:hidden;">',
                                                    '{@each personTags as item}',
                                                    '<span class="label label-default">${item.name}</span>&nbsp;&nbsp;',
                                                    '{@/each}',
                                             '</div>',
                                             '</div>',
                                  '</div>'].join('');
     return myContactMethodTemplate;
   }
   
  _private.fillMyPositionRelation = function(){
    //获取上级组织模板
    var template = _private.getMyUpHierarchyTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //获取数据，进行渲染，拼接html片段
    _private.callPersonUpHierarchyService('getPersonUpHierarchyService',compiled_tpl, _private.htmlContent);
  }
  
  _private.getMyUpHierarchyTemplate = function(){
    var myUpHierarchyTemplate = ['<div class="tab-pane" id="relation">',
                                      '<div class="panel panel-default">',
                                      '<div class="panel-heading">',
                                            '<span class="badge pull-right">${upCount}</span>'+localeResource.superior+'',
                                      '</div>',
                                      '{@each upHierarchyList as item}',	
                                      '<div class="panel-body upHierarchy" data-key="${item.id}">',                       
                                          '<div class="col-xs-3" align="left"><img src="data:image/png;base64,${item.photo}" alt="..." class="img-circle" style="width:60px;height:60px;border: 5px solid #fff;border-radius: 30px;" onerror="_private.showDefaultImg(this)"></div>',
                                          '<div class="col-xs-9">',
                                              '<div><h5><b>${item.name}</b></h5></div>',
                                              '<div><h6>${item.position} - ${item.dept}</h6></div>',
                                          '</div>',                               		  
                                      '</div>',
                                      '<div class="line"></div>',
                                        '{@/each}',
                                     '</div>'].join('');
    return myUpHierarchyTemplate
  }
  
  _private.callPersonUpHierarchyService = function(serverName, compiled_tpl, html){
    var param = [];
    param[0] = _private.id;
    var personIdList = [];
    var success = function(data){   
        var personIdList = [];
      if(data.length > 0){
        //去除上级人员的重复数据
        data = _private.removeMulitiData(data);
        _private.personHierarchy.upHierarchyList = [];
        _private.personHierarchy.upCount = data.length;
        for(var i in data){
          personIdList[i] = data[i].id;
          //解析组织信息
          var itemData = _private.parseData(data[i]);     
           _private.personHierarchy.upHierarchyList.push(itemData);
        }
      }
      
      _private.getUpBatchPersonPhotos(personIdList,compiled_tpl, html);
      
      
    }
    var fail = function(data){
      //mbos.msgBox.showError('获取上级组织失败，请联系管理员.');
      _private.callPersonUpHierarchyService(serverName,compiled_tpl, html);
    }
    mbos.eas.invokeScript(serverName, param, success,fail);
  }
  
  _private.getUpBatchPersonPhotos = function(personIdList, compiled_tpl, html){
    var param = [];
    param[0] = personIdList;
    var success = function(data){
      var upHierarchyList = _private.personHierarchy.upHierarchyList;
      for(var i in upHierarchyList){
        upHierarchyList[i].photo = data[upHierarchyList[i].id];
      }
        //渲染数据
      var htmlFragment = compiled_tpl.render(_private.personHierarchy);
      html.push(htmlFragment);
      
      //填写下级组织
      _private.fillPersonDownHierarchy();	
    }
    var fail = function(data){
      mbos.msgBox.showError(localeResource.msg3);
    }
    mbos.eas.invokeScript("getBatchPersonPhotoService", param, success,fail);
  }
  
  
  
  _private.fillPersonDownHierarchy = function(){
    //获取下级组织模板
    var template = _private.getMyDownHierarchyTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //获取数据，进行渲染，拼接html片段
    _private.callPersonDownHierarchyService('getPersonDownHierarchyService',compiled_tpl, _private.htmlContent);
  }
  
  _private.getMyDownHierarchyTemplate = function(){
    var myDownHierarchyTemplate = [ '<div class="panel panel-default">',
                                      '<div class="panel-heading">',
                                        '<span class="badge pull-right">${downCount}</span>'+localeResource.subordinate+'',
                                      '</div>',
                                      '{@each downHierarchyList as item}',
                                      '<div class="panel-body downHierarchy" data-key="${item.id}">',
                                          '<div class="col-xs-3" align="left"><img src="data:image/png;base64,${item.photo}" alt="..." class="img-circle" style="width:60px;height:60px;border: 5px solid #fff;border-radius: 30px;" onerror="_private.showDefaultImg(this)" /></div>',
                                              '<div class="col-xs-9">',
                                              '<div><h5><b>${item.name}</b></h5></div>',
                                              '<div><h6>${item.position} - ${item.dept}</h6></div>',
                                          '</div>',
                                      '</div>',
                                      '<div class="line"></div>',
                                      '{@/each}',
                                  '</div>',
                                '</div>'].join('');
    return myDownHierarchyTemplate
  }
  
  _private.callPersonDownHierarchyService = function(serverName, compiled_tpl, html){
    var param = [];
    param[0] = _private.id;
    var personIdList = [];
    var success = function(data){
      if(data.length > 0){
        //去除下级重复人员信息
        data = _private.removeMulitiData(data);
  
        _private.personHierarchy.downHierarchyList = [];
        _private.personHierarchy.downCount = data.length;
        for(var i in data){
           personIdList[i] = data[i].id;
          //解析组织信息
          var itemData = _private.parseData(data[i]);   
           _private.personHierarchy.downHierarchyList.push(itemData);      
        }
      }
      _private.getDownBatchPersonPhotos(personIdList,compiled_tpl, html);   
          
   }
    var fail = function(data){
      //mbos.msgBox.showError('获取下级组织失败，请联系管理员.');
      _private.callPersonUpHierarchyService(serverName,compiled_tpl, html);
    }
    mbos.eas.invokeScript(serverName, param, success,fail);
  }
  
  _private.getDownBatchPersonPhotos = function(personIdList,compiled_tpl, html){
    var param = [];
    param[0] = personIdList;
    var success = function(data){
      var downHierarchyList = _private.personHierarchy.downHierarchyList;
      for(var i in downHierarchyList){
        downHierarchyList[i].photo = data[downHierarchyList[i].id];
      }
        //渲染数据
      var htmlFragment = compiled_tpl.render(_private.personHierarchy);
      html.push(htmlFragment);    
      
      $('#rootpanel').eq(0).empty().append( _private.htmlContent.join(''));
      _private.registerListenerEvent('#rel');    
      //填写我的档案中的经历
      //_private.fillMyExperience(); 
    }
    var fail = function(data){
      mbos.msgBox.showError(localeResource.msg5);
    }
    mbos.eas.invokeScript("getBatchPersonPhotoService", param, success,fail);
  }
  
  _private.fillMyExperience = function(){
    //获取下级组织模板
    var template = _private.getMyExperienceTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //获取数据，进行渲染，拼接html片段
    _private.callExperienceService('getPersonDetailInfoService',compiled_tpl, _private.htmlContent);
    
    
  }
  
  _private.getMyExperienceTemplate = function(){
    var myDownHierarchyTemplate = ['<div class="tab-pane" id="archive">',
                                       '<div class="panel panel-default">',
                                        '<div class="panel-heading">',
                                                ''+localeResource.empArchive+'',
                                        '</div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.empNum+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${number}</div>',
                                        '</div>',
                                         '<div class="line"></div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.age+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${age}</div>',
                                        '</div>',
                                        '<div class="line"></div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.gender+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${gender}</div>',
                                        '</div>',
                                        '<div class="line"></div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.marital+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${wed}</div>',
                                        '</div>',
                                        '<div class="line"></div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.politics+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${politicalFace}</div>',
                                        '</div>',
                                        '<div class="line"></div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.entryTime+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${enterDate}</div>',
                                        '</div>',
                                        '<div class="line"></div>',
                                        '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">'+localeResource.grade+'</div>',
                                            '<div div class="col-xs-7 text-primary" align="left">${jobGrade}</div>',
                                        '</div>',
                                      '</div>'].join('');
    return myDownHierarchyTemplate
  }
  
  _private.callExperienceService = function(serverName, compiled_tpl, html){
    var param = [];
    param[0] = _private.id;
    var success = function(data){
      //处理数据为null的情况
      for(var i in data){
        if(data[i] === null){
          data[i] = '';
        }
      }
      _private.personDetailInfo = data;
      //渲染数据
      var htmlFragment = compiled_tpl.render(_private.personDetailInfo);
      html.push(htmlFragment);    
      //填写我的企业任职经历
      _private.fillMyPositionMemberExperience();
    }
    var fail = function(data){
      _private.callExperienceService(serverName,compiled_tpl, html);
      //mbos.msgBox.showError('获取个人企业任职经历信息失败，请联系管理员.');    
    }
    mbos.eas.invokeScript(serverName, param, success,fail);
  }
  
   _private.fillMyPositionMemberExperience = function(){
       //获取职业经历模板
      var template = _private.getMyPositionMemberExperienceTemplate();
      //编译模板，暂时不渲染
      var compiled_tpl = juicer(template);
      //获取数据，进行渲染，拼接html片段
      _private.callPositionMemberService('getPositionMemberService',compiled_tpl, _private.htmlContent);    
   }
   
   _private.getMyPositionMemberExperienceTemplate = function(){
     var myPositionMemberExperienceTemplate = ['<div class="panel panel-default">',
                                                  '<div class="panel-heading">',
                                                    ''+localeResource.experience+'',
                                                  '</div>',
                                                  '{@each positionMemberList as item}',
                                                  '<div class="panel-body">',
                                                    '<div class="col-xs-5" align="left">${item.beginDate} - {@if item.endDate != "2199年12月"}${item.endDate}{@else}'+localeResource.toDate+'{@/if}</div>',
                                                      '<div div class="col-xs-7" align="left">',
                                                        '<div><b>${item.dept}</b></div>',
                                                        '<div>${item.position}</div>',
                                                     '</div>',
                                                  '</div>',
                                                    '<div class="line"></div>',
                                                  '{@/each}',
                                                '</div>'].join('');   
    return myPositionMemberExperienceTemplate
  }
  
  _private.callPositionMemberService = function(serverName, compiled_tpl, html){
       var param = [];
       param[0] = _private.id;
       var success = function(data){
          _private.personPositionMember.positionMemberList = data;        
         
          //获取数据，进行渲染，拼接html片段
          var htmlFragment = compiled_tpl.render(_private.personPositionMember);
         
          _private.htmlContent.push(htmlFragment);
          //填写我的工作经历
          _private.fillMyWorkExperience();
  
      }
      var fail = function(data){
        mbos.msgBox.showError(localeResource.msg6);
      }
      mbos.eas.invokeScript(serverName, param, success,fail);
   }
  
   _private.fillMyWorkExperience = function(){
     //获取下级组织模板
    var template = _private.getMyWorkExperienceTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //获取数据，进行渲染，拼接html片段
    _private.callWorkExperienceService('getWorkExpService',compiled_tpl, _private.htmlContent);
   }
   
   _private.getMyWorkExperienceTemplate = function(){
     var myWorkExperienceTemplate = ['<div class="panel panel-default">',
                                        '<div class="panel-heading">',
                                          ''+localeResource.socialExperience+'',
                                        '</div>',
                                        '{@each workExpList as item}',
                                        '<div class="panel-body">',
                                          '<div class="col-xs-5" align="left">${item.beginDate} - {@if item.endDate != "2199年12月"}${item.endDate}{@else}'+localeResource.toDate+'{@/if}</div>',
                                            '<div div class="col-xs-7" align="left">',
                                              '<div><b>${item.company}</b></div>',
                                              '<div>${item.position}</div>',
                                           '</div>',
                                        '</div>',
                                           '<div class="line"></div>',
                                        '{@/each}',
                                      '</div>'].join('');
     
    return myWorkExperienceTemplate
   }
   
   _private.callWorkExperienceService = function(serverName, compiled_tpl, html){
       var param = [];
       param[0] = _private.id;
       var success = function(data){
             _private.personWorkExp.workExpList = _private.parseDataList(data);
             
            //渲染数据
           var htmlFragment = compiled_tpl.render(_private.personWorkExp);
        
           _private.htmlContent.push(htmlFragment);
         
         //填写教育经历
            _private.fillMyDegreeExperience();	
  
      }
      var fail = function(data){
        mbos.msgBox.showError(localeResource.msg7);
      }
      mbos.eas.invokeScript(serverName, param, success,fail);
   }
   
   
   _private.fillMyDegreeExperience = function(){
     //获取下级组织模板
    var template = _private.getMyDegreeExperienceTemplate();
    //编译模板，暂时不渲染
    var compiled_tpl = juicer(template);
    //获取数据，进行渲染，拼接html片段
    _private.callDegreeExperienceService('getPersonDegreeService',compiled_tpl, _private.htmlContent);
  }
  
   _private.getMyDegreeExperienceTemplate = function(){
     var myDegreeExperienceTemplate = ['<div class="panel panel-default">',
                                          '<div class="panel-heading">',
                                            ''+localeResource.education+'',
                                          '</div>',
                                          '{@each degreeExpList as item}',
                                          '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">{@if item.enrollDate != null}${item.enrollDate}{@else}{@/if} - {@if item.graduateDate != null}${item.graduateDate}{@else}{@/if}</div>',
                                              '<div div class="col-xs-7" align="left">',
                                                '<div><b>${item.graduateSchool}</b></div>',
                                                '<div>${item.diploma} ${item.specialty}</div>',
                                             '</div>',
                                          '</div>',
                                           '<div class="line"></div>',
                                          '{@/each}',
                                        '</div>'].join('');
     
        return myDegreeExperienceTemplate
   }
   
   _private.callDegreeExperienceService = function(serverName, compiled_tpl, html){
          var param = [];
          param[0] = _private.id;
       var success = function(data){
             _private.personDegreeExp.degreeExpList = _private.parseDataList(data);
             
            //渲染数据
           var htmlFragment = compiled_tpl.render(_private.personDegreeExp);
         
           _private.htmlContent.push(htmlFragment);
         
         //填写人员绩效信息
         _private.fillMyProjectExperience();
      }
      var fail = function(data){
        mbos.msgBox.showError(localeResource.msg8);
      }
      mbos.eas.invokeScript(serverName, param, success,fail);
   }
   
   _private.fillMyProjectExperience = function(){
        //获取项目经验模板
      var template = _private.getMyProjectExperienceTemplate();
      //编译模板，暂时不渲染
      var compiled_tpl = juicer(template);
      //获取数据，进行渲染，拼接html片段
      _private.callProjectExperienceService('getPersonProjectExperienceService',compiled_tpl, _private.htmlContent);
   }
   
   _private.getMyProjectExperienceTemplate = function(){
     var myDegreeExperienceTemplate = ['<div class="panel panel-default">',
                                          '<div class="panel-heading">',
                                            ''+localeResource.projectExperience+'',
                                          '</div>',
                                          '{@each projectExpList as item}',
                                          '<div class="panel-body">',
                                            '<div class="col-xs-5" align="left">${item.startDate} - {@if item.endDate != "2199年12月"}${item.endDate}{@else}'+localeResource.toDate+'{@/if}</div>',
                                              '<div div class="col-xs-7" align="left">',
                                                '<div><b>${item.projectName}</b></div>',
                                                '<div>${item.character}</div>',
                                             '</div>',
                                          '</div>',
                                           '<div class="line"></div>',
                                          '{@/each}',
                                        '</div>',
                                      '</div>'].join('');
     
        return myDegreeExperienceTemplate
   }
   
   _private.callProjectExperienceService = function(serverName, compiled_tpl, html){
       var param = [];
       param[0] = _private.id;
       var success = function(data){
             _private.personProjectExp.projectExpList = _private.parseDataList(data);
             
            //渲染数据
           var htmlFragment = compiled_tpl.render(	_private.personProjectExp);       
           _private.htmlContent.push(htmlFragment);
         
         $('#rootpanel').eq(0).empty().append( _private.htmlContent.join(''));
         _private.registerListenerEvent('#arc');
               
      }
      var fail = function(data){
        mbos.msgBox.showError(localeResource.msg9);
      }
      mbos.eas.invokeScript(serverName, param, success,fail);
   }
    _private.parseDataList = function(data){
        for(var i in data){
		    var info=data[i];
			if(info){
			    for(var m in info){
			    if(info[m]==null){
				   info[m]='';
			      }
		       }	
			}
	    }
		return data;
    }
  _private.parseData = function(data){
    //处理null的情况
    for(var i in data){
      if(!data[i]){
        data[i] = '';
      }
    }
    
    var positionMemberList = data.positionMemberList;
    //先记录第一条任职经历
    var position = positionMemberList[0].position;
    var dept = positionMemberList[0].dept;
    var endDate = positionMemberList[0].endDate;
    if(endDate == '2199年12月'){
      positionMemberList[0].endDate = localeResource.toDate
    }
    
    for(var j=0;j< positionMemberList.length; j++){
       if(positionMemberList[j]  === null){
         positionMemberList[j] = '';
       }
       if(j > 0){       
         if(positionMemberList[j].beginDate >= positionMemberList[j-1].beginDate && positionMemberList[j].isPrimary){
           //替换最新的任职经历
           position = positionMemberList[j].position;
           dept = positionMemberList[j].dept;
         }
       }
     }
     //增加岗位和部门属性
     data.position = position;
     data.dept = dept;
     return data;
  }
  
  _private.removeMulitiData = function(data){
    var personIdArray = [];
    var personData = [];
    for(var i in data){
      if(personIdArray.indexOf(data[i].id) == -1 && data[i].id != _private.personSummaryInfo.id){
        personIdArray.push(data[i].id);
        personData.push(data[i]);
      }
    }
    return personData;
  }
  
  _private.showDefaultImg = function(img){
    img.src =	  ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB4CAYAAAAE9le0AAAEcUlEQVR42u2cV27rMBBFuf+1pfdq',
                'I7049haUdw0IMPRkiSocjqLzcT/SbIdHnMYZhs1mUyA/CiwCQBBAAIIAAhAEEIAggACEhQAIAghA',
                'EEAAggACEAQQgCCAIIAABAEEIAggAHGm9XpdfH9/Fx8fH8Xb21vx/v6+/VrfB4gRAC387e1tcXx8',
                'XBwcHOzV0dHR9vdeXl4mCcg1kNVqVTw8PBSHh4eNEPZJf3d3d1d8fX0BZIh+fn6Kx8fH3iDqwAis',
                'AAOko+QP2sxSX8mcvb6+AiRWz8/Po+2Kpt2yWCwA0iYtUkoQVcmEAaRhZ1jCKOVxpwQPPiO1mWoy',
                'X958SsgdTaVy4F2gKKkEyD8ptM0Jo5RyldkDUU6Qy1TV7RKVYWYNRFGOBxilrq+v5wtENSYvu2NX',
                'HnxJFiAqFHqDIT09Pc0TiKqxHoFcXl7OE0juULfJuecu2Ycc/sMjjFK5S/XmQOQ4PQORf5sVEMX7',
                'noGorjYrIF4jLC+RVshRTAQIPgQfQpQ1oTzEY9mklI4EyNSd6OLiYp6ZuprYPALxcKRLtdeR/8h6',
                'HqJTOgqLjoDoafS0S3KHuy7O1L2cGno5LcwOxMO5ut7/8/MTIKXUF5UTiodTQnedi9ZtpJ7bSd30',
                '9lr7E/kNjwM9rrrftVMszJfge52ucjcfktKn6HW9+YxJTFApR1HiOCYYmShP0dQkZwx13KuFHJqB',
                'e0n6/swUrg61ZGq0uDG7RlVb+aMpDXtOdk5d5xVaaD31akgQKElf6/u5zzO4yYGbHP6GvO4kV0CU',
                'G1jZ/fPz8+L09HQ7NEQtq3JlhkJcLZActmbJLYqaddGYh3nDLEC0IE15RupdoiBgX4SmXZOzezFY',
                '7wiFo9oFOSuwMaeV2jE5wmYzIOpYPDs7G2UIU00SWrA6xTQqnJycdLojxbLuFSx2Rdfzc5mNttes',
                'W1QtYNtTrZ93zfbl36zG3UJqGH1LH20399T5gZjx5r5nLxoysijBhJQwVMLoW4OSWWp7j93Xj70A',
                '4OrqyvXFNSFVFDUERuxp3m4nfczvj9UPptxlMkD0T8vmWrV1yiQqaovJvMecTUkVGoccIeWYA5hy',
                '0rFP7JjHxPp82qGugYx9zVKME9WixAIZY+dWHf3YucpoQFJ0IsYs9P39/XZh2naTTNoUOuaDh4hq',
                'nxQRtb1vmfW3ZfcpL0mLiQhNgTTVhoba6dhFVhUg10yKEtmxsvnBQFJfQtZ0bVI1p2jyOVq0KXRA',
                'DgaSusFtXyJWNzy6z8T1KZfk2iXBmyOv6ubmptNtdHVRz3K5nEyf8CAginBS/5MqInYxQXX1rKGt',
                'RJZDP2FIecSqa71ao2rKuPWZdguTluNz1fc2BWJ5gWXVFLRVA3bzF+ubI4aardA377C880oZtiCU',
                'anvilZuUB1apo6uqZMbNgXi/QGbKw6MhZwHxL0qWwxyISgVlCyf6X3Qu0kqKAAIQBBAEEIAggAAE',
                'AQQgCCAAQQABCIsAEAQQgCCAAAQBBCAIIABBAEEAmYZ+Acsb6tSP1j3TAAAAAElFTkSuQmCC'].join(''); 
    img.onerror = null; 
  }
  
  _private.registerListenerEvent = function(id){
        $(id).tab('show');//初始化显示哪个tab
        $('#myTab a').click(function (e) { 
          e.preventDefault();//阻止a链接的跳转行为 
          $(this).tab('show');//显示当前选中的链接及关联的content
          if($(this).attr('href') == "#relation"){         
            if($('#relation').length <= 0){
              //填写我的职级关系
                _private.fillMyPositionRelation();
            }
          }else if($(this).attr('href') == "#archive"){
             if($('#archive').length <= 0){
              //填写我的档案中的经历
              _private.fillMyExperience(); 
            }
          }
        });
         $(".upHierarchy").on("click",function(event){
           var key = $(this).attr('data-key');
           mbos.ui.open({
                path:requestParam.path,
                name:requestParam.name,
                params:{
                  appid: _private.appid,
                  eid: _private.eid,
                  storeEid: mbos.getRequestParams().storeEid,
                  dataKey: encodeURIComponent(key)
                }
            });
        }); 
        $(".downHierarchy").on("click",function(event){
           var key = $(this).attr('data-key');
           mbos.ui.open({
                path:requestParam.path,
                name:requestParam.name,
                params:{
                  appid: _private.appid,
                  eid: _private.eid,
                  storeEid: mbos.getRequestParams().storeEid,
                  dataKey: encodeURIComponent(key)
                }
            });
        });  
          $("#cell").on("click",function(event){
          if($("#cellVal").html()){
               window.location.href = 'tel:' + $("#cellVal").html();
          }else{
                mbos.msgBox.showInfo(localeResource.msg10);
          }
        });
          $("#officephone").on("click",function(event){
          if($("#officephoneVal").html()){
               window.location.href = 'tel:' + $("#officephoneVal").html();
          }else{
                mbos.msgBox.showInfo(localeResource.msg11);
          }
        });
          $("#email").on("click",function(event){
           if($("#emailVal").html()){
               window.location.href = 'mailto:' + $("#emailVal").html();
           }else{
                mbos.msgBox.showInfo(localeResource.msg12);
          }
        });
  }
  
  _private.controlEvent = function(){
    
  }
	        
