zoukankan      html  css  js  c++  java
  • 树结构-配置

     1 @ResponseBody
     2     @RequestMapping(value = "treeData")
     3     public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId, HttpServletResponse response) {
     4         List<Map<String, Object>> mapList = Lists.newArrayList();
     5         List<Constituency> list = ConstituencyUtils.getAlls();
     6         for (int i=0; i<list.size(); i++){
     7             Constituency e = list.get(i);
     8             if (StringUtils.isBlank(extId) || (extId!=null && !extId.equals(e.getId()) && e.getParentIds().indexOf(","+extId+",")==-1)
     9                     || !StringUtils.equals("市辖区", e.getAreaName())){
    10                 Map<String, Object> map = Maps.newHashMap();
    11                 map.put("id", e.getId()); 
    12                 map.put("type", e.getAreaType()); 
    13                 map.put("pId", e.getParentId());
    14                 map.put("name", e.getConstituencyName());
    15                 mapList.add(map);
    16             }
    17         }
    18         return mapList;
    19     }                     
     1 <%@ page contentType="text/html;charset=UTF-8" %>
     2 <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
     3 <html>
     4 <head>
     5     <title>选区管理表管理</title>
     6     <meta name="decorator" content="represent"/>
     7     <%@include file="/WEB-INF/views/include/treetable.jsp" %>
     8     <%@include file="/WEB-INF/views/include/treeview.jsp" %>
     9     <style>
    10         #ztree{
    11             float:left;
    12         }
    13     </style>
    14     <script type="text/javascript">
    15     </script>
    16 </head>
    17 <body>
    18     <%-- <sys:message content="${message}"/> --%>
    19     <div id="jerichotab" class="jericho_container">
    20         <div class="col-sm-12">
    21             <div class="col-sm-3 left_tree">
    22                 <div class="accordion-heading">
    23                     <a class="accordion-toggle">选区机构<i class="icon-refresh pull-right" onclick="refreshTree();"></i></a>
    24                 </div>
    25                 <br><br>
    26                 <div id="ztree" class="ztree"></div>
    27             </div>
    28             <div class="col-sm-9 right_list">
    29                 <iframe id="constituency" src="${ctx}/constituency/constituency/list" style=" 100%;height: 100%;" frameborder="0"></iframe>
    30             </div>
    31         </div>
    32     </div>
    33     <script type="text/javascript">
    34         var setting = {data:{simpleData:{enable:true,idKey:"id",pIdKey:"pId",rootPId:'0'}},
    35             callback:{onClick:function(event, treeId, treeNode){
    36                     var id = treeNode.id == '0' ? '' :treeNode.id;37                     var type = treeNode.type;
    38                     $('#constituency').attr("src","${ctx}/constituency/constituency/list?parentStr="+id+"&areaType="+type+"");
    39                 }
    40             }
    41         };
    42         
    43         function refreshTree(){
    44             $.getJSON("${ctx}/constituency/constituency/treeData",function(data){
    45                 /* $.fn.zTree.init($("#ztree"), setting, data).expandAll(true); */
    46                 $.fn.zTree.init($("#ztree"), setting, data);
    47                 var treeObj = $.fn.zTree.getZTreeObj("ztree");
    48                 var nodes = treeObj.getNodesByParam("level",0);
    49                 if (nodes.length>0) {
    50                     treeObj.expandNode(nodes[0], true, false, false);
    51                 }
    52             });
    53         }
    54         refreshTree();
    55          
    56         /* var leftWidth = 180; // 左侧窗口大小
    57         var htmlObj = $("html"), mainObj = $("#main");
    58         var frameObj = $("#left, #openClose, #right, #right iframe");
    59         function wSize(){
    60             var strs = getWindowSize().toString().split(",");
    61             htmlObj.css({"overflow-x":"hidden", "overflow-y":"hidden"});
    62             mainObj.css("width","auto");
    63             frameObj.height(strs[0] - 5);
    64             var leftWidth = ($("#left").width() < 0 ? 0 : $("#left").width());
    65             $("#right").width($("#content").width()- leftWidth - $("#openClose").width() -5);
    66             $(".ztree").width(leftWidth - 10).height(frameObj.height() - 46);
    67         } */
    68     </script>
    69     <script src="${ctxStatic}/common/wsize.min.js" type="text/javascript"></script>
    70 </body>
    71 </html>
    2020-09-0210:48:59
  • 相关阅读:
    韩式英语
    Daily dictation 听课笔记
    words with same pronunciation
    you will need to restart eclipse for the changes to take effect. would you like to restart now?
    glottal stop(britain fountain mountain)
    education 的发音
    第一次用Matlab 的lamada语句
    SVN的switch命令
    String的split
    SVN模型仓库中的资源从一个地方移动到另一个地方的办法(很久才解决)
  • 原文地址:https://www.cnblogs.com/mxggx/p/13600561.html
Copyright © 2011-2022 走看看