diff --git a/src/main/webapp/WEB-INF/views/systemService/form.jsp b/src/main/webapp/WEB-INF/views/systemService/form.jsp index e2e3c42ce..1d6a58999 100644 --- a/src/main/webapp/WEB-INF/views/systemService/form.jsp +++ b/src/main/webapp/WEB-INF/views/systemService/form.jsp @@ -10,6 +10,7 @@ $(document).ready(function() { top.window.scrollTo(0, 0); $("#inputForm").validate({ + ignore: [], rules: { 'serviceName':{ required:true @@ -24,9 +25,11 @@ 'serviceType':{ required:true }, - 'serviceDesc':{ - required:true + 'childTableFlag':{ + required:true, + checkChild:true } + }, messages: { 'serviceName':{ @@ -42,21 +45,34 @@ 'serviceType':{ required:'' }, - 'serviceDesc':{ + 'childTableFlag':{ required:'' } }, - submitHandler: function(form){ - $("[for=childTableFlag]").css("display", "none"); + //submitHandler: function(form){ + /* $("[for=childTableFlag]").css("display", "none"); var flag = true; var tables = document.getElementsByClassName("child-required"); + if (tables.length == 0) { + $("[for=childTableFlag]").text("").css("display", "inline"); + if (!$("#serviceIdInput").val()) { + $("[for=serviceId]").css("display", "inline"); + } + return false; + } for (var i = 0; i < tables.length; i++) { if (!tables[i].value || tables[i].value == '') { - $("[for=childTableFlag]").css("display", "inline"); + $("[for=childTableFlag]").text("").css("display", "inline"); flag = false; break; } } + + if (!$("#serviceIdInput").val()) { + $("[for=serviceId]").css("display", "inline"); + flag = false; + } + if (flag) { loading('LOADING...'); $("[disabled=disabled]").attr("disabled", false); @@ -65,8 +81,8 @@ } else { flag = true; return false; - } - }, + } */ + //}, errorContainer: "#messageBox", errorPlacement: function(error, element) { $("#messageBox").text(""); @@ -78,6 +94,17 @@ } }); + $.validator.addMethod( + "checkChild", + function(value, element, params) { + if (value && value == "1") { + return true; + } else { + return false; + } + }, + "" + ); changeType($("#serviceType").val(), $("#serviceType")); //类型、动作不允许修改 @@ -94,6 +121,25 @@ }); } + function childValidate() { + var flag = true; + var c = $(".child-required, .child-required2.selectpicker"); + if (c.length == 0) { + return false; + } + c.each(function(){ + if (!$(this).val()) { + flag = false; + return false; + } + }); + if (flag) { + $("[name=childTableFlag]").val("1"); + } else { + $("[name=childTableFlag]").val("0"); + } + } + function changeType(v, obj) { if ($(obj).val() == '') { $("#addBtn").attr("disabled", true); @@ -156,6 +202,8 @@ } else { $("#serviceIdInput").val(""); } + + childValidate(); } function addDatatable() { @@ -165,7 +213,7 @@ '' + '' + '*'+''+': ' + - ' ' + + ' ' + '' + '
' + '*'+''+': ' + @@ -180,11 +228,11 @@ '
' + '
' + '*MAAT '+''+': ' + - '' + + '' + '
' + '
' + - '*'+''+': ' + - '' + + '' + ''+': ' + + '' + '' + '
' + '' @@ -193,6 +241,8 @@ if ($("#serviceType").val() == '1' || $("#serviceType").val() == '3') { $("#addBtn").attr("disabled", true); } + + childValidate(); } function del(obj) { @@ -271,12 +321,13 @@
- +
- + +
@@ -286,7 +337,7 @@ *: - +
*: @@ -301,11 +352,11 @@
*MAAT : - +
- *: - + : +
@@ -317,14 +368,15 @@
- + +
- +
- +
diff --git a/src/main/webapp/WEB-INF/views/systemService/list.jsp b/src/main/webapp/WEB-INF/views/systemService/list.jsp index ac89c6866..f97d92883 100644 --- a/src/main/webapp/WEB-INF/views/systemService/list.jsp +++ b/src/main/webapp/WEB-INF/views/systemService/list.jsp @@ -29,6 +29,14 @@ function deleteService(id) { } } } + +function checkNum(obj) { + var reg = /^[0-9]*$/; + if (!reg.test(obj.value)) { + top.$.jBox.tip("请输入数字"); + obj.value=obj.value.replace(/[^\d]/g,''); + } +}
- " value="${systemServiceInfo.serviceId }"/> + " value="${systemServiceInfo.serviceId }" onkeyup="checkNum(this)"/>