Commit 044665ec by java-李谡

修改role 名称校验接口

parent 9f6ea048
<%@ page contentType="text/html;charset=UTF-8" %> <%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%> <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html> <html>
<head> <head>
<title>角色管理</title> <title>角色管理</title>
<meta name="decorator" content="default"/> <meta name="decorator" content="default"/>
<%@include file="/WEB-INF/views/include/treeview.jsp" %> <%@include file="/WEB-INF/views/include/treeview.jsp" %>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function () {
// $("#name").focus(); // $("#name").focus();
$("#inputForm").validate({ $("#inputForm").validate({
rules: { rules: {
name: {remote: "${ctx}/sys/role/checkName?oldName=" + encodeURIComponent("${role.name}")}, name: {remote: "${ctx}/sys/role/checkName?oldName=" + encodeURIComponent("${role.name}")},
enname: {remote: "${ctx}/sys/role/checkEnname?oldEnname=" + encodeURIComponent("${role.enname}")} enname: {remote: "${ctx}/sys/role/checkEnname?oldEnName=" + encodeURIComponent("${role.enname}")}
}, },
messages: { messages: {
name: {remote: "角色名已存在"}, name: {remote: "角色名已存在"},
enname: {remote: "英文名已存在"} enname: {remote: "英文名已存在"}
}, },
submitHandler: function(form){ submitHandler: function (form) {
var ids = [], nodes = tree.getCheckedNodes(true); var ids = [], nodes = tree.getCheckedNodes(true);
for(var i=0; i<nodes.length; i++) { for (var i = 0; i < nodes.length; i++) {
ids.push(nodes[i].id); ids.push(nodes[i].id);
} }
$("#menuIds").val(ids); $("#menuIds").val(ids);
var ids2 = [], nodes2 = tree2.getCheckedNodes(true); var ids2 = [], nodes2 = tree2.getCheckedNodes(true);
for(var i=0; i<nodes2.length; i++) { for (var i = 0; i < nodes2.length; i++) {
ids2.push(nodes2[i].id); ids2.push(nodes2[i].id);
} }
$("#officeIds").val(ids2); $("#officeIds").val(ids2);
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
form.submit(); form.submit();
}, },
errorContainer: "#messageBox", errorContainer: "#messageBox",
errorPlacement: function(error, element) { errorPlacement: function (error, element) {
$("#messageBox").text("输入有误,请先更正。"); $("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){ if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
error.appendTo(element.parent().parent()); error.appendTo(element.parent().parent());
} else { } else {
error.insertAfter(element); error.insertAfter(element);
...@@ -42,161 +42,188 @@ ...@@ -42,161 +42,188 @@
} }
}); });
var setting = {check:{enable:true,nocheckInherit:true},view:{selectedMulti:false}, var setting = {
data:{simpleData:{enable:true}},callback:{beforeClick:function(id, node){ check: {enable: true, nocheckInherit: true}, view: {selectedMulti: false},
data: {simpleData: {enable: true}}, callback: {
beforeClick: function (id, node) {
tree.checkNode(node, !node.checked, true, true); tree.checkNode(node, !node.checked, true, true);
return false; return false;
}}}; }
}
};
// 用户-菜单 // 用户-菜单
var zNodes=[ var zNodes = [
<c:forEach items="${menuList}" var="menu">{id:"${menu.id}", pId:"${not empty menu.parent.id?menu.parent.id:0}", name:"${not empty menu.parent.id?menu.name:'权限列表'}"}, <c:forEach items="${menuList}" var="menu">{
</c:forEach>]; id: "${menu.id}",
pId: "${not empty menu.parent.id?menu.parent.id:0}",
name: "${not empty menu.parent.id?menu.name:'权限列表'}"
},
</c:forEach>];
// 初始化树结构 // 初始化树结构
var tree = $.fn.zTree.init($("#menuTree"), setting, zNodes); var tree = $.fn.zTree.init($("#menuTree"), setting, zNodes);
// 不选择父节点 // 不选择父节点
tree.setting.check.chkboxType = { "Y" : "ps", "N" : "s" }; tree.setting.check.chkboxType = {"Y": "ps", "N": "s"};
// 默认选择节点 // 默认选择节点
var ids = "${role.menuIds}".split(","); var ids = "${role.menuIds}".split(",");
for(var i=0; i<ids.length; i++) { for (var i = 0; i < ids.length; i++) {
var node = tree.getNodeByParam("id", ids[i]); var node = tree.getNodeByParam("id", ids[i]);
try{tree.checkNode(node, true, false);}catch(e){} try {
tree.checkNode(node, true, false);
} catch (e) {
}
} }
// 默认展开全部节点 // 默认展开全部节点
tree.expandAll(true); tree.expandAll(true);
// 用户-机构 // 用户-机构
var zNodes2=[ var zNodes2 = [
<c:forEach items="${officeList}" var="office">{id:"${office.id}", pId:"${not empty office.parent?office.parent.id:0}", name:"${office.name}"}, <c:forEach items="${officeList}" var="office">{
</c:forEach>]; id: "${office.id}",
pId: "${not empty office.parent?office.parent.id:0}",
name: "${office.name}"
},
</c:forEach>];
// 初始化树结构 // 初始化树结构
var tree2 = $.fn.zTree.init($("#officeTree"), setting, zNodes2); var tree2 = $.fn.zTree.init($("#officeTree"), setting, zNodes2);
// 不选择父节点 // 不选择父节点
tree2.setting.check.chkboxType = { "Y" : "ps", "N" : "s" }; tree2.setting.check.chkboxType = {"Y": "ps", "N": "s"};
// 默认选择节点 // 默认选择节点
var ids2 = "${role.officeIds}".split(","); var ids2 = "${role.officeIds}".split(",");
for(var i=0; i<ids2.length; i++) { for (var i = 0; i < ids2.length; i++) {
var node = tree2.getNodeByParam("id", ids2[i]); var node = tree2.getNodeByParam("id", ids2[i]);
try{tree2.checkNode(node, true, false);}catch(e){} try {
tree2.checkNode(node, true, false);
} catch (e) {
}
} }
// 默认展开全部节点 // 默认展开全部节点
tree2.expandAll(true); tree2.expandAll(true);
// 刷新(显示/隐藏)机构 // 刷新(显示/隐藏)机构
refreshOfficeTree(); refreshOfficeTree();
$("#dataScope").change(function(){ $("#dataScope").change(function () {
refreshOfficeTree(); refreshOfficeTree();
}); });
}); });
function refreshOfficeTree(){
if($("#dataScope").val()==9){ function refreshOfficeTree() {
if ($("#dataScope").val() == 9) {
$("#officeTree").show(); $("#officeTree").show();
}else{ } else {
$("#officeTree").hide(); $("#officeTree").hide();
} }
} }
</script> </script>
</head> </head>
<body> <body>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li><a href="${ctx}/sys/role/">角色列表</a></li> <li><a href="${ctx}/sys/role/">角色列表</a></li>
<li class="active"><a href="${ctx}/sys/role/form?id=${role.id}">角色<shiro:hasPermission name="sys:role:edit">${not empty role.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:role:edit">查看</shiro:lacksPermission></a></li> <li class="active"><a href="${ctx}/sys/role/form?id=${role.id}">角色<shiro:hasPermission
</ul><br/> name="sys:role:edit">${not empty role.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission
<form:form id="inputForm" modelAttribute="role" action="${ctx}/sys/role/save" method="post" class="form-horizontal"> name="sys:role:edit">查看</shiro:lacksPermission></a></li>
<form:hidden path="id"/> </ul>
<sys:message content="${message}"/> <br/>
<div class="control-group"> <form:form id="inputForm" modelAttribute="role" action="${ctx}/sys/role/save" method="post" class="form-horizontal">
<label class="control-label">归属机构:</label> <form:hidden path="id"/>
<div class="controls"> <sys:message content="${message}"/>
<sys:treeselect id="office" name="office.id" value="${role.office.id}" labelName="office.name" labelValue="${role.office.name}" <div class="control-group">
title="机构" url="/sys/office/treeData" /> <label class="control-label">归属机构:</label>
</div> <div class="controls">
<sys:treeselect id="office" name="office.id" value="${role.office.id}" labelName="office.name"
labelValue="${role.office.name}"
title="机构" url="/sys/office/treeData"/>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">角色名称:</label> <div class="control-group">
<div class="controls"> <label class="control-label">角色名称:</label>
<input id="oldName" name="oldName" type="hidden" value="${role.name}"> <div class="controls">
<form:input path="name" htmlEscape="false" maxlength="50" class="required"/> <input id="oldName" name="oldName" type="hidden" value="${role.name}">
<span class="help-inline"><font color="red">*</font> </span> <form:input path="name" htmlEscape="false" maxlength="50" class="required"/>
</div> <span class="help-inline"><font color="red">*</font> </span>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">英文名称:</label> <div class="control-group">
<div class="controls"> <label class="control-label">英文名称:</label>
<input id="oldEnname" name="oldEnname" type="hidden" value="${role.enname}"> <div class="controls">
<form:input path="enname" htmlEscape="false" maxlength="50" class="required"/> <input id="oldEnname" name="oldEnname" type="hidden" value="${role.enname}">
<span class="help-inline"><font color="red">*</font> 工作流用户组标识</span> <form:input path="enname" htmlEscape="false" maxlength="50" class="required"/>
</div> <span class="help-inline"><font color="red">*</font> 工作流用户组标识</span>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">角色类型:</label> <div class="control-group">
<div class="controls"> <label class="control-label">角色类型:</label>
<div class="controls">
<form:select path="roleKind" class="input-large required" >
<form:option value="" label="请选择" /> <form:select path="roleKind" class="input-large required">
<form:option value="" label="请选择"/>
<form:options items="${fns:getDictList('role_kind')}" <form:options items="${fns:getDictList('role_kind')}"
itemLabel="label" itemValue="value" htmlEscape="false" /> itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select> </form:select>
<%-- <%--
<form:input path="roleType" htmlEscape="false" maxlength="50" class="required"/> <form:input path="roleType" htmlEscape="false" maxlength="50" class="required"/>
<span class="help-inline" title="activiti有3种预定义的组类型:security-role、assignment、user 如果使用Activiti Explorer,需要security-role才能看到manage页签,需要assignment才能claim任务"> <span class="help-inline" title="activiti有3种预定义的组类型:security-role、assignment、user 如果使用Activiti Explorer,需要security-role才能看到manage页签,需要assignment才能claim任务">
工作流组用户组类型(security-role:管理员、assignment:可进行任务分配、user:普通用户)</span> --%> 工作流组用户组类型(security-role:管理员、assignment:可进行任务分配、user:普通用户)</span> --%>
<%-- <form:select path="roleType" class="input-medium"> <%-- <form:select path="roleType" class="input-medium">
<form:option value="assignment">任务分配</form:option> <form:option value="assignment">任务分配</form:option>
<form:option value="security-role">管理角色</form:option> <form:option value="security-role">管理角色</form:option>
<form:option value="user">普通角色</form:option> <form:option value="user">普通角色</form:option>
</form:select> </form:select>
<span class="help-inline" title="activiti有3种预定义的组类型:security-role、assignment、user 如果使用Activiti Explorer,需要security-role才能看到manage页签,需要assignment才能claim任务"> <span class="help-inline" title="activiti有3种预定义的组类型:security-role、assignment、user 如果使用Activiti Explorer,需要security-role才能看到manage页签,需要assignment才能claim任务">
工作流组用户组类型(任务分配:assignment、管理角色:security-role、普通角色:user)</span> --%> 工作流组用户组类型(任务分配:assignment、管理角色:security-role、普通角色:user)</span> --%>
</div>
</div>
<div class="control-group">
<label class="control-label">是否系统数据:</label>
<div class="controls">
<form:select path="sysData">
<form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
<span class="help-inline">“是”代表此数据只有超级管理员能进行修改,“否”则表示拥有角色修改人员的权限都能进行修改</span>
</div>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">是否可用</label> <div class="control-group">
<div class="controls"> <label class="control-label">是否系统数据:</label>
<form:select path="useable"> <div class="controls">
<form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/> <form:select path="sysData">
</form:select> <form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value"
<span class="help-inline">“是”代表此数据可用,“否”则表示此数据不可用</span> htmlEscape="false"/>
</div> </form:select>
<span class="help-inline">“是”代表此数据只有超级管理员能进行修改,“否”则表示拥有角色修改人员的权限都能进行修改</span>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">数据范围:</label> <div class="control-group">
<div class="controls"> <label class="control-label">是否可用</label>
<form:select path="dataScope" class="input-medium"> <div class="controls">
<form:options items="${fns:getDictList('sys_data_scope')}" itemLabel="label" itemValue="value" htmlEscape="false"/> <form:select path="useable">
</form:select> <form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value"
<span class="help-inline">特殊情况下,设置为“按明细设置”,可进行跨机构授权</span> htmlEscape="false"/>
</div> </form:select>
<span class="help-inline">“是”代表此数据可用,“否”则表示此数据不可用</span>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">角色授权:</label> <div class="control-group">
<div class="controls"> <label class="control-label">数据范围:</label>
<div id="menuTree" class="ztree" style="margin-top:3px;float:left;"></div> <div class="controls">
<form:hidden path="menuIds"/> <form:select path="dataScope" class="input-medium">
<div id="officeTree" class="ztree" style="margin-left:100px;margin-top:3px;float:left;"></div> <form:options items="${fns:getDictList('sys_data_scope')}" itemLabel="label" itemValue="value"
<form:hidden path="officeIds"/> htmlEscape="false"/>
</div> </form:select>
<span class="help-inline">特殊情况下,设置为“按明细设置”,可进行跨机构授权</span>
</div> </div>
<div class="control-group"> </div>
<label class="control-label">备注:</label> <div class="control-group">
<div class="controls"> <label class="control-label">角色授权:</label>
<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"/> <div class="controls">
</div> <div id="menuTree" class="ztree" style="margin-top:3px;float:left;"></div>
<form:hidden path="menuIds"/>
<div id="officeTree" class="ztree" style="margin-left:100px;margin-top:3px;float:left;"></div>
<form:hidden path="officeIds"/>
</div> </div>
<div class="form-actions"> </div>
<c:if test="${(role.sysData eq fns:getDictValue('是', 'yes_no', '1') && fns:getUser().admin)||!(role.sysData eq fns:getDictValue('是', 'yes_no', '1'))}"> <div class="control-group">
<shiro:hasPermission name="sys:role:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission> <label class="control-label">备注:</label>
</c:if> <div class="controls">
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/> <form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"/>
</div> </div>
</form:form> </div>
<div class="form-actions">
<c:if test="${(role.sysData eq fns:getDictValue('是', 'yes_no', '1') && fns:getUser().admin)||!(role.sysData eq fns:getDictValue('是', 'yes_no', '1'))}">
<shiro:hasPermission name="sys:role:edit"><input id="btnSubmit" class="btn btn-primary" type="submit"
value="保 存"/>&nbsp;</shiro:hasPermission>
</c:if>
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
</div>
</form:form>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -95,7 +95,7 @@ female.user.default.avatar=/images/user/avatar/female_avatar.png ...@@ -95,7 +95,7 @@ female.user.default.avatar=/images/user/avatar/female_avatar.png
# \u7537\u751F\u5934\u50CF # \u7537\u751F\u5934\u50CF
male.user.default.avatar=/images/user/avatar/male_avatar.png male.user.default.avatar=/images/user/avatar/male_avatar.png
foc.api.url=http://123.56.146.7/ foc.api.url=http://localhost:8080/
foc.sound.records.url=http://218.241.234.135:8080/ab/jsonData/cdrDataPage foc.sound.records.url=http://218.241.234.135:8080/ab/jsonData/cdrDataPage
......
#MySQL Database Config(The All Config Is Must) #MySQL Database Config(The All Config Is Must)
db.table.prefix=foc_ db.table.prefix=foc_
jdbc.type=mysql jdbc.type=mysql
jdbc.driver.class=com.mysql.jdbc.Driver jdbc.driver.class=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://106.75.97.50:3306/jd_foc?useUnicode=true&characterEncoding=utf-8 jdbc.url=jdbc:mysql://106.75.105.96:5508/jd_foc?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username=focuser jdbc.username=sms_develop
jdbc.password=FOC@2016 jdbc.password=Develop2018!@#
#\u521d\u59cb\u5316\u8fde\u63a5
#\u521d\u59cb\u5316\u8fde\u63a5
jdbc.initialSize=0 jdbc.initialSize=0
#\u8fde\u63a5\u6c60\u7684\u6700\u5927\u6d3b\u52a8\u4e2a\u6570 #\u8fde\u63a5\u6c60\u7684\u6700\u5927\u6d3b\u52a8\u4e2a\u6570
jdbc.maxActive=20 jdbc.maxActive=20
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 --> <!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 -->
<setting name="jdbcTypeForNull" value="NULL"/> <setting name="jdbcTypeForNull" value="NULL"/>
<setting name="logImpl" value="STDOUT_LOGGING" /> <!--<setting name="logImpl" value="STDOUT_LOGGING" />-->
</settings> </settings>
......
...@@ -264,16 +264,16 @@ public class RoleController extends BaseController { ...@@ -264,16 +264,16 @@ public class RoleController extends BaseController {
* 验证角色英文名是否有效 * 验证角色英文名是否有效
* *
* @param oldEnName * @param oldEnName
* @param enName * @param enname
* @return * @return
*/ */
@RequiresPermissions("user") @RequiresPermissions("user")
@ResponseBody @ResponseBody
@RequestMapping(value = "checkEnname") @RequestMapping(value = "checkEnname")
public String checkEnName(String oldEnName, String enName) { public String checkEnName(String oldEnName, String enname) {
if (enName != null && enName.equals(oldEnName)) { if (enname != null && enname.equals(oldEnName)) {
return "true"; return "true";
} else if (enName != null && systemService.getRoleByEnname(enName) == null) { } else if (enname != null && systemService.getRoleByEnname(enname) == null) {
return "true"; return "true";
} }
return "false"; return "false";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment