, { id : 'move', text : '移动', iconCls : 'icon-communication', handler : moveTree}
//移动节点 function moveTree() { var selectedArray = $(gridTasktype).datagrid('getSelections'); if (selectedArray.length > 0) { $.farm.openWindow({ id : 'taskTypeTreeNodeWin', width : 250, height : 300, modal : true, url : "tasktype/treeNodeTreeView.do", title : '移动分类' }); chooseWindowCallBackHandle = function(node) { $.messager.confirm('确认对话框', '确定移动该节点么?', function(falg1) { if (falg1) { $.post('tasktype/moveTreeNodeSubmit.do', { ids : $.farm.getCheckedIds(gridTasktype, 'ID'), id : node.id }, function(flag) { if (flag.STATE == 0) { $(gridTasktype).datagrid('reload'); $('#taskTypeTreeNodeWin').window('close'); $.messager.confirm('确认对话框', '数据更新,是否重新加载左侧树?', function(r) { if (r) { $('#TaskTypeTree').tree( 'reload'); } }); } else { var str = MESSAGE_PLAT.ERROR_SUBMIT + flag.MESSAGE; $.messager.alert(MESSAGE_PLAT.ERROR, str, 'error'); } }, 'json'); } }); }; } else { $.messager.alert(MESSAGE_PLAT.PROMPT, MESSAGE_PLAT.CHOOSE_ONE, 'info'); } }
<%@ page language="java" pageEncoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%> <div class="easyui-layout" data-options="fit:true"> <div data-options="region:'north',border:false"> <div class="TREE_COMMON_BOX_SPLIT_DIV"> <a id="ChooseProjectTreeReload" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true" iconCls="icon-reload">刷新菜单</a> <a id="ChooseProjectTreeOpenAll" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true" iconCls="icon-sitemap">全部展开</a> </div> </div> <div data-options="region:'center',border:false"> <ul id="ChooseProjectTree"></ul> </div> </div> <script type="text/javascript"> var currentType, currentTypeName; $(function() { $('#ChooseProjectTree').tree({ url : 'projecttype/projectTypeTree.do', onSelect : function(node) { //$('#PARENTID_RULE').val(node.id); //$('#PARENTTITLE_RULE').val(node.text); chooseWindowCallBackHandle(node); } }); $('#ChooseProjectTreeReload').bind('click', function() { $('#ChooseProjectTree').tree('reload'); }); $('#ChooseProjectTreeOpenAll').bind('click', function() { $('#ChooseProjectTree').tree('expandAll'); }); }); </script>
/** * 跳转树选择页面 * * @return */ @RequestMapping("/treeNodeTreeView") public ModelAndView forSend() { return ViewMode.getInstance().returnModelAndView("project/ChooseProjectTypeTree"); } /** * 移动节点 * * @return */ @RequestMapping("/moveTreeNodeSubmit") @ResponseBody public Map<String, Object> moveTreeNodeSubmit(String ids, String id, HttpSession session) { try { projectTypeServiceImpl.moveTreeNode(ids, id, getCurrentUser(session)); return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } }
@Override public List<ProjectType> getAllSubNodes(String typeid) { Session session = sessionFatory.getCurrentSession(); Query sqlquery = session.createQuery(" from ProjectType where TREECODE like ? order by ctime "); sqlquery.setString(0, getEntity(typeid).getTreecode() + "%"); return sqlquery.list(); }
@Override @Transactional public void moveTreeNode(String ids, String targetId, LoginUser currentUser) { String[] idArray = ids.split(","); TaskType target = getTasktypeEntity(targetId); if (target != null && target.getModel().equals("1")) { throw new RuntimeException("'类型'节点下禁止创建子节点!"); } for (int i = 0; i < idArray.length; i++) { // 移动节点 TaskType node = getTasktypeEntity(idArray[i]); if (target != null && target.getTreecode().indexOf(node.getTreecode()) >= 0) { throw new RuntimeException("不能够移动到其子节点下!"); } if (target == null) { node.setParentid("NONE"); } else { node.setParentid(targetId); } tasktypeDaoImpl.editEntity(node); // 构造所有树TREECODE List<TaskType> list = tasktypeDaoImpl.getAllSubNodes(idArray[i]); for (TaskType org : list) { initTreeCode(org.getId()); } } }
备注 | 修改日期 | 修改人 | |
格式调整 | 2019-12-01 19:33:48[当前版本] | 系统管理员 | |
格式调整 | 2019-12-01 19:32:19 | 系统管理员 | |
格式调整 | 2019-12-01 14:30:35 | 系统管理员 | |
格式调整 | 2019-12-01 14:22:23 | 系统管理员 | |