From d9d5e2be36a7f8caa759aefb6881b0a1abe90a7b Mon Sep 17 00:00:00 2001 From: duandongmei Date: Mon, 3 Sep 2018 13:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96app=20topic=20domain=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=8E=BB=E6=8E=89domain=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=80=A7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/AppCfgController.java | 15 +- .../sql/update_function_region_dict.sql | 2 + .../views/cfg/app/appTopicDomainCfgForm.jsp | 541 +++++++++--------- 3 files changed, 283 insertions(+), 275 deletions(-) create mode 100644 src/main/resources/sql/update_function_region_dict.sql diff --git a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java index c4f7f31f8..ad4473502 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -1083,17 +1083,14 @@ public class AppCfgController extends BaseController { @RequestMapping(value = {"saveAppTopicDomainCfg"}) @RequiresPermissions(value={"app:topic:config"}) public String saveAppTopicDomainCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppTopicDomainCfg entity,@RequestParam("userDomain")String userDomain,RedirectAttributes redirectAttributes) { + AppTopicDomainCfg entity,RedirectAttributes redirectAttributes) { try { //验证域名的重复行 - if(!StringUtil.isBlank(userDomain)){ + if(!StringUtil.isBlank(entity.getDomain())){ WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic(); - websiteDomainTopic.setDomain(userDomain); + websiteDomainTopic.setDomain(entity.getDomain()); List domainDict = appCfgService.getDomainDict(websiteDomainTopic); - if((domainDict!=null&&domainDict.size()>0)){ - addMessage(redirectAttributes,"domain_existed"); - return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+entity.getFunctionId(); - }else{ + if((domainDict==null || domainDict.size()==0)){ //保存到域名关联表中 if(entity!=null&&entity.getWebsiteServiceId()!=null&&entity.getTopicId()!=null){ websiteDomainTopic.setWebsiteServiceId(entity.getWebsiteServiceId()); @@ -1108,8 +1105,8 @@ public class AppCfgController extends BaseController { } } } - if(entity!=null&&StringUtil.isBlank(entity.getDomain())&&!StringUtil.isBlank(userDomain)){ - entity.setDomain(userDomain);//自定义域名 + if(entity!=null&&StringUtil.isBlank(entity.getDomain())&&!StringUtil.isBlank(entity.getDomain())){ + entity.setDomain(entity.getDomain()); } appCfgService.saveOrUpdateAppTopicDomainCfg(entity); addMessage(redirectAttributes,"save_success"); diff --git a/src/main/resources/sql/update_function_region_dict.sql b/src/main/resources/sql/update_function_region_dict.sql new file mode 100644 index 000000000..e9191abfa --- /dev/null +++ b/src/main/resources/sql/update_function_region_dict.sql @@ -0,0 +1,2 @@ +--修改topic_domain默认无表达式 +update function_region_dict set config_expr_type=0,config_hex=0 where dict_id=179; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgForm.jsp index cda42a531..a4ebb1d37 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgForm.jsp @@ -42,95 +42,101 @@ $(function(){ errorContainer: "#messageBox", }); - //页面加载时触发初始化操作 - var file = $("#domain").val(); - if(!file){ - $("#userDomain").hide();//隐藏输入框 - $("#response").val("domain"); - $("#domain").selectpicker("show");//隐藏选择框 - }else{ - $("#domain").selectpicker("hide");//隐藏选择框 - $("#response").val("userDomain"); - $("#userDomain").show();//隐藏输入框 - } - $("#response").on("change",function(){ - var $this = $(this); - var inputId = $this.val(); - $("#userDomain").val("");//清空 - $("#domain").selectpicker("val",""); - if("userDomain" == inputId){ - $("#userDomain").show();//显示输入框 - $("#domain").selectpicker("hide");//隐藏选择框 - }else{ - $("#userDomain").hide();//隐藏输入框 - $("#domain").selectpicker("show");//显示选择框 - } - }); - // - if('${_cfg.domain}'){ - ajaxDomain($("#websiteServiceId").val(),$("#topicId").val()); - } - //选择主题跟服务 查询域名 - $("#topicId").on("change",function(){ - var websiteServiceId = $("#websiteServiceId").val(); - if(websiteServiceId!=null&&websiteServiceId!=''){ - ajaxDomain(websiteServiceId,$("#topicId").val()); - } - }); - $("#websiteServiceId").on("change",function(){ - var topicId =$("#topicId").val(); - if(topicId!=null&&topicId!=''){ - ajaxDomain($("#websiteServiceId").val(),topicId); - } - }); - - }); + //页面加载时触发初始化操作 + /* var file = $("#domain").val(); + if(!file){ + //$("#userDomain").hide();//隐藏输入框 + //$("#response").val("domain"); + //$("#domain").selectpicker("show");//隐藏选择框 + }else{ + //$("#domain").selectpicker("hide");//隐藏选择框 + //$("#response").val("userDomain"); + //$("#userDomain").show();//隐藏输入框 + } */ + /* $("#response").on("change",function(){ + var $this = $(this); + var inputId = $this.val(); + $("#userDomain").val("");//清空 + $("#domain").selectpicker("val",""); + if("userDomain" == inputId){ + $("#userDomain").show();//显示输入框 + $("#domain").selectpicker("hide");//隐藏选择框 + }else{ + $("#userDomain").hide();//隐藏输入框 + $("#domain").selectpicker("show");//显示选择框 + } + }); */ + if('${_cfg.domain}'){ + ajaxDomain($("#websiteServiceId").val(),$("#topicId").val()); + } + //选择主题跟服务 查询域名 + $("#topicId").on("change",function(){ + var websiteServiceId = $("#websiteServiceId").val(); + if(websiteServiceId!=null&&websiteServiceId!=''){ + ajaxDomain(websiteServiceId,$("#topicId").val()); + } + }); + $("#websiteServiceId").on("change",function(){ + var topicId =$("#topicId").val(); + if(topicId!=null&&topicId!=''){ + ajaxDomain($("#websiteServiceId").val(),topicId); + } + }); + $("#selectDomain").on("change",function(){ + var domain =$("#selectDomain").val(); + if(domain!=null&&domain!=''){ + $("input[name='domain']").val(domain); + } + }); + $("input[name='domain']").val('${_cfg.domain}'); + + }); - - function ajaxDomain(webId,topicId){ - var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4); - $.ajax({ - type:'get', - url:'${ctx}/app/WebsiteDomainTopicList', - data:{"websiteServiceId":webId,"topicId":topicId}, - dataType:'json', - async:true, - success:function(data,textStatus){//处理返回结果 - if(textStatus=="success"){ - var html=''; - $("#domain").html(html); - $("[name='domain']").selectpicker("refresh"); - $("[name='domain']").selectpicker("render"); - }else{ - html+=''; - $("#domain").html(html); - $("[name='domain']").selectpicker("refresh"); - $("[name='domain']").selectpicker("render"); + //根据topic和website动态加载域名选项 + function ajaxDomain(webId,topicId){ + var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4); + $.ajax({ + type:'get', + url:'${ctx}/app/WebsiteDomainTopicList', + data:{"websiteServiceId":webId,"topicId":topicId}, + dataType:'json', + async:true, + success:function(data,textStatus){//处理返回结果 + if(textStatus=="success"){ + var html=''; - $("#domain").html(html); - $("[name='domain']").selectpicker("refresh"); - $("[name='domain']").selectpicker("render"); - } - } - }); + html+='>'+data[i].domain+''; + } + html+=''; + $("#selectDomain").html(html); + $("[name='selectDomain']").selectpicker("refresh"); + $("[name='selectDomain']").selectpicker("render"); + }else{ + html+=''; + $("#selectDomain").html(html); + $("[name='selectDomain']").selectpicker("refresh"); + $("[name='selectDomain']").selectpicker("render"); + } + } + }, + complete:function(XMLHttpRequest,status){//超时设置 + if(status=="timeout"){ + var html=''; + $("#selectDomain").html(html); + $("[name='selectDomain']").selectpicker("refresh"); + $("[name='selectDomain']").selectpicker("render"); + } + } + }); + } @@ -195,134 +201,156 @@ $(function(){
-
- -
-
- -
- - - - + + + + + + + +
+
+ + +
+
+ +
+ + + + + + +
+
+
+
+ + +
+
+ + +
+ + + + + + > + + + + + + + + + + + + + +
+
+ +
+
+
- - - - -
- -
-
- -
- - -
-
-
-
-
- -
-
- -
- -
-
-
-
-
-
-
-
- - -
- -
- -
-
-
* - -
-
- - -
-
-
-
-
- - - -
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ <%--
* + +
+
+ + +
+
+
--%> +
+
+ + +
@@ -360,62 +388,12 @@ $(function(){
-
-
- - - -
- - - - - - -
-
-
- -
- - - - - - > - - - - - - - - - - - - - -
-
- +
- -
-
+ + +
@@ -433,6 +411,22 @@ $(function(){
+
+
+ +
+ + +
+
+
+
@@ -447,6 +441,19 @@ $(function(){
+
+
+ +
+ +
+
+
+
+ - + +
<%-- <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> --%>