1.增加系统业务配置列表页--搜索框的业务id搜索的输入限制:只能输入数字
2.优化系统业务配置表单页的非空校验
This commit is contained in:
@@ -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:'<spring:message code="required"/>'
|
||||
},
|
||||
'serviceDesc':{
|
||||
'childTableFlag':{
|
||||
required:'<spring:message code="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("<spring:message code='required'/>").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("<spring:message code='fill_all'/>").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("<spring:message code='enter_error'/>");
|
||||
@@ -78,6 +94,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
$.validator.addMethod(
|
||||
"checkChild",
|
||||
function(value, element, params) {
|
||||
if (value && value == "1") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
"<spring:message code='fill_all'/>"
|
||||
);
|
||||
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 @@
|
||||
'<input type="hidden" name="sciId" value="0"/>' +
|
||||
'<input type="hidden" name="sciIsValid" value="1"/>' +
|
||||
'<span class="child-label col-md-3"><font color="red">*</font>'+'<spring:message code="table_name"/>'+':</span> ' +
|
||||
'<span><input class="child-required form-control child-input" name="tableName"/></span> ' +
|
||||
'<span><input class="child-required form-control child-input" onchange="childValidate()" name="tableName"/></span> ' +
|
||||
'</div>' +
|
||||
'<div class="table-item">' +
|
||||
'<span class="child-label col-md-3"><font color="red">*</font>'+'<spring:message code="table_type"/>'+':</span> ' +
|
||||
@@ -180,11 +228,11 @@
|
||||
'</div>' +
|
||||
'<div class="table-item">' +
|
||||
'<span class="child-label col-md-3"><font color="red">*</font>MAAT '+'<spring:message code="table_name"/>'+':</span> ' +
|
||||
'<span><input class="child-required form-control child-input" name="maatTable"/></span>' +
|
||||
'<span><input class="child-required form-control child-input" onchange="childValidate()" name="maatTable"/></span>' +
|
||||
'</div>' +
|
||||
'<div class="table-item">' +
|
||||
'<span class="child-label col-md-3"><font color="red">*</font>'+'<spring:message code="table_des"/>'+':</span> ' +
|
||||
'<span><input class="child-required form-control child-input" name="tableDesc"/></span>' +
|
||||
'<span class="child-label col-md-3">' + '<spring:message code="table_des"/>'+':</span> ' +
|
||||
'<span><input class="form-control child-input" name="tableDesc"/></span>' +
|
||||
'<button type="button" class="btn btn-danger del-button" onclick="del2(this)">'+'<spring:message code="delete"/>'+'</button>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
@@ -193,6 +241,8 @@
|
||||
if ($("#serviceType").val() == '1' || $("#serviceType").val() == '3') {
|
||||
$("#addBtn").attr("disabled", true);
|
||||
}
|
||||
|
||||
childValidate();
|
||||
}
|
||||
|
||||
function del(obj) {
|
||||
@@ -271,12 +321,13 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label"><spring:message code="datebase_table"/>:</label>
|
||||
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="datebase_table"/>:</label>
|
||||
<div class="col-md-8" id="datatables">
|
||||
<shiro:hasPermission name="system:service:edit">
|
||||
<div>
|
||||
<button id="addBtn" type="button" class="btn btn-default" onclick="addDatatable()"><spring:message code="add"/></button>
|
||||
<label for="childTableFlag" class="error" style="display:none"><spring:message code="fill_all"/></label>
|
||||
<input type="hidden" name="childTableFlag" value=""/>
|
||||
<!-- <label for="childTableFlag" class="error" style="display:none"></label> -->
|
||||
</div>
|
||||
</shiro:hasPermission>
|
||||
<c:forEach items="${systemServiceInfo.serviceConfigInfoList }" var="serviceConfigInfo">
|
||||
@@ -286,7 +337,7 @@
|
||||
<input type="hidden" name="sciIsValid" value="1"/>
|
||||
|
||||
<span class="child-label col-md-3"><font color="red">*</font><spring:message code="table_name"/>:</span>
|
||||
<span><input class="child-required form-control child-input" name="tableName" value="${serviceConfigInfo.tableName }"/></span>
|
||||
<span><input class="child-required form-control child-input" onchange="childValidate()" name="tableName" value="${serviceConfigInfo.tableName }"/></span>
|
||||
</div>
|
||||
<div class="table-item">
|
||||
<span class="child-label col-md-3"><font color="red">*</font><spring:message code="table_type"/>:</span>
|
||||
@@ -301,11 +352,11 @@
|
||||
</div>
|
||||
<div class="table-item">
|
||||
<span class="child-label col-md-3"><font color="red">*</font>MAAT <spring:message code="table_name"/>:</span>
|
||||
<span><input class="child-required form-control child-input" name="maatTable" value="${serviceConfigInfo.maatTable }"/></span>
|
||||
<span><input class="child-required form-control child-input" onchange="childValidate()" name="maatTable" value="${serviceConfigInfo.maatTable }"/></span>
|
||||
</div>
|
||||
<div class="table-item">
|
||||
<span class="child-label col-md-3"><font color="red">*</font><spring:message code="table_des"/>:</span>
|
||||
<span><input class="child-required form-control child-input" name="tableDesc" value="${serviceConfigInfo.tableDesc }"/></span>
|
||||
<span class="child-label col-md-3"><spring:message code="table_des"/>:</span>
|
||||
<span><input class="form-control child-input child-desc" name="tableDesc" value="${serviceConfigInfo.tableDesc }"/></span>
|
||||
|
||||
<button type="button" class="btn btn-danger del-button" onclick="del(this)"><spring:message code="delete"/></button>
|
||||
</div>
|
||||
@@ -317,14 +368,15 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="service_id"/>:</label>
|
||||
<div class="col-md-4">
|
||||
<input id="serviceIdInput" class="required form-control" name="serviceId" value="${systemServiceInfo.serviceId }" readonly="readonly">
|
||||
<input id="serviceIdInput" class="form-control" name="serviceId" value="${systemServiceInfo.serviceId }" readonly="readonly">
|
||||
<label for="serviceId" class="error" style="display:none"><spring:message code="required"/></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="describe"/>:</label>
|
||||
<label class="col-md-3 control-label"><spring:message code="describe"/>:</label>
|
||||
<div class="col-md-4">
|
||||
<form:textarea path="serviceDesc" htmlEscape="false" class="required form-control"/>
|
||||
<form:textarea path="serviceDesc" htmlEscape="false" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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,'');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
@@ -78,7 +86,7 @@ function deleteService(id) {
|
||||
<input name="serviceName" class="form-control input-medium" placeholder="<spring:message code="service_name"/>" value="${systemServiceInfo.serviceName }"/>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<input name="serviceId" class="form-control input-medium" placeholder="<spring:message code="service_id"/>" value="${systemServiceInfo.serviceId }"/>
|
||||
<input name="serviceId" class="form-control input-medium" placeholder="<spring:message code="service_id"/>" value="${systemServiceInfo.serviceId }" onkeyup="checkNum(this)"/>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<button type="button" class="btn blue" onClick="page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
|
||||
|
||||
Reference in New Issue
Block a user