ylbtech-笔记-IJ:IJ笔记1 |
1. 下拉框返回顶部 |
1、
<form:select id="type" path="baseId" class="input-medium">
<form:option value="" label=""/><form:options items="${typeList}" htmlEscape="false"/> </form:select>
2、
2. 树返回顶部 |
1、
<tr> <td class="width-15" class="active"><label class="pull-right"><font color="red">*</font>归属区域:</label></td> <td class="width-35"><sys:treeselect id="area" name="area.id" value="${office.area.id}" labelName="area.name" labelValue="${office.area.name}" title="区域" url="/sys/area/treeData" cssClass="form-control required"/></td> </tr>
1.0、
@RequiresPermissions("user") @ResponseBody @RequestMapping(value = "treeData") public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId, HttpServletResponse response) { List<Map<String, Object>> mapList = Lists.newArrayList(); List<Area> list = areaService.findAll(); for (int i=0; i<list.size(); i++){ Area e = list.get(i); if (StringUtils.isBlank(extId) || (extId!=null && !extId.equals(e.getId()) && e.getParentIds().indexOf(","+extId+",")==-1)){ Map<String, Object> map = Maps.newHashMap(); map.put("id", e.getId()); map.put("pId", e.getParentId()); map.put("name", e.getName()); mapList.add(map); } } return mapList; }
2.1、
<sys:treeselect id="office" name="baseId" value="${office.parent.id}" labelName="parent.name" labelValue="${office.parent.name}" title="机构" url="/sys/office/treeData" extId="${office.id}" cssClass="form-control" allowClear="${office.currentUser.admin}"/>
2.2、
<tr> <td class="width-15 active"><label class="pull-right">上级机构:</label></td> <td class="width-35"><sys:treeselect id="office" name="parent.id" value="${office.parent.id}" labelName="parent.name" labelValue="${office.parent.name}" title="机构" url="/sys/office/treeData" extId="${office.id}" cssClass="form-control" allowClear="${office.currentUser.admin}"/></td> </tr>
2.3、
<tr> <td class="width-15" class="active"><label class="pull-right">主负责人:</label></td> <td class="width-35">
<sys:treeselect id="primaryPerson" name="primaryPerson.id" value="${office.primaryPerson.id}" labelName="office.primaryPerson.name" labelValue="${office.primaryPerson.name}" title="用户" url="/sys/office/treeData?type=3" cssClass="form-control" allowClear="true" notAllowSelectParent="true"/></td> </tr>
2.4、
<tr> <td class="width-15 active"><label class="pull-right">副负责人:</label></td> <td class="width-35">
<sys:treeselect id="deputyPerson" name="deputyPerson.id" value="${office.deputyPerson.id}" labelName="office.deputyPerson.name" labelValue="${office.deputyPerson.name}" title="用户" url="/sys/office/treeData?type=3" cssClass="form-control" allowClear="true" notAllowSelectParent="true"/></td> </tr>
2.0、
/** * 获取机构JSON数据。 * @param extId 排除的ID * @param type 类型(1:公司;2:部门/小组/其它:3:用户) * @param grade 显示级别 * @param response * @return */ @RequiresPermissions("user") @ResponseBody @RequestMapping(value = "treeData") public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId, @RequestParam(required=false) String type, @RequestParam(required=false) Long grade, @RequestParam(required=false) Boolean isAll, HttpServletResponse response) { List<Map<String, Object>> mapList = Lists.newArrayList(); List<Office> list = officeService.findList(isAll); for (int i=0; i<list.size(); i++){ Office e = list.get(i); if ((StringUtils.isBlank(extId) || (extId!=null && !extId.equals(e.getId()) && e.getParentIds().indexOf(","+extId+",")==-1)) && (type == null || (type != null && (type.equals("1") ? type.equals(e.getType()) : true))) && (grade == null || (grade != null && Integer.parseInt(e.getGrade()) <= grade.intValue())) && Global.YES.equals(e.getUseable())){ Map<String, Object> map = Maps.newHashMap(); map.put("id", e.getId()); map.put("pId", e.getParentId()); map.put("pIds", e.getParentIds()); map.put("name", e.getName()); if (type != null && "3".equals(type)){ map.put("isParent", true); } mapList.add(map); } } return mapList; }
6、
3. 下拉框返回顶部 |
1、sys/dicList.jsp
<span>类型:</span> <form:select id="type" path="type" class="input-medium"> <form:option value="" label=""/><form:options items="${typeList}" htmlEscape="false"/> </form:select>
1.0、
@RequiresPermissions("sys:dict:list") @RequestMapping(value = {"list", ""}) public String list(Dict dict, HttpServletRequest request, HttpServletResponse response, Model model) { List<String> typeList = dictService.findTypeList(); model.addAttribute("typeList", typeList); //Page<Dict> page = dictService.findPage(new Page<Dict>(request, response), dict); //model.addAttribute("page", page); return "modules/sys/dictList"; }
1.0.1、
/** * 查询字段类型列表 * @return */ public List<String> findTypeList(){ return dao.findTypeList(new Dict()); }
1.0.2、
/** * 字典DAO接口 * @author * @version 2014-05-16 */ @MyBatisDao public interface DictDao extends CrudDao<Dict> { public List<String> findTypeList(Dict dict); }
2、
4. 树2返回顶部 |
1、
<form id="listForm" method="post"> <table id="treeTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable"> <thead><tr><th><input type="checkbox" class="i-checks"></th><th>名称</th><th>链接</th><th style="text-align:center;">排序</th><th>可见</th><th>权限标识</th><shiro:hasPermission name="sys:menu:edit"><th>操作</th></shiro:hasPermission></tr></thead> <tbody><c:forEach items="${list}" var="menu"> <tr id="${menu.id}" pId="${menu.parent.id ne '1'?menu.parent.id:'0'}"> <td> <input type="checkbox" id="${menu.id}" class="i-checks"></td> <td nowrap><i class="icon-${not empty menu.icon?menu.icon:' hide'}"></i><a href="#" onclick="openDialogView('查看菜单', '${ctx}/sys/menu/form?id=${menu.id}','800px', '500px')">${menu.name}</a></td> <td title="${menu.href}">${fns:abbr(menu.href,30)}</td> <td style="text-align:center;"> <shiro:hasPermission name="sys:menu:updateSort"> <input type="hidden" name="ids" value="${menu.id}"/> <input name="sorts" type="text" value="${menu.sort}" class="form-control" style="100px;margin:0;padding:0;text-align:center;"> </shiro:hasPermission><shiro:lacksPermission name="sys:menu:updateSort"> ${menu.sort} </shiro:lacksPermission> </td> <td>${menu.isShow eq '1'?'显示':'隐藏'}</td> <td title="${menu.permission}">${fns:abbr(menu.permission,30)}</td> <td nowrap> <shiro:hasPermission name="sys:menu:view"> <a href="#" onclick="openDialogView('查看菜单', '${ctx}/sys/menu/form?id=${menu.id}','800px', '500px')" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i> 查看</a> </shiro:hasPermission> <shiro:hasPermission name="sys:menu:edit"> <a href="#" onclick="openDialog('修改菜单', '${ctx}/sys/menu/form?id=${menu.id}','800px', '500px')" class="btn btn-success btn-xs" ><i class="fa fa-edit"></i> 修改</a> </shiro:hasPermission> <shiro:hasPermission name="sys:menu:del"> <a href="${ctx}/sys/menu/delete?id=${menu.id}" onclick="return confirmx('要删除该菜单及所有子菜单项吗?', this.href)" class="btn btn-danger btn-xs" ><i class="fa fa-trash"></i> 删除</a> </shiro:hasPermission> <shiro:hasPermission name="sys:menu:add"> <a href="#" onclick="openDialog('添加下级菜单', '${ctx}/sys/menu/form?parent.id=${menu.id}','800px', '500px')" class="btn btn-primary btn-xs" ><i class="fa fa-plus"></i> 添加下级菜单</a> </shiro:hasPermission> </td> </tr> </c:forEach></tbody> </table> </form>
1.0、
@RequiresPermissions("sys:menu:list") @RequestMapping(value = {"list", ""}) public String list(Model model) { List<Menu> list = Lists.newArrayList(); List<Menu> sourcelist = systemService.findAllMenu(); Menu.sortList(list, sourcelist, Menu.getRootId(), true); model.addAttribute("list", list); return "modules/sys/menuList"; }
1.0.1、
public List<Menu> findAllMenu(){ return UserUtils.getMenuList(); } /** * 获取当前用户授权菜单 * @return */ public static List<Menu> getMenuList(){ @SuppressWarnings("unchecked") List<Menu> menuList = (List<Menu>)getCache(CACHE_MENU_LIST); if (menuList == null){ User user = getUser(); if (user.isAdmin()){ menuList = menuDao.findAllList(new Menu()); }else{ Menu m = new Menu(); m.setUserId(user.getId()); menuList = menuDao.findByUserId(m); } putCache(CACHE_MENU_LIST, menuList); } return menuList; }
1.0.2、
2、
3、
5.返回顶部 |
6.返回顶部 |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |