From 85453f777f3c4a4dba24c747eb1ee94bfc863e26 Mon Sep 17 00:00:00 2001 From: zhangshilin Date: Sun, 11 Mar 2018 15:28:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0checkbox=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0checkbox=E5=85=A8=E9=83=A8=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=A4=84=E7=90=86=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=E5=AD=97=E5=85=B8=E7=BA=A7=E5=88=AB=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=86=99=E5=85=A5=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E8=B6=85=E8=BF=87=E9=85=8D=E7=BD=AE=E7=BA=A7?= =?UTF-8?q?=E5=88=AB=E5=B0=86=E4=B8=8D=E8=83=BD=E6=B7=BB=E5=8A=A0=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basics/ServiceDictInfoController.java | 7 ++-- .../basics/SysDictInfoController.java | 7 ++-- src/main/resources/nis.properties | 2 ++ .../WEB-INF/views/basics/serviceDictForm.jsp | 31 +++++++---------- .../WEB-INF/views/basics/serviceDictInfo.jsp | 6 ++-- .../basics/serviceDictInfoSearchList.jsp | 26 +++++++++++++-- .../WEB-INF/views/basics/serviceDictList.jsp | 28 ++++++++++++++-- .../WEB-INF/views/basics/sysDictForm.jsp | 21 ++++++++++++ .../WEB-INF/views/basics/sysDictInfo.jsp | 6 ++-- .../views/basics/sysDictInfoSearchList.jsp | 32 +++++++++++++++--- .../WEB-INF/views/basics/sysDictList.jsp | 33 +++++++++++++++++-- 11 files changed, 157 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java b/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java index d393afa09..ce2996319 100644 --- a/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java +++ b/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java @@ -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():
- + title="菜单" url="/basics/serviceDictInfo/treeData?itType=${itType}" extId="${serviceDictInfo.serviceDictId}" cssClass="required form-control"/>
diff --git a/src/main/webapp/WEB-INF/views/basics/serviceDictInfo.jsp b/src/main/webapp/WEB-INF/views/basics/serviceDictInfo.jsp index 6547b801f..892e5d61c 100644 --- a/src/main/webapp/WEB-INF/views/basics/serviceDictInfo.jsp +++ b/src/main/webapp/WEB-INF/views/basics/serviceDictInfo.jsp @@ -44,12 +44,12 @@
-
+ <%--
-
+
--%>
@@ -71,7 +71,7 @@
- +
<%--
diff --git a/src/main/webapp/WEB-INF/views/basics/serviceDictInfoSearchList.jsp b/src/main/webapp/WEB-INF/views/basics/serviceDictInfoSearchList.jsp index 3a2bd690a..373ef10b6 100644 --- a/src/main/webapp/WEB-INF/views/basics/serviceDictInfoSearchList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/serviceDictInfoSearchList.jsp @@ -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 @@ - + diff --git a/src/main/webapp/WEB-INF/views/basics/serviceDictList.jsp b/src/main/webapp/WEB-INF/views/basics/serviceDictList.jsp index f6c5782fb..963a86e02 100644 --- a/src/main/webapp/WEB-INF/views/basics/serviceDictList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/serviceDictList.jsp @@ -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 @@
序号
- + diff --git a/src/main/webapp/WEB-INF/views/basics/sysDictForm.jsp b/src/main/webapp/WEB-INF/views/basics/sysDictForm.jsp index fd57ec000..1ebeb0a8e 100644 --- a/src/main/webapp/WEB-INF/views/basics/sysDictForm.jsp +++ b/src/main/webapp/WEB-INF/views/basics/sysDictForm.jsp @@ -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:'该配置编码已存在' diff --git a/src/main/webapp/WEB-INF/views/basics/sysDictInfo.jsp b/src/main/webapp/WEB-INF/views/basics/sysDictInfo.jsp index 185a8fb13..96013f688 100644 --- a/src/main/webapp/WEB-INF/views/basics/sysDictInfo.jsp +++ b/src/main/webapp/WEB-INF/views/basics/sysDictInfo.jsp @@ -44,12 +44,12 @@ -
+ <%--
-
+
--%>
@@ -71,7 +71,7 @@
- +
<%--
diff --git a/src/main/webapp/WEB-INF/views/basics/sysDictInfoSearchList.jsp b/src/main/webapp/WEB-INF/views/basics/sysDictInfoSearchList.jsp index 1b7f5d14a..1d7e49a20 100644 --- a/src/main/webapp/WEB-INF/views/basics/sysDictInfoSearchList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/sysDictInfoSearchList.jsp @@ -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 @@
序号
- + diff --git a/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp b/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp index e8e5aee00..8812ec2a7 100644 --- a/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp @@ -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(); + });
序号