备注 | 修改日期 | 修改人 | |
格式调整 | 2019-12-01 20:55:08[当前版本] | 系统管理员 | |
格式调整 | 2019-12-01 19:00:18 | 系统管理员 | |
格式调整 | 2019-12-01 13:27:07 | 系统管理员 | |
格式调整 | 2019-12-01 13:26:10 | 系统管理员 | |
参考 Organization
<div data-options="region:'west',split:true,border:false" style="width: 250px;"> <div class="TREE_COMMON_BOX_SPLIT_DIV"> <a id="examTypeTreeReload" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true" iconCls="icon-reload">刷新</a> <a id="examTypeTreeOpenAll" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true" iconCls="icon-sitemap">展开</a> </div> <ul id="examTypeTree"></ul> </div> <div class="easyui-layout" data-options="region:'center',border:false"> </div>
//初始化条件查询 searchExamtype = $('#searchExamtypeForm').searchForm({ gridObj : gridExamtype }); $('#examTypeTree').tree({ url : 'examtype/examtypeTree.do', onSelect : function(node) { $('#PARENTID_RULE').val(node.id); $('#PARENTTITLE_RULE').val(node.text); searchTypeTree.dosearch({ 'ruleText' : searchTypeTree.arrayStr() }); } }); $('#examTypeTreeReload').bind('click', function() { $('#examTypeTree').tree('reload'); }); $('#examTypeTreeOpenAll').bind('click', function() { $('#examTypeTree').tree('expandAll'); });
<tr> <td class="title">上级节点:</td> <td> <input id="PARENTTITLE_RULE" type="text" readonly="readonly" style="background: #F3F3E8"> <input id="PARENTID_RULE" name="PARENTID:=" type="hidden"> </td> </tr>
//新增 function addDataExamtype() { var parentID = $("#PARENTID_RULE").val(); var url = url_formActionExamtype + '?operateType=' + PAGETYPE.ADD +'&parentID='+parentID; $.farm.openWindow({ id : 'winExamtype', width : 600, height : 300, modal : true, url : url, title : '新增' }); }
增加上级分类的表单
if (query.getQueryRule().size() == 0) { query.addRule(new DBRule("PARENTID", "NONE", "=")); }
/** * 组织机构节点 */ @RequestMapping("/examtypeTree") @ResponseBody public Object examtypeTree(String id) { try { if (id == null) { // 如果是未传入id,就是根节点,就构造一个虚拟的上级节点 id = "NONE"; List<EasyUiTreeNode> list = new ArrayList<>(); EasyUiTreeNode nodes = new EasyUiTreeNode("NONE", "考试分类", "open" , "icon-customers"); nodes.setChildren(EasyUiTreeNode.formatAsyncAjaxTree( EasyUiTreeNode.queryTreeNodeOne(id, "SORT", "WTS_EXAM_TYPE", "ID", "PARENTID", "NAME", "CTIME").getResultList(), EasyUiTreeNode.queryTreeNodeTow(id, "SORT", "WTS_EXAM_TYPE", "ID", "PARENTID", "NAME", "CTIME") .getResultList(),"PARENTID", "ID", "NAME", "CTIME")); list.add(nodes); return list; } return EasyUiTreeNode.formatAsyncAjaxTree( EasyUiTreeNode.queryTreeNodeOne(id, "SORT", "WTS_EXAM_TYPE", "ID", "PARENTID", "NAME", "CTIME").getResultList(), EasyUiTreeNode.queryTreeNodeTow(id, "SORT", "WTS_EXAM_TYPE", "ID", "PARENTID", "NAME", "CTIME").getResultList(), "PARENTID", "ID", "NAME", "CTIME"); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } }
/** * 显示详细信息(修改或浏览时) * * @return */ @RequestMapping("/form") public ModelAndView view(RequestMode pageset, String ids, String parentId) { try { Examtype parent = null; if (!parentId.equals("") && parentId != null) { parent = examTypeServiceImpl.getExamtypeEntity(parentId); } switch (pageset.getOperateType()) { case (1): {// 新增 return ViewMode.getInstance().putAttr("pageset", pageset) .putAttr("parent", parent) .returnModelAndView("exam/ExamtypeForm"); } ... return ViewMode.getInstance().returnModelAndView("exam/ExamtypeForm"); } catch (Exception e) { ... } }