优化业务/系统字典功能,数据类型数量可改变,可任意组合菜单(作用域必须单独),页面自动设定权限,组合菜单时数据类型超过1种,列表页面条件搜索添加数据类型条件。

修订校验时浏览器的兼容问题,
This commit is contained in:
zhangshilin
2018-03-31 17:23:11 +08:00
parent 894661a8b8
commit aa84684b3b
19 changed files with 330 additions and 666 deletions

View File

@@ -4,7 +4,7 @@
<head>
<link rel="stylesheet" type="text/css" href="${ctxStatic}/pages/css/dictInfo.css" />
<script type="text/javascript" src="${ctxStatic}/pages/scripts/dict.js"></script>
<title>配置管理</title>
<title></title>
<script type="text/javascript">
//上级选择数据类型自动改变
function serviceDictInfoTreeselectCallBack(){
@@ -16,10 +16,10 @@
url:'${ctx}/basics/serviceDictInfo/ajaxItemType',
data:{parent:parent},
success:function(data){
$("#itemType option").each(function(){
$(this).attr("selected",false);
});
$("#itemType").find("option[value='"+data+"']").attr("selected",true);
$("#itemTypeCheckChild").val(data);
if(data==0){
$("#itemTypeCheckChild").prop("selectedIndex",0);
}
}
});
@@ -46,51 +46,22 @@
}
$(document).ready(function() {
$("#serviceDictInfoId").on('onchange',errorShow);
//层级校验
/* jQuery.validator.addMethod("isLevelNoSure",function(value,element){
var flagIsLevelNoSure = false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/isLevelTotalSure',
data:{parentId:$(".singleClass").val(),currentId:'${serviceDictInfo.serviceDictId}'},
success:function(data){
flagIsLevelNoSure = data;
}
});
return flagIsLevelNoSure;
},"选择此配置上下层级数将超过最大层级"); */
//类型选择与上级是否冲突
jQuery.validator.addMethod("typeSame",function(value,element){
var flagTypeSame=false;
var parentCondition = $("#serviceDictInfoId").val();
var childCondition = $("#itemTypeCheckChild option:selected").val();
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/ajaxType',
data:{parent:$("#serviceDictInfoId").val(),child:$("#itemTypeCheckChild option:selected").val()},
data:{parent:parentCondition,child:childCondition},
success:function(data){
flagTypeSame=data;
}
});
return flagTypeSame;
},"请选择正确的数据类型");
//校验更改数据类型后校验数据类型是否与下级冲突
jQuery.validator.addMethod("typeChild",function(value,element){
var flagTypeChild=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/ajaxChildrenType',
data:{parent:"${serviceDictInfo.serviceDictId}",newItemType:$("#itemTypeCheckChild option:selected").val()},
success:function(data){
flagTypeChild=data;
}
});
return flagTypeChild;
},"该配置包含下级配置,数据类型更改后上下级类型不一致");
//校验叶子节点有下级不得更改为叶子节点
jQuery.validator.addMethod("leafChange",function(value,element){
var flagLeafChange=false;
@@ -106,33 +77,10 @@
return flagLeafChange;
},"该配置包含下级配置,不得改为叶子节点");
//校验叶子节点无上级不得选为叶子节点
jQuery.validator.addMethod("leafHasTree",function(value,element){
var flagLeafHasTree=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/serviceDictInfo/ajaxLeafHasTree',
data:{serviceDictId:"${serviceDictInfo.serviceDictId}",newIsLeaf:$("#isLeaf option:selected").val(),parentId:$("#serviceDictInfoId").val()},
success:function(data){
flagLeafHasTree=data;
}
});
return flagLeafHasTree;
},"该配置上级为根节点,不得设为叶子节点");
$("#name").focus();
$("#inputForm").validate({
//ignore:[],
//需验证 item_code item_value
rules: {
/* 'parent.itemValue':{
isLevelNoSure:true
}, */
'itemCode':{
//isLevelNoSure:true,
required:true,
remote:'${ctx}/basics/serviceDictInfo/isItemCodeRepeat?oldItemCode=${serviceDictInfo.itemCode}',
maxlength:64
@@ -142,24 +90,19 @@
maxlength:64
},
'itemType':{
typeSame:true,
typeChild:true
remote:'${ctx}/basics/serviceDictInfo/ajaxChildrenType?parent=${serviceDictInfo.serviceDictId}',
typeSame:true
},
'isLeaf':{
leafChange:true
//leafHasTree:true
},
'itemDesc':{
maxlength:128
}
},
messages: {
/* 'parent.itemValue':{
isLevelNoSure:'<spring:message code="isLevelNoSure"/>'
}, */
messages: {
'itemCode':{
//isLevelNoSure:"选择此配置上下层级数将超过四级",
required:'<spring:message code="required"/>',
remote:'<spring:message code="repeat"/>',
maxlength:'<spring:message code="maxlength_64"/>'
@@ -169,12 +112,11 @@
maxlength:'<spring:message code="maxlength_64"/>'
},
'itemType':{
typeSame:'<spring:message code="typeSame"/>',
typeChild:'<spring:message code="typeChild"/>'
remote:'<spring:message code="typeChild"/>',
typeSame:'<spring:message code="typeSame"/>'
},
'isLeaf':{
leafChange:'<spring:message code="leafChange"/>'
//leafHasTree:'该配置上级为根节点,不得设为叶子节点'
},
'itemDesc':{
maxlength:'<spring:message code="maxlength_128"/>'

View File

@@ -2,7 +2,7 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>配置信息</title>
<title></title>
<link href="${ctxStatic}/global/plugins/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
<script src="${ctxStatic}/global/plugins/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/pages/scripts/dict.js" type="text/javascript"></script>
@@ -78,6 +78,7 @@
$("#resetBtn").on("click",function(){
$(".Wdate").attr("value",'');
$("#searchForm")[0].reset();
$("#itemType").val("");
});
//筛选功能初始化
@@ -107,18 +108,16 @@
<c:set var="permission_type">${fns:getPermissionByNo('SERVICE_DICT_ITM_TYPE',intArr)}</c:set>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<button type="button" class="btn btn-default" onclick="javascript:window.location='${ctx}/basics/serviceDictInfo/list?itType=${itType}'"><spring:message code="refresh"></spring:message></button>
<shiro:hasPermission name="basics:${permission_type}:edit">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/basics/serviceDictInfo/form?itType=${itType}'">
<i class="fa fa-plus"></i>
<spring:message code="add"></spring:message>
</button>
</shiro:hasPermission>
<button type="button" class="btn btn-default" onclick="javascript:window.location='${ctx}/basics/serviceDictInfo/list?itType=${itType}'"><spring:message code="refresh"></spring:message></button>
<shiro:hasPermission name="basics:${permission_type}:edit">
<button type="button" class="btn btn-primary" onClick="javascript:window.location='${ctx}/basics/serviceDictInfo/form?itType=${itType}'"><i class="fa fa-plus"></i><spring:message code="add"></spring:message></button>
</shiro:hasPermission>
</div>
<h3 class="page-title">
<spring:message code="${fns:getItemTypeByNo('SERVICE_DICT_ITM_TYPE',intArr)}"/>
<c:forEach items="${fns:getItemTypeByNo('SERVICE_DICT_ITM_TYPE',intArr)}" var="shows">
<spring:message code="${shows}" />
</c:forEach>
<small><spring:message code="date_list"/></small>
</h3>
@@ -139,6 +138,23 @@
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<c:if test="${intArr.size()>1}">
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<form:select path="itemType" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="item_type"/></form:option>
<c:forEach items="${fns:getDictList('SERVICE_DICT_ITM_TYPE')}" var="dict">
<c:forEach items="${intArr}" var="itTemp">
<c:if test="${dict.itemCode eq itTemp}">
<form:option value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/></form:option>
</c:if>
</c:forEach>
</c:forEach>
</form:select>
</div></div>
</div>
</c:if>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
@@ -169,8 +185,6 @@
<i class="fa fa-trash"></i><spring:message code="delete" /></button>
</shiro:hasPermission>
<a class="btn btn-icon-only btn-default setfields tooltips"
data-container="body" data-placement="top" data-original-title="<spring:message code="custom_columns" />" href="javascript:;">
<i class="icon-wrench"></i>

View File

@@ -16,57 +16,31 @@
url:'${ctx}/basics/sysDictInfo/ajaxItemType',
data:{parent:parent},
success:function(data){
$("#itemType option").each(function(){
$(this).attr("selected",false);
});
$("#itemType").find("option[value='"+data+"']").attr("selected",true);
$("#itemType").val(data);
if(data==0){
$("#itemType").prop("selectedIndex",0);
}
}
});
}
$(document).ready(function() {
//类型选择与上级是否冲突
jQuery.validator.addMethod("typeSame",function(value,element){
var parentCondition = $("#sysDictInfoId").val();
var childCondition = $("#itemType option:selected").val();
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxType',
data:{parent:$("#sysDictInfoId").val(),child:$("#itemType option:selected").val()},
data:{parent:parentCondition,child:childCondition},
success:function(data){
flag=data;
}
});
return flag;
},"请选择正确的数据类型");
//选择此配置上下层级数将超过四级
jQuery.validator.addMethod("isLevelNoSure",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/isLevelTotalSure',
data:{parentId:$(".singleClass").val(),currentId:'${sysDictInfo.sysDictId}'},
success:function(data){
flag=data;
}
});
return flag;
},"选择此配置上下层级数将超过最大层级");
//校验更改数据类型后校验数据类型是否与下级冲突
jQuery.validator.addMethod("typeChild",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxChildrenType',
data:{parent:"${sysDictInfo.sysDictId}",newItemType:$("#itemType option:selected").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置包含下级配置,数据类型更改后上下级类型不一致");
//校验叶子节点有下级不得更改为叶子节点
jQuery.validator.addMethod("leafChange",function(value,element){
var flag=false;
@@ -82,30 +56,9 @@
return flag;
},"该配置包含下级配置,不得改为叶子节点");
//校验叶子节点无上级不得选为叶子节点
jQuery.validator.addMethod("leafHasTree",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxLeafHasTree',
data:{sysDictId:"${sysDictInfo.sysDictId}",newIsLeaf:$("#isLeaf option:selected").val(),parentId:$("#sysDictInfoId").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置上级为根节点,不得设为叶子节点");
$("#name").focus();
$("#inputForm").validate({
//需验证 item_code item_value
rules: {
'parent.itemValue':{
isLevelNoSure:true
},
'itemCode':{
required:true,
remote:'${ctx}/basics/sysDictInfo/isItemCodeRepeat?oldItemCode=${sysDictInfo.itemCode}',
@@ -116,12 +69,11 @@
maxlength:64
},
'itemType':{
typeSame:true,
typeChild:true
remote:'${ctx}/basics/sysDictInfo/ajaxChildrenType?parent=${sysDictInfo.sysDictId}',
typeSame:true
},
'isLeaf':{
leafChange:true
//leafHasTree:true
},
'itemDesc':{
maxlength:128
@@ -129,9 +81,6 @@
},
messages: {
'parent.itemValue':{
isLevelNoSure:'<spring:message code="isLevelNoSure"/>'
},
'itemCode':{
required:'<spring:message code="required"/>',
remote:'<spring:message code="repeat"/>',
@@ -142,12 +91,11 @@
maxlength:'<spring:message code="maxlength_64"/>'
},
'itemType':{
typeSame:'<spring:message code="typeSame"/>',
typeChild:'<spring:message code="typeChild"/>'
remote:'<spring:message code="typeChild"/>',
typeSame:'<spring:message code="typeSame"/>'
},
'isLeaf':{
leafChange:'<spring:message code="leafChange"/>'
//leafHasTree:'该配置上级为根节点,不得设为叶子节点'
},
'itemDesc':{
maxlength:'<spring:message code="maxlength_128"/>'
@@ -185,7 +133,7 @@
<h3 class="page-title">
<spring:message code="effect_range"/>
<spring:message code="configuration_manage"/>
</h3>
<div class="row">
@@ -211,7 +159,7 @@
<form:form id="inputForm" modelAttribute="sysDictInfo" action="${ctx}/basics/sysDictInfo/saveOrUpdate?itType=${itType}" method="post" class="form-horizontal">
<form:hidden path="sysDictId"/>
<sys:message content="${message}"/>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<div class="form-group">
<label class="col-md-3 control-label"><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
@@ -250,7 +198,7 @@
<c:if test="${specType != null and specType==3 }">
<form:hidden path="isLeaf" value="1"/>
</c:if>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3}">
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">

View File

@@ -38,7 +38,7 @@
<form:form id="inputForm" modelAttribute="sysDictInfo" action="${ctx}/basics/sysDictInfo/saveOrUpdate" method="post" class="form-horizontal">
<form:hidden path="sysDictId"/>
<sys:message content="${message}"/>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
@@ -71,7 +71,7 @@
<input value="${sysDictInfo.itemValue}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">

View File

@@ -2,7 +2,7 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>配置信息</title>
<title></title>
<link href="${ctxStatic}/global/plugins/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
<script src="${ctxStatic}/global/plugins/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/pages/scripts/dict.js" type="text/javascript"></script>
@@ -81,6 +81,7 @@
$("#resetBtn").on("click",function(){
$(".Wdate").attr("value",'');
$("#searchForm")[0].reset();
$("#itemType").val("");
});
//筛选功能初始化
@@ -119,7 +120,9 @@
</div>
<h3 class="page-title">
<spring:message code="${fns:getItemTypeByNo('SYS_DICT_ITM_TYPE',intArr)}"/>
<c:forEach items="${fns:getItemTypeByNo('SYS_DICT_ITM_TYPE',intArr)}" var="shows">
<spring:message code="${shows}" />
</c:forEach>
<small><spring:message code="date_list"/></small>
</h3>
@@ -140,6 +143,26 @@
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<c:if test="${intArr.size()>1}">
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<form:select path="itemType" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="item_type"/></form:option>
<c:forEach items="${fns:getDictList('SYS_DICT_ITM_TYPE')}" var="dict">
<c:forEach items="${intArr}" var="itTemp">
<c:if test="${dict.itemCode eq itTemp}">
<form:option value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/></form:option>
</c:if>
</c:forEach>
</c:forEach>
</form:select>
</div></div>
</div>
</c:if>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
@@ -166,11 +189,13 @@
<i class="fa fa-edit"></i> <spring:message code="edit"/> </button>
<button type="button" class="btn btn-default" onclick="cmd('${ctx}/basics/sysDictInfo/delete?itType=${itType}')">
<i class="fa fa-trash"></i> <spring:message code="delete"/> </button>
</shiro:hasPermission>
<a class="btn btn-icon-only btn-default setfields tooltips"
data-container="body" data-placement="top" data-original-title="<spring:message code="custom_columns" />" href="javascript:;">
<i class="icon-wrench"></i>
</a>
</shiro:hasPermission>
</div>
</div>
<!-- /搜索内容与操作按钮栏-->
@@ -257,7 +282,7 @@
<th><spring:message code="config_content"/></th>
<th><spring:message code="desc"/></th>
<th><spring:message code="item_type"/></th>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<th><spring:message code="is_leaf"/></th>
</c:if>
<th><spring:message code="creator"/></th>
@@ -276,7 +301,7 @@
<td>${sysDictInfo.itemValue}</td>
<td title="${sysDictInfo.itemDesc}">${fns:abbr(sysDictInfo.itemDesc,15)}</td>
<td><spring:message code='${fns:getDictLabel("SYS_DICT_ITM_TYPE",sysDictInfo.itemType,"0")}'/></td>
<c:if test="${specType != null and specType!=3 }">
<c:if test="${specType == null or specType!=3 }">
<td><spring:message code='${fns:getDictLabel("INT_YES_NO",sysDictInfo.isLeaf,"0")}'/></td>
</c:if>
<td><c:if test="${sysDictInfo.sysDictCreator != null}">

View File

@@ -43,7 +43,7 @@
if(mulitId!=""){
confirmx("<spring:message code='confirm_message'/>", url+"?mulitId="+mulitId);
}else{
alert("<spring:message code='one_more'/>");
top.$.jBox.tip("<spring:message code='check_one'/>", "<spring:message code='info'/>");
}
}
//修改

View File

@@ -226,10 +226,7 @@ function selectP(){
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>
<shiro:hasPermission name="sys:menu:edit">${not empty specificServiceHostCfg.hostId?'修改':'添加'}</shiro:hasPermission>
<shiro:lacksPermission name="sys:menu:edit">
<spring:message code="show" />
</shiro:lacksPermission>
<c:if test="${not empty specificServiceHostCfg.hostId}"><spring:message code='edit'/></c:if><c:if test="${empty specificServiceHostCfg.hostId}"><spring:message code='add'/></c:if></div>
</div>
<div class="tools"></div>
</div>