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="width: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/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

最新文章

  1. 图像分割实验:FCN数据集制作,网络模型定义,网络训练(提供数据集和模型文件,以供参考)
  2. 【原】搭建Samba的简要过程
  3. POJ 1269 Intersecting Lines【判断直线相交】
  4. SQLite多线程读写实践及常见问题总结
  5. Guzzle Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
  6. QT/C++ 智能指针
  7. shell入门之流程控制语句 分类: 学习笔记 linux ubuntu 2015-07-10 16:38 89人阅读 评论(0) 收藏
  8. 利用正则表达式,给Json字段加引号
  9. Hadoop-2.7.1集群环境搭建
  10. c++实现精确计时
  11. HGE引擎 - 绘制,声音,碰撞处理
  12. 查看mysql状态常用命令
  13. c#拷贝
  14. Openjudge-NOI题库-蛇形填充数组
  15. MyBatis-plus 代码自动生成器
  16. JVM内存模型你只要看这一篇就够了
  17. FreeMarker基础语法,宏,引用 等
  18. 样本失衡会对SVM的影响
  19. HTTP 协议报文解析
  20. AspectJ框架基于注解的AOP实现

热门文章

  1. [Linux]正则表达式和grep使用【转载】
  2. blog笔录1
  3. 04JavaScript程序语句
  4. 【Hadoop】二、HDFS文件读写流程
  5. Spring学习开发之路——使用JavaBean代替EJB
  6. Android 7.0系统代码调用安装apk时报错FileUriExposedException完美解决
  7. STL源码分析之第二级配置器
  8. css--小白入门篇6(终)
  9. * screen recording on Ubuntu
  10. F - Shooter