function jsServiceList(){

};


jsServiceList.LoadServiceListUI=function(){
    var arrString=[];
    arrString.push('<table id="tbServiceList" cellpadding="0" cellspacing="0" >');
    arrString.push("<tr><td>");
    arrString.push('<div id="div_left_ServiceTypeTree" class="div-left-menu">');
    arrString.push('<div id="div-title" class="div-title"><div class="div-title-name">登记类型</div></div>');
    arrString.push('<div id="treeServiceType" class="div-left-menu-content" style="overflow:auto;width:200px;height:200px;"></div>');
    arrString.push("</div>");
    arrString.push("</td>");
    arrString.push("<td >");
    arrString.push('<table id="tbServiceGrid"></table>');
    arrString.push("</td>");
    arrString.push("</tr>");
    arrString.push("</table>");
    document.getElementById("divServiceList").innerHTML=arrString.join("");
    
};

/*服务登记类型树*/
jsServiceList.LoadServiceRecordTypeTree=function(){
     var treeString=GetTree("SELECT ID,CNName as Name,0 AS ParentID,EndFlag FROM eOA_fip_CallInputSheet WHERE EndFlag=0","eOA_fip_CallInputSheet",0);

    var menudata =[];    
    if(treeString!="")
    {
        menudata=$.parseJSON(treeString);  
    }
    menudata.push({"id":"-1","text":"明细类型","EndFlag":"false","hasChildren":"true","isexpand":"true","complete":"true","ChildNodes":null});  
    menudata.push({"id":"0","text":"文本类型","EndFlag":"false","hasChildren":"true","isexpand":"true","complete":"true","ChildNodes":null});
          
    var op = { data: menudata, onnodeclick: jsServiceList.ReLoadServiceList,foldtheme: "yellow", theme: "bbit-tree-no-lines" ,spacepic:"../AppFrame/APICss/Shared/images/s.gif"};
    $("#treeServiceType").treeview(op);        
    treeString=null;
    menudata=null;
    CollectGarbage();
};

/*点击登记类型树时操作*/
jsServiceList.CurHeadJsID=null;
jsServiceList.OldHeadJsID=null;
jsServiceList.ReLoadServiceList=function(item){
     jsServiceList.BindDesignJsContent(item.id,item.text);
};

/*单击表单时加载其数据*/
jsServiceList.BindDesignJsContent=function(id,text){
    if(id==-1)
    {/*明细模式*/
//           jsFastInputReport.GetReportGridList("eOA_fip_CallInputFixedBill",text);
    }
    else if(id==0)
    {/*文本模式*/
        
    }
    else
    {/*自定义模式*/
          var txtSql="SELECT  Lable,JSFileName,JSFilePath,TableName FROM eOA_fip_CallInputSheet WHERE  ID="+id;
          var obj=DBReader.selectSqlForJson(txtSql);
          if (obj != null) {
             var result = eval("[{" + obj + "}]");
             if(result[0].result=1 && result[0].table!=undefined){
                 if(result[0].table[0].Path!="" && result[0].table[0].Path!=null)
                 { 
                    App.SetNullHref(0);
                    var divObj=document.getElementsByTagName("HEAD");
                    if(jsServiceList.OldHeadJsID!=null && jsServiceList.OldHeadJsID!="fixedBill")
                    {
                       divObj[0].removeChild(document.getElementById(jsServiceList.OldHeadJsID)); 
                    }
                    var scriptObj=document.createElement("script");
                    scriptObj.src="js/"+result[0].table[0].FileName;
                    
                    scriptObj.id="js_"+result[0].table[0].Lable;                        
                    jsServiceList.OldHeadJsID=   jsServiceList.CurHeadJsID;
                    jsServiceList.CurHeadJsID="js_"+result[0].table[0].Lable;
                    
                    divObj[0].appendChild(scriptObj);
                    scriptObj=null;
                    divObj=null;
                    setTimeout("js"+result[0].table[0].Lable+".reLoadCallNote()",100);/*加载模板设计内容*/
                    setTimeout("jsFastInputReport.CreateSearchTitle()",130);
                    setTimeout("jsFastInputReport.GetReportGridList('"+result[0].table[0].TableName+"','"+text+"')",160);


                    CollectGarbage();
                    App.SetNullHref(1);
                  }
                  else
                  {
                    
                  }
             }
         }
    }
};

/*服务登记列表*/
jsServiceList.ServiceRecordGrid=null;
jsServiceList.LoadServiceRecordList=function(){   
    var w = $("#middleContanier").width() -185;
    var gh = 165;
    var serviceOption =
    {
        height: gh,
        //width: w,
        colModel:[
            {display: '通话号码', name: 'FieldName', width: (w * 0.1), sortable: false, align: 'left' },
            { display: '通话时间', name: 'IsShow', width: (w * 0.03), sortable: false, align: 'left' },
            { display: '名字', name: 'ShowText', width: (w * 0.15), sortable: false, align: 'left' },
            { display: '内容1', name: 'Width', width: (w * 0.08), sortable: false, align: 'left' },
            { display: '内容2', name: 'IsSumSummary', width: (w * 0.08), sortable: false, align: 'left' },
            { display: '内容3', name: 'IsSort', width: (w * 0.08), sortable: false, align: 'left' }
        ],
        title:"服务登记列表",
        customFunction: jsServiceList.ShowPage
    };
    jsServiceList.ServiceRecordGrid = $("#tbServiceGrid").ikegrid(serviceOption);
    serviceOption = null;
};

jsServiceList.ShowPage=function(){
    return null;
};

/*单击服务登记列表便签时操作*/
jsServiceList.LoadServiceListTab=function()
{   
    jsCallMiddlePanel.listNo="ServiceList";     
    jsServiceList.LoadServiceRecordTypeTree(); /*服务登记类型树*/
    jsServiceList.LoadServiceRecordList();/*服务登记列表*/
}