Ztree結合jbox實現彈窗樹結構

點擊添加分類,彈出事項選擇框爲jboxcss

<a href="#" id="down{{row.id}}" style="display:none" onclick="xz('{{row.id}}')" type="button" >添加下級事項</a>

使用onclick觸發,並傳參數id app

function xz(id){ top.$.jBox.open("iframe:${ctx}/hb02/hbGprotreeInfo/selectSx?id="+id, "事項選擇",810,$(top.document).height()-240,{ buttons:{"肯定":"ok", "關閉":true}, submit:function(v, h, f){ var ids = h.find("iframe")[0].contentWindow.$("#checkedId")[0].value; if (v=="ok"){ // 執行保存
                        loading('正在提交,請稍等...'); $("#searchForm").attr("action","${ctx}/hb02/hbGprotreeInfo/save?id="+id+"&ids="+ids); $('#searchForm').submit(); return true; } else if (v=="clear"){ h.find("iframe")[0].contentWindow.clearAssign(); return false; } }, loaded:function(h){ $(".jbox-content", top.document).css("overflow-y","hidden"); } }); }

後臺代碼實現彈出窗口ui

/** * jbox 彈框頁面。 ypr * @param hbGprotreeInfo * @param model * @return
     */ @RequiresPermissions("hb02:hbGprotreeInfo:edit") @RequestMapping(value = "selectSx") public String selectSx(HbGprotreeInfo hbGprotreeInfo,Model model) { //new一個字典實體
        Dict dict=new Dict(); //type=act_category,進行條件查詢
        dict.setType("act_category"); List<HbGprotreeInfo> list = hbGprotreeInfoService.findParent(hbGprotreeInfo); model.addAttribute("HbGprotreeInfo", hbGprotreeInfo); model.addAttribute("dList", dictService.findList(dict)); model.addAttribute("HbGprotreeList", hbGprotreeInfoService.findDt(hbGprotreeInfo)); //這裏返回的頁面就是事項選擇頁面,可本身定義返回頁面
        return "modules/hb/hb02/hbGprotreeInfofl"; }

使用jbox彈出窗口 選樹結構擇類型按鈕,彈出樹結構,url

<div class="control-group">
    <label class="control-label">選擇類型:</label>
        <div class="controls" >
        <!-- url 查詢樹結構數據 -->
            <sys:treeselect id="checked" name="dictLists" value="" labelName="dict.value" labelValue="${dict.value}" title="類型" url="/hb02/hbGprotreeInfo/treeData?id=${HbGprotreeInfo.id}" extId="${dict.value}" cssClass="input-xxlarge required" checked="true" allowClear="true"/>
        </div>
</div>

後臺spa

/** * 點擊選擇事項查詢 進行回顯打勾,禁用等操做 * @param extId * @param hbGprotreeInfo * @param response * @return
     */ @RequiresPermissions("user") @ResponseBody @RequestMapping(value = "treeData") public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,HbGprotreeInfo hbGprotreeInfo,HttpServletResponse response) { List<Map<String, Object>> mapList = Lists.newArrayList(); //查詢字典中數據,返回爲樹結構數據
        Dict dict=new Dict(); //type=act_category,進行條件查詢
        dict.setType("act_category"); List<HbGprotreeInfo> chong=hbGprotreeInfoService.findChong(hbGprotreeInfo); //根據數據查詢字典數據,樹結構展現 ypr
        List<Dict> list = dictService.findList(dict); //查詢父節點下全部子節點 ypr
        List<HbGprotreeInfo> hbGprotreeList=hbGprotreeInfoService.findParent(hbGprotreeInfo); //循環將樹結構數據展現
        for (int i=0; i<list.size(); i++){ Dict e = list.get(i); Map<String, Object> map = Maps.newHashMap(); map.put("id", e.getId()); map.put("pId", e.getParentId()); map.put("name", e.getLabel()); //根據查詢出的父節點下全部數據循環 ypr
                for(int j=0;j<hbGprotreeList.size();j++){ HbGprotreeInfo hbGprotreeInfo2 = hbGprotreeList.get(j); //判斷回顯打勾的數據,若是股/分類Entity中流程類型,等於字典中value,打勾
                    if(hbGprotreeInfo2.getLctype().equals(e.getValue())){ //打勾
                        map.put("checked", true); } } //循環判斷重複數據 0517 ypr
                for(int k=0;k<chong.size();k++){ HbGprotreeInfo hbGprotreeInfo3 = chong.get(k); if(hbGprotreeInfo3.getLctype().equals(e.getValue())){ //打勾,禁用
                        map.put("checked", true); map.put("chkDisabled", true); } } mapList.add(map); } return mapList; }

 

zTree包與jbox的包能夠去資源下載   點擊打開連接.net

相關文章
相關標籤/搜索