• 通用查询-高级查询


     1//通用查询的快速查询增加字段模糊搜索过滤
     2 pageOnRenderEvent_before:function(e){
     3             _self.setInitComponentCallBack(function(cmpType,option,dom){
     4                          if (cmpType=="waf.bizCommonQuery") {
     5                              //option.schemeTabHide = true;
     6                              option.initDatas = _self.getPageInitData().queryInitData;
     7                              option.searchOptions=[{name:"绑定的属性",label:"别名"},{name:"绑定的属性",label:"别名"}];
     8                          }
     9                      });
    10         }
     1 //常用条件增加日期过滤选项
     2  function addGatherDate(){
     3       var groupFilters = {
     4         field:'绑定的属性名',
     5         dataType:"Date",
     6         title:'日期',
     7         needScope:true,
     8         filterItems:[{name:'今天',value:'d1',isDefault:0},{name:'本周',value:'w1',isDefault:0},{name:'本月',value:'m1',isDefault:        0},{name:'近三月',value:'m3',isDefault:0}]
     9         };
    10       var groupFiltersArray = new Array(groupFilters);
    11       waf("#bizCommonQuery").bizCommonQuery("option","groupFilters",groupFiltersArray);
    12       waf("#bizCommonQuery").bizCommonQuery("addCusFilter");
    13     }
     1 //常用条件增加枚举选项过滤
     2 function addBillType(){
     3     var groupFilters = {
     4       field:'绑定的属性',
     5       dataType:'ObjectValue',
     6       title:'显示名称',
     7       filterItems:[{value:"值",alias:"别名"},{value:"值",alias:"别名"}]
     8     };
     9     var groupFiltersArray = new Array(groupFilters);
    10     waf("#bizCommonQuery").bizCommonQuery("option","groupFilters",groupFiltersArray);
    11     waf("#bizCommonQuery").bizCommonQuery("addCusFilter");
    12   }
     1 //常用条件增加文本框模糊搜索
     2  function addAccountBank(){
     3     addCusFilterDOM("accountBank","入账账户","ObjectValue",true);
     4     var json = {
     5       id:'bizCommonQuery_accountBank_input',
     6       192,
     7       style:'margin-right:10px;'
     8     };
     9     dom = waf.createDOM("text",json);
    10     var parentEl = waf("#bizCommonQuery_queryaccountBankGroupNav");
    11     waf("#bizCommonQuery_queryaccountBankGroupNav")[0].style.marginRight = "0px";
    12     var liEl = waf("<li style='max-500px;margin-top:3px;'></li>");
    13     liEl.appendTo(parentEl);
    14     waf.appendDOM(liEl,dom);
    15     waf.initComponent("text",json,dom);
    16     addSureButton(parentEl,0,"accountBank");
    17   }
    18 
    19 //常用条件自定义新增一行
    20 function addCusFilterDOM(field,title,dataType,required){
    21         var self = this;
    22         var id = "bizCommonQuery";
    23         var optsJson = {
    24             id:id + "_query"+field+"Col",
    25             colWidth:"100%"
    26         };
    27         var queryColDom = waf.createDOM("column", optsJson);
    28         waf.appendDOM(waf("#"+id+"_commUsePanel"), queryColDom);
    29         waf.initComponent("column", optsJson, queryColDom);
    30 
    31         optsJson = {
    32             id:id + "_query"+field,
    33             layout:"column",
    34             tagClass:"ui-commonquery-group"
    35         };
    36         var queryPanelDom = waf.createDOM("panel", optsJson);
    37         waf.appendDOM(queryColDom, queryPanelDom);
    38         waf.initComponent("panel", optsJson, queryPanelDom);
    39 
    40         optsJson = {
    41             id:id + "_query"+field+"Hd",
    42             colWidth:"10%",
    43             tagClass:"ui-commonquery-group-hd"
    44         };
    45         var queryHdDom = waf.createDOM("column", optsJson);
    46         waf.appendDOM(queryPanelDom, queryHdDom);
    47         waf.initComponent("column", optsJson, queryHdDom);
    48 
    49         waf("<span class='ui-lb-text'>"+title+":</span>").appendTo(queryHdDom);
    50 
    51         optsJson = {
    52             id:id + "_query"+field+"Content",
    53             colWidth:"90%",
    54             tagClass:"ui-commonquery-group-content"
    55         };
    56         var queryContentDom = waf.createDOM("column", optsJson);
    57         waf.appendDOM(queryPanelDom, queryContentDom);
    58         waf.initComponent("column", optsJson, queryContentDom);
    59         waf("<ul id='"+id+"_query"+field+"GroupNav' class='ui-commonquery-group-nav'>").appendTo(queryContentDom);
    60 
    61         optsJson = {
    62             id:id + "_query"+field+"More",
    63             colWidth:"",
    64             tagClass:"ui-commonquery-group-more"
    65         };
    66         waf("#" + id + "_query"+field).wafColumnLayout();
    67     } 
    68 
    69 //文本框后面加上查询按钮
    70   function addSureButton(parentEl,page,idname){
    71     var liEl = waf("<li style='float:left;margin-top:3px;'></li>");
    72        liEl.appendTo(parentEl);
    73 
    74        var searchBtnDivDom = waf('<div id="bizCommonQuery_"'+idname+'"Div" class="surebtndiv"></div>');
    75        var linkOpts = {
    76            id: idname,
    77            name: idname,
    78            tagClass:"btn",
    79            caption: "查询"
    80        };
    81        linkBtnDom = waf.createDOM("linkButton", linkOpts);
    82        linkBtnDom.attr("title", "查询");
    83        waf.appendDOM(searchBtnDivDom, linkBtnDom);
    84        waf.appendDOM(liEl, searchBtnDivDom);
    85        waf.initComponent("linkButton", linkOpts, linkBtnDom);
    86        linkBtnDom.bind("click.wafLinkButton", function (event) {
    87            getRevDetailsList(page,getfilter(page));
    88        });
    89   }
     1 //如果存在多个页签
     2 //切换页签清空过滤条件-已选条件
     3 function clearFilter(){
     4     var nav = document.getElementById("bizCommonQuery_queryBarGroupNav");
     5     while(nav.hasChildNodes()){
     6         nav.removeChild(nav.firstChild);
     7     }
     8 }
     9 
    10 //切换页签,如果每个页签常用条件不一样,清除所有已加的常用条件
    11 function addBizCommonQueryFilter(page){
    12     if(page!=null && page!=""){
    13         var panel = document.getElementById("bizCommonQuery_commUsePanel");
    14         while(panel.hasChildNodes()){
    15             panel.removeChild(panel.firstChild);
    16         }
    17     }
     1 //通用查询只支持查询表格,因为需要绑定query来联动查询
     2 //通用查询支持分录表格联动查询可以通过一下代码来实现
     3  //快速查询联动
     4 //这段快速查询联动是增加两个模糊搜索字段
     5         $("#bizCommonQuery_searchFilter").bind("DOMNodeInserted",function(e){
     6           var fil = 0;
     7           var filNodes = document.getElementById("bizCommonQuery_searchFilter").childNodes;
     8           var fillen = filNodes.length;
     9           for(var f=0; f<fillen; f++){
    10             var spans = $("#bizCommonQuery_searchFilter").find(".query-search-value");
    11               if(spans[spans.length-1].childNodes.length>0){
    12                 fil++;
    13               }
    14           }
    15         // 删除模糊搜索字段联动查询   
    16           $(".query-search-facet").find(".query-search-remove").die().live("click",function(e){
    17             getRowData(getfilter(createType));
    18           });
    19           //只选中一种查询字段联动查询
    20           if(fillen==1){
    21             if(fil>0)
    22               getRowData(getfilter(createType));
    23             //选中2种查询字段联动查询
    24           }else if(fillen==2){
    25             if(fil==2)
    26               getRowData(getfilter(createType));
    27             //3种联动字段查询
    28           }else if(fillen==3){
    29             if(fil==3)
    30               getRowData(getfilter(createType));
    31           }
    32         });     
    33 
    34 
    35 
    36 //通用查询+分录表格常用条件联动查询
    37         $("#bizCommonQuery_queryBarGroupNav").bind('DOMNodeInserted',function(e) {
    38           var nav = document.getElementById( "bizCommonQuery_queryBarGroupNav" ).childNodes;
    39             for(var n=0; n<nav.length; n++){
    40               var li = nav[n];
    41               if(li.childNodes.length>0){
    42                 var span = li.childNodes[0];
    43                 if(span.childNodes.length<3){
    44                   return;
    45                 }else{
    46                   if(n==nav.length-1){
    47                 //选中常用条件联动查询
    48                     getRowData(getfilter(createType));
    49 
    50                     waf(".choosing").find(".chooseitem a").die().live("click",function(e){
    51                     var idstr = this.parentNode.id.split("_")[0];
    52                     var fieldids = waf(this).parent().find("label").html().split(";");
    53                     for (var i = 0; i < fieldids.length; i++) {
    54                       waf("#"+fieldids[i]).parent().removeClass("active");
    55                       waf("#"+fieldids[i]).removeClass("ui-commonquery-multisel");
    56                     }
    57                     this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
    58                         if(idstr.indexOf('FilterBar')<0){
    59                           waf("#bizCommonQuery").bizCommonQuery("getSelectItems").remove(idstr+".id");
    60                           waf("#bizCommonQuery").bizCommonQuery("getCurrentFilterItems").cusFilterItems.remove(idstr+".id");
    61                         }else{
    62                           idstr = idstr.substring(0,idstr.length-"FilterBar".length);
    63                           waf("#bizCommonQuery").bizCommonQuery("getSelectItems").remove(idstr);
    64                           waf("#bizCommonQuery").bizCommonQuery("getCurrentFilterItems").cusFilterItems.remove(idstr);
    65                         }
    66                     //删除已选中的常用条件联动查询
    67                         getRowData(getfilter(createType));
    68                     });
    69                   }
    70                 }
    71               }
    72             }
    73         }); 
    74     },   
  • 相关阅读:
    Wide character in print at a2.pl line 返回json 需要encode_utf8
    decode_json 必须是unicode形式的字符
    Wide character in print at a2.pl line 6.
    unicode转中文
    用 Flask 来写个轻博客 (4) — (M)VC_创建数据模型和表
    Openstack_通用模块_Oslo_vmware 创建 vCenter 虚拟机快照
    为什么企业数据化运营很重要?
    为什么企业数据化运营很重要?
    Openstack_单元测试工具 tox
    java 把已知下载路径的文件复制到本地
  • 原文地址:https://www.cnblogs.com/suruozhong/p/6011072.html
Copyright © 2020-2023  润新知