From 76b7122c215b92d8339a79be46e01203bbae38e6 Mon Sep 17 00:00:00 2001 From: wangxin Date: Wed, 25 Jul 2018 15:19:24 +0800 Subject: [PATCH] =?UTF-8?q?(1)=E4=BF=AE=E5=A4=8D=E7=89=B9=E5=AE=9A?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=96=B0=E5=A2=9E=E6=97=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=B8=8A=E7=BA=A7=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?bug=20(2)=E7=89=B9=E5=AE=9A=E6=9C=8D=E5=8A=A1=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=EF=BC=8C=E5=BD=93=E5=89=8D=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E7=B1=BB=E5=9E=8B=E5=BA=94=E5=BD=93?= =?UTF-8?q?=E4=B8=8E=E4=B8=8A=E7=BA=A7=E9=85=8D=E7=BD=AE=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/specific/SpecificServiceCfg.java | 11 ++++++++-- .../SpecificServiceCfgController.java | 10 ++++++++- .../dao/specific/SpecificServiceCfgDao.java | 1 + .../dao/specific/SpecificServiceCfgDao.xml | 4 ++++ .../specific/SpecificServiceCfgService.java | 4 +++- .../resources/messages/message_en.properties | 2 +- .../resources/messages/message_ru.properties | 2 +- .../webapp/WEB-INF/tags/sys/treeselect.tag | 10 +++++++-- .../views/specific/specificServiceCfgForm.jsp | 21 +++++++++++++++++-- .../1.11.0/jquery.validate.method.js | 7 +++++++ .../1.11.0/localization/messages_en.js | 3 ++- .../1.11.0/localization/messages_ru.js | 3 ++- .../1.11.0/localization/messages_zh.js | 3 ++- 13 files changed, 68 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java index 40b187746..57c095820 100644 --- a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java +++ b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java @@ -25,11 +25,18 @@ public class SpecificServiceCfg extends BaseEntity{ private SpecificServiceCfg parent; //parent_id 父节点id int N 0表示一级节点 private Integer isLeaf; //is_leaf 是否是叶子节点 int N 0否,1是,只有一级填0 private Integer groupId; //group_id maat端配置分组id int N 缺省0,表示未与maat分组同步 - private Integer cfgType;//配置类型,1,app;2,加密隧道协议 - + private Integer cfgType;//配置类型,1,app;2,加密隧道;3,基础协议 + private Integer parentType;//父配置类型 private Date beginDate; // 开始日期 private Date endDate; // 结束日期 private String showSequence; //显示序号 + + public Integer getParentType() { + return parentType; + } + public void setParentType(Integer parentType) { + this.parentType = parentType; + } public Integer getCfgType() { return cfgType; } diff --git a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java index d0c9b1c45..56fa943dc 100644 --- a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java +++ b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java @@ -129,6 +129,10 @@ public class SpecificServiceCfgController extends BaseController { SpecificServiceCfg parent = new SpecificServiceCfg(); parent.setSpecServiceId(0); specificServiceCfg.setParent(parent); + specificServiceCfg.setParentType(0); + } + if(specificServiceCfg!=null&&specificServiceCfg.getParent().getSpecServiceId()!=null){//获取父配置的id + specificServiceCfg.setParentType(specificServiceCfgService.getParentType(specificServiceCfg.getParent().getSpecServiceId())); } model.addAttribute("specificServiceCfg", specificServiceCfg); if (doAction != null && doAction.equals("0")) { @@ -195,6 +199,7 @@ public class SpecificServiceCfgController extends BaseController { Map map2 = Maps.newHashMap(); map2.put("id", 0); map2.put("pId", 0); + map2.put("type",0); map2.put("name","root_node"); //map2.put("placeholder","0"); mapList.add(map2); @@ -203,13 +208,15 @@ public class SpecificServiceCfgController extends BaseController { SpecificServiceCfg specificServiceCfg = list.get(i); if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){ if(specificServiceCfg.getIsValid().equals(0)|| - (!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||specificServiceCfg.getCfgType().intValue()!=cfgType){ + (!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))|| + (cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){ continue; } Map map = Maps.newHashMap(); map.put("id", specificServiceCfg.getSpecServiceId()); map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); map.put("name",specificServiceCfg.getSpecServiceName()); + map.put("type",specificServiceCfg.getCfgType()); mapList.add(map); } } @@ -230,6 +237,7 @@ public class SpecificServiceCfgController extends BaseController { map.put("code", specificServiceCfg.getSpecServiceCode()); map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); map.put("name",specificServiceCfg.getSpecServiceName()); + map.put("type",specificServiceCfg.getCfgType()); mapList.add(map); } } diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java index df0f9f40b..cc199a10f 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java @@ -47,5 +47,6 @@ public interface SpecificServiceCfgDao extends CrudDao { Integer insertConfigGroupInfo(ConfigGroupInfo entity); Integer updateConfigGroupInfobyGroupId(ConfigGroupInfo entity); + Integer getParentType(Integer specServiceId); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml index 8d0cfed6d..e13b34120 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml @@ -37,6 +37,10 @@ select from specific_service_cfg s where s.spec_service_id = #{specServiceId} + diff --git a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java index 79f7d39d4..7e5c3626d 100644 --- a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java +++ b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java @@ -140,6 +140,8 @@ public class SpecificServiceCfgService extends BaseService{ return specificServiceCfgDao.getChildrenById(specServiceId); } - + public Integer getParentType(Integer specServiceId) { + return specificServiceCfgDao.getParentType(specServiceId); + } } diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index ee9bbfc0c..7391f7335 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -792,7 +792,7 @@ app_byte_config=APP Byte Feature social_app=Applicaiton app_policy_config=APP Policy app_features_config=APP Feature -cfg_type=Cfg Type +cfg_type=Configuration Type encrypted_tunnel_behavior=Encrypted Tunnel Behavior behaviour_type=Behaviour Type basic_protocol=Basic Protocol diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 8bd41de51..82cf99d8c 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -714,7 +714,7 @@ app_byte_config=APP Byte Feature social_app=Applicaiton app_policy_config=APP Policy app_features_config=APP Feature -cfg_type=Cfg Type +cfg_type=Configuration Type encrypted_tunnel_behavior=Encrypted Tunnel Behavior behaviour_type=Behaviour Type basic_protocol=Basic Protocol diff --git a/src/main/webapp/WEB-INF/tags/sys/treeselect.tag b/src/main/webapp/WEB-INF/tags/sys/treeselect.tag index a59988eea..3717ad1a0 100644 --- a/src/main/webapp/WEB-INF/tags/sys/treeselect.tag +++ b/src/main/webapp/WEB-INF/tags/sys/treeselect.tag @@ -49,7 +49,7 @@ ajaxData:{selectIds: $("#${id}Id").val()},buttons:{"":"ok", "":"clear","":true}, submit:function(v, h, f){ if (v=="ok"){ var tree = h.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents(); - var ids = [], names = [], nodes = []; + var ids = [], names = [], nodes = [],types =[]; if ("${checked}" == "true"){ nodes = tree.getCheckedNodes(true); }else{ @@ -79,7 +79,6 @@ return false; }// ids.push(nodes[i].id);// - if (nodes[i].id != null ){ $.ajax({ type:"post", @@ -103,15 +102,22 @@ }// names.push(nodes[i].name); + if(nodes[i].type){ + types.push(nodes[i].type); + } // break; // 如果为非复选框选择,则返回第一个选择 } $("#${id}Id").val(ids.join(",").replace(/u_/ig,"")); + if(types.length>0){ + $("#${id}Id").attr('cfgtype',types.join(",")); + } $("#${id}Id").change();//手动触发change事件,使Id的值得变化可以被监听到 $("#${id}Name").val(names.join(",")); }// else if (v=="clear"){ $("#${id}Id").val(""); + $("#${id}Id").removeAttr('cfgtype'); $("#${id}Id").change();//手动触发change事件,使Id的值得变化可以被监听到 $("#${id}Name").val(""); }// diff --git a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp index b5cdd3a7f..092446921 100644 --- a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp @@ -51,6 +51,23 @@ } } }); + if("${specificServiceCfg.parentType}"){ + $("[name=cfgType]").each(function(){ + $(this).attr("parent-type","${specificServiceCfg.parentType}"); + }); + } + $("#specificServiceCfgId").on("change",function(){ + var data=$(this).attr("cfgtype"); + if(data!=0){ + $("[name=cfgType]").each(function(){ + $(this).attr("parent-type",data); + if($(this).val()==data){ + $(this).click(); + } + }) + + } + }); }); @@ -99,7 +116,7 @@
+ title="" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=0" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
@@ -134,7 +151,7 @@
- +
diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js index 68681b24b..a13fa9fff 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js @@ -594,6 +594,13 @@ jQuery.validator.addMethod("areaIp",function(value, element) { } } }); +jQuery.validator.addMethod("checkParent",function(value, element) { + var parentType=$(element).attr("parent-type"); + if(parentType&&parentType!=0&&parentType!=value){ + return false; + } + return true; +}); //ip v4转数字 var ipToNumber=function (ip){ var num =0; diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js index f87fedcdb..827ea1859 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js @@ -56,6 +56,7 @@ ip_range: "ip Range", timeout:"timeout", areaIpPrefix:"Forbiden value: ", - domainCheck:"Please enter a valid domain." + domainCheck:"Please enter a valid domain.", + checkParent:"Configuration Type must match it's parent." }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js index ba63d23c4..b4a634636 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js @@ -54,6 +54,7 @@ ip_range: "ip Range", timeout:"timeout", areaIpPrefix:"Forbiden value: ", - domainCheck:"Please enter a valid domain." + domainCheck:"Please enter a valid domain.", + checkParent:"Configuration Type must match it's parent." }); }(jQuery)); \ No newline at end of file diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js index c26d79370..1aa890c37 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js @@ -58,6 +58,7 @@ ip_range: "ip Range", timeout:"超时", areaIpPrefix:"禁止使用的值: ", - domainCheck:"请输入有效的域名" + domainCheck:"请输入有效的域名", + checkParent:"配置类型必须与上级配置一致!" }); }(jQuery));