jeesite-3

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ITlyng/article/details/78995594

这一篇,来介绍一下jeesite内置组件的应用:

1.布局组件

布局文件配置:

/jeesite/src/main/webapp/WEB-INF/decorators.xml

默认布局文件:

/ jeesite/src/main/webapp/WEB-INF/views/layouts/default.jsp

使用布局文件:

JSP的head里添加:<meta name="decorator" content="default"/>

2.用户工具: UserUtils.java fns.tld

获取当前用户:

UserUtils.getUser()

entity.currentUser()

${fns:getUser()}

获取当前用户部门:

UserUtils.getOfficeList()

${fns:getOfficeList()}

获取当前用户区域:

UserUtils.getAreaList()

${fns:getAreaList()}

获取当前用户菜单:

UserUtils.getMenuList()

${fns:getMenuList()}

获取当前用户缓存:

UserUtils.getCache(key)

${fns:getCache(cacheName,defaultName)}

设置当前用户缓存:

UserUtils.putCache(key)

3.字典工具和缓存工具: DictUtils CacheUtils

根据类型获取字典列表(下拉框,复选框,单选框):

DictUtils.getDictList(type)

${fns:getDictList(type)}

根据类型和标签获取字典值:

DictUtils.getDictValue(label,type,defaultValue)

${fns:getDictValue(label,type,defaulstValue)}

根据类型和值获取字典标签:

DictUtils.getDictLabel(value,type,defaultValue)

${getDictLabel(value,type,defaulstValue)}

设置全局缓存:

CacheUtils.put(key,value)

获取全局缓存:

CacheUtils.get(key)

4.功能权限控制(访问,查看,编辑,导入,审核等)

1.菜单中设置权限标志;

2.在方法上添加权限标志:

@RequiresPermissions("sys:submodule:user:view")

或者@RequiresUser

3.视图中控制按钮:(shiro.tld)

<shiro:hasPermissionname="sys:user:edit">...</shiro:hasPermission>

<shiro:hasAnyPermissionname="sys:user:edit">...</shiro:hasAnyPermission>

5.数据权限控制(公司及子公司,本公司,部门及子部门,本部门,当前用户,明细设置)

1.调用dataScopeFilter方法,具体见下图

参数解释:@param user 当前用户对象,通过“entity.getCurrentUser()”获取

@param officeAlias 机构表别名,多个用“,”逗号隔开。

@param userAlias 用户表别名,多个用“,”逗号隔开,传递空,忽略此参数

2.在xml中,使用${sqlMap.dsf}调用权限sql,见下图:


6.智能分页组件:

7.树组件(机构树,区域树,人员树)treeselect.tag

区域

<tags:treeselect id="area"name="area.id" value="${area.id}" labelName="area.name"labelValue="${area.name}" title="区域" url="/sys/area/treeData"cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>

部门

<tags:treeselectid="office" name="office.id"value="${user.office.id}" labelName="office.name"labelValue="${user.office.name}" title="部门" url="/sys/office/treeData?type=1"cssClass="input-small" allowClear="true"notAllowSelectParent="true"/>

人员

<tags:treeselectid="user" name="user.id" value="${user.id}"labelName="user.name" labelValue="${user.name}" title="用户" url="/sys/office/treeData?type=3"cssClass="input-small" allowClear="true"notAllowSelectParent="true"/>

多选需要加checked="true"属性

8.文件上传组件(ckfinder)

<form:hidden path="name"htmlEscape="false" maxlength="255"class="input-xlarge"/>

<tags:ckfinder input="name"type="files" uploadPath="/test "/>

9.富文本编辑器组件(ckeditor)

<form:textarea id="name"htmlEscape="true" path="name" rows="4"maxlength="200" class="input-xxlarge"/> <tags:ckeditor replace="name"uploadPath="/test " />


猜你喜欢

转载自blog.csdn.net/ITlyng/article/details/78995594