添加checkbox选择处理配置功能,

添加checkbox全部选择处理配置功能
字典级别配置参数写入配置文件,超过配置级别将不能添加;
This commit is contained in:
zhangshilin
2018-03-11 15:28:36 +08:00
parent bdea050447
commit 85453f777f
11 changed files with 157 additions and 42 deletions

View File

@@ -21,6 +21,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -437,17 +438,19 @@ public class ServiceDictInfoController extends BaseController {
@ResponseBody
@RequestMapping(value = "isLevelTotalSure")
public boolean isLevelTotalSure(Integer parentId,Integer currentId) {
//获取层级配置
int max = Integer.valueOf(Configurations.getIntProperty("maxLevelNo", 4));
if(parentId==-1||parentId==0){
return true;
}else{
ServiceDictInfo p = serviceDictInfoService.getDictById(parentId);
if(currentId==null){
if(p.getLevelNo()<4){
if(p.getLevelNo()<max){
return true;
}
}else{
ServiceDictInfo c = serviceDictInfoService.getDictById(currentId);
if((p.getLevelNo()+c.getLevelNo())<5){
if((p.getLevelNo()+c.getLevelNo())<(max+1)){
return true;
}
}

View File

@@ -20,6 +20,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.SysDictInfo;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -454,17 +455,19 @@ public class SysDictInfoController extends BaseController {
@ResponseBody
@RequestMapping(value = "isLevelTotalSure")
public boolean isLevelTotalSure(Integer parentId,Integer currentId) {
//获取层级配置
int max = Integer.valueOf(Configurations.getIntProperty("maxLevelNo", 4));
if(parentId==-1||parentId==0){
return true;
}else{
SysDictInfo p = sysDictInfoService.getDictById(parentId);
if(currentId==null){
if(p.getLevelNo()<4){
if(p.getLevelNo()<max){
return true;
}
}else{
SysDictInfo c = sysDictInfoService.getDictById(currentId);
if((p.getLevelNo()+c.getLevelNo())<5){
if((p.getLevelNo()+c.getLevelNo())<(max+1)){
return true;
}
}

View File

@@ -235,3 +235,5 @@ jdbc.hive.AName=xa_dfbhit_hive
jdbc.hive.BName=xa_z2_mesalog_hive
maxPageSize=100000
maxLevelNo=4

View File

@@ -27,27 +27,23 @@
}
$(document).ready(function() {
//层级校验
jQuery.validator.addMethod("isLevelNoSure",function(value,element){
//var flagIsLevelNoSure = true;
var flagIsLevelNoSure = false;
$.ajax({
type:'post',
async:true,
async:false,
cache:false,
url:'${ctx}/basics/serviceDictInfo/isLevelTotalSure',
data:{parentId:$(".singleClass").val(),currentId:'${serviceDictInfo.serviceDictId}'},
success:function(data){
/* flagIsLevelNoSure=data;
alert(flagIsLevelNoSure);
return flagIsLevelNoSure; */
flagIsLevelNoSure = data;
return flagIsLevelNoSure;
}
});
/* alert(flagIsLevelNoSure);
return flagIsLevelNoSure; */
return flagIsLevelNoSure;
},"选择此配置上下层级数将超过级");
},"选择此配置上下层级数将超过最大层级");
//类型选择与上级是否冲突
jQuery.validator.addMethod("typeSame",function(value,element){
@@ -113,10 +109,9 @@
//ignore:[],
//需验证 item_code item_value
rules: {
/* 'jafrkwajrow':{
isLevelNoSure:true
//remote:'${ctx}/basics/serviceDictInfo/isLevelTotalSure?parentId='+$(".singleClass").val()+'&currentId=${serviceDictInfo.serviceDictId}'
}, */
'parent.itemValue':{
isLevelNoSure:true
},
'itemCode':{
//isLevelNoSure:true,
@@ -137,10 +132,9 @@
},
messages: {
/* 'jafrkwajrow':{
//remote:"选择此配置上下层级数将超过级"
isLevelNoSure:"选择此配置上下层级数将超过四级"
}, */
'parent.itemValue':{
isLevelNoSure:"选择此配置上下层级数将超过最大层级"
},
'itemCode':{
//isLevelNoSure:"选择此配置上下层级数将超过四级",
required:'请填写配置编码',
@@ -219,8 +213,7 @@
<label class="col-md-3 control-label"><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
<sys:treeselect id="serviceDictInfo" name="parent.serviceDictId" value="${serviceDictInfo.parent.serviceDictId}" labelName="parent.itemValue" labelValue="${serviceDictInfo.parent.itemValue eq '根节点'?'根节点':fns:getServiceDictInfoById(serviceDictInfo.parent.serviceDictId).itemValue}"
title="菜单" url="/basics/serviceDictInfo/treeData?itType=${itType}" extId="${serviceDictInfo.serviceDictId}" cssClass="required form-control"/>
<input style="width:50px;height:20px;" name="jafrkwajrow" />
title="菜单" url="/basics/serviceDictInfo/treeData?itType=${itType}" extId="${serviceDictInfo.serviceDictId}" cssClass="required form-control"/>
</div>
</div>
<div class="form-group">

View File

@@ -44,12 +44,12 @@
<input value="${serviceDictInfo.parent.serviceDictId == 0?'根节点':fns:getServiceDictInfoById(serviceDictInfo.parent.serviceDictId).itemValue}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
<div class="form-group">
<%-- <div class="form-group">
<label class="col-md-3 control-label radio-lable"><font color="red">*</font> 配置ID:</label>
<div class="col-md-4">
<input value="${serviceDictInfo.serviceDictId}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
</div> --%>
<div class="form-group">
<label class="col-md-3 control-label radio-lable"><font color="red">*</font> <spring:message code="item_type"/>:</label>
<div class="col-md-4">
@@ -71,7 +71,7 @@
<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">
<input value="${fns:getDictLabel('SYS_YES_NO',serviceDictInfo.isValid,'0')}" maxlength="50" class="form-control" readonly="readonly"/>
<input value="${fns:getDictLabel('SYS_YES_NO',serviceDictInfo.isLeaf,'0')}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
<%-- <div class="form-group">

View File

@@ -11,6 +11,28 @@
function reset(){
$("#searchForm").reset();
}
/**
处理全选、全取消
**/
function selectAll(){
//alert($("#selAll").prop("checked"));
if($("#selAll").prop("checked")){
//$("#treeTable").find(":checkbox[name='check']").attr("checked","checked");
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
$(this).prop("checked",true);
});
}else{
//$("#treeTable").find(":checkbox[name='check']").attr("checked",false);
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
//$(this).attr("checked",false);
$(this).removeProp("checked");
});
}
}
/*
系统通用方法根据参数来决定处理的url和参数
*/
@@ -51,7 +73,7 @@
$("#seltype").find("option[value=${searchType==null?11:searchType}]").attr("selected",true);
$("#intype").attr("name",$("#seltype").find("option:selected").val());
$("#intype").val(${searchContent});
$("#intype").val('${searchContent}');
//筛选功能初始化
@@ -228,7 +250,7 @@
<table id="treeTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th><input type="checkbox" class="ckboxs"></th>
<th><input type="checkbox" class="ckboxs" id="selAll" onclick="selectAll()"></th>
<th>序号</th>
<th><spring:message code="item_code"/></th>
<th><spring:message code="config_content"/></th>

View File

@@ -11,6 +11,28 @@
function reset(){
$("#searchForm").reset();
}
/**
处理全选、全取消
**/
function selectAll(){
//alert($("#selAll").prop("checked"));
if($("#selAll").prop("checked")){
//$("#treeTable").find(":checkbox[name='check']").attr("checked","checked");
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
$(this).prop("checked",true);
});
}else{
//$("#treeTable").find(":checkbox[name='check']").attr("checked",false);
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
//$(this).attr("checked",false);
$(this).removeProp("checked");
});
}
}
/*
系统通用方法根据参数来决定处理的url和参数
*/
@@ -51,9 +73,9 @@
//$("#showTotalCount").text();
//设定selected设定name 设定value
$("#seltype").find("option[value='"+${searchType==null?"11":searchType}+"']").attr("selected",true);
$("#seltype").find("option[value='${searchType==null?11:searchType}']").attr("selected",true);
$("#intype").attr("name",$("#seltype").find("option:selected").val());
$("#intype").val(${serviceDictInfo.itemValue});
$("#intype").val('${searchContent}');
//筛选功能初始化
@@ -230,7 +252,7 @@
<table id="treeTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th><input type="checkbox" class="ckboxs"></th>
<th><input type="checkbox" class="ckboxs" id="selAll" onclick="selectAll()"></th>
<th>序号</th>
<th><spring:message code="item_code"/></th>
<th><spring:message code="config_content"/></th>

View File

@@ -38,6 +38,21 @@
});
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;
@@ -88,6 +103,9 @@
$("#inputForm").validate({
//需验证 item_code item_value
rules: {
'parent.itemValue':{
isLevelNoSure:true
},
'itemCode':{
required:true,
remote:'${ctx}/basics/sysDictInfo/isItemCodeRepeat?oldItemCode=${sysDictInfo.itemCode}'
@@ -106,6 +124,9 @@
},
messages: {
'parent.itemValue':{
isLevelNoSure:"选择此配置上下层级数将超过最大层级"
},
'itemCode':{
required:'请填写配置编码',
remote:'该配置编码已存在'

View File

@@ -44,12 +44,12 @@
<input value="${sysDictInfo.parent.sysDictId == 0?'根节点':fns:getSysDictInfoById(sysDictInfo.parent.sysDictId).itemValue}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
<div class="form-group">
<%-- <div class="form-group">
<label class="col-md-3 control-label radio-lable"><font color="red">*</font> 配置ID:</label>
<div class="col-md-4">
<input value="${sysDictInfo.sysDictId}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
</div> --%>
<div class="form-group">
<label class="col-md-3 control-label radio-lable"><font color="red">*</font> <spring:message code="item_type"/>:</label>
<div class="col-md-4">
@@ -71,7 +71,7 @@
<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">
<input value="${fns:getDictLabel('SYS_YES_NO',sysDictInfo.isValid,'0')}" maxlength="50" class="form-control" readonly="readonly"/>
<input value="${fns:getDictLabel('SYS_YES_NO',sysDictInfo.isLeaf,'0')}" maxlength="50" class="form-control" readonly="readonly"/>
</div>
</div>
<%-- <div class="form-group">

View File

@@ -11,6 +11,28 @@
function reset(){
$("#searchForm").reset();
}
/**
处理全选、全取消
**/
function selectAll(){
//alert($("#selAll").prop("checked"));
if($("#selAll").prop("checked")){
//$("#treeTable").find(":checkbox[name='check']").attr("checked","checked");
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
$(this).prop("checked",true);
});
}else{
//$("#treeTable").find(":checkbox[name='check']").attr("checked",false);
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
//$(this).attr("checked",false);
$(this).removeProp("checked");
});
}
}
/*
系统通用方法根据参数来决定处理的url和参数
*/
@@ -31,7 +53,7 @@
//查询
function page(n,s){
$("#intype").attr("name",$("#seltype").val());
//$("#intype").attr("name",$("#seltype").val());
$("#pageNo").val(n);
$("#pageSize").val(s);
$("#searchForm").attr("action","${ctx}/basics/sysDictInfo/searchList?itType=${itType}");
@@ -39,7 +61,7 @@
return false;
}
function page2(n,s){
$("#intype").attr("name",$("#seltype").val());
//$("#intype").attr("name",$("#seltype").val());
$("#pageNo").val(n);
$("#pageSize").val(s);
$("#searchForm").attr("action","${ctx}/basics/sysDictInfo/searchList?itType=${itType}");
@@ -51,9 +73,9 @@
//$("#showTotalCount").text();
//设定selected设定name 设定value
$("#seltype").find("option[value='"+${searchType==null?"11":searchType}+"']").attr("selected",true);
$("#seltype").find("option[value=${searchType==null?11:searchType}]").attr("selected",true);
$("#intype").attr("name",$("#seltype").find("option:selected").val());
$("#intype").val(${sysDictInfo.itemValue});
$("#intype").val('${searchContent}');
//筛选功能初始化
@@ -228,7 +250,7 @@
<table id="treeTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th><input type="checkbox" class="ckboxs"></th>
<th><input type="checkbox" class="ckboxs" id="selAll" onclick="selectAll()"></th>
<th>序号</th>
<th><spring:message code="item_code"/></th>
<th><spring:message code="config_content"/></th>

View File

@@ -11,6 +11,32 @@
function reset(){
$("#searchForm").reset();
}
/**
处理全选、全取消
**/
function selectAll(){
//alert($("#selAll").prop("checked"));
if($("#selAll").prop("checked")){
//$("#treeTable").find(":checkbox[name='check']").attr("checked","checked");
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
$(this).prop("checked",true);
});
}else{
//$("#treeTable").find(":checkbox[name='check']").attr("checked",false);
//$("#treeTable").find(":checkbox[name='check']").each(function(){
$("input[name='check']:checkbox").each(function(){
//$(this).attr("checked",false);
$(this).removeProp("checked");
});
}
}
/*
系统通用方法根据参数来决定处理的url和参数
*/
@@ -51,9 +77,9 @@
//$("#showTotalCount").text();
//设定selected设定name 设定value
$("#seltype").find("option[value='"+${searchType==null?"11":searchType}+"']").attr("selected",true);
$("#seltype").find("option[value='${searchType==null?11:searchType}']").attr("selected",true);
$("#intype").attr("name",$("#seltype").find("option:selected").val());
$("#intype").val(${sysDictInfo.itemValue});
$("#intype").val('${sysDictInfo.itemValue}');
//筛选功能初始化
@@ -69,6 +95,7 @@
$("#intype").attr("name",$(this).find("option:selected").val());
});
$("#treeTable").treeTable({expandLevel : 3}).show();
});
</script>
<style type="text/css">
@@ -228,7 +255,7 @@
<table id="treeTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th><input type="checkbox" class="ckboxs"></th>
<th><input type="checkbox" id="selAll" class="ckboxs" onclick="selectAll()"></th>
<th>序号</th>
<th><spring:message code="item_code"/></th>
<th><spring:message code="config_content"/></th>