配置id的检索in方式,增加id个数不大于200的校验

This commit is contained in:
shangguanyanfei
2019-04-16 10:08:10 +08:00
parent e4effb7ab4
commit f06830ae23
5 changed files with 30 additions and 3 deletions

View File

@@ -42,6 +42,24 @@ jQuery.validator.addMethod("compileIdCheck",function(value,element){
} }
return flagTypeSame ; return flagTypeSame ;
},$.validator.messages.compileIdCheck); },$.validator.messages.compileIdCheck);
// 新增配置ID 查询条件验证 1,2,3 查询个数不能大于200个的校验
jQuery.validator.addMethod("compileIdCheckNum",function(value,element){
var flagTypeSame=true;
if(this.optional(element) || /^(\d+,)*\d+$/.test(value) || /^(\d+-)?\d+$/.test(value)){
flagTypeSame=true;
if(/^(\d+,)*\d+$/.test(value)){
var strArr=value.split(",");
if(strArr.length >200){
flagTypeSame=false;
}else{
flagTypeSame=true;
}
}
}else{
flagTypeSame=false;
}
return flagTypeSame ;
},$.validator.messages.compileIdCheckNum);
jQuery.validator.addMethod("hexCheck", function(value, element) { jQuery.validator.addMethod("hexCheck", function(value, element) {
return this.optional(element) || /^([0-9|a-f|A-F]*)$/.test(value); return this.optional(element) || /^([0-9|a-f|A-F]*)$/.test(value);
}, $.validator.messages.hexCheck); }, $.validator.messages.hexCheck);

View File

@@ -93,6 +93,7 @@
log_no_data:"This hour no data", log_no_data:"This hour no data",
expireTip:"Start time and end time interval is at least 1 minute", expireTip:"Start time and end time interval is at least 1 minute",
compareTip:"Start time should not be less than the current time plus 2 minutes.", compareTip:"Start time should not be less than the current time plus 2 minutes.",
compileIdCheck:"Please enter the correct query format" compileIdCheck:"Please enter the correct query format",
compileIdCheckNum:"The number of queries should not be greater than 200"
}); });
}(jQuery)); }(jQuery));

View File

@@ -93,6 +93,7 @@
log_no_data:"Нет данных за этот час", log_no_data:"Нет данных за этот час",
expireTip:"Start time and end time interval is at least 1 minute", expireTip:"Start time and end time interval is at least 1 minute",
compareTip:"Start time should not be less than the current time plus 2 minutes.", compareTip:"Start time should not be less than the current time plus 2 minutes.",
compileIdCheck:"Please enter the correct query format" compileIdCheck:"Please enter the correct query format",
compileIdCheckNum:"The number of queries should not be greater than 200"
}); });
}(jQuery)); }(jQuery));

View File

@@ -93,6 +93,7 @@
log_no_data:"本小时无数据", log_no_data:"本小时无数据",
expireTip:"开始时间结束时间间隔至少为1分钟", expireTip:"开始时间结束时间间隔至少为1分钟",
compareTip:"开始时间不能小于当前时间加上2分钟 ", compareTip:"开始时间不能小于当前时间加上2分钟 ",
compileIdCheck:"请输入正确的查询格式" compileIdCheck:"请输入正确的查询格式",
compileIdCheckNum:"查询个数不能大于200"
}); });
}(jQuery)); }(jQuery));

View File

@@ -741,23 +741,29 @@ window.onload=function(){
// 配置id的搜索下拉框选择切换 // 配置id的搜索下拉框选择切换
if ($("#searchForm #seltype").val() == 'compileIdNew') { if ($("#searchForm #seltype").val() == 'compileIdNew') {
$("#searchForm #intype").addClass("compileIdCheck"); $("#searchForm #intype").addClass("compileIdCheck");
$("#searchForm #intype").addClass("compileIdCheckNum");
} else { } else {
$("#searchForm #intype").removeClass("compileIdCheck"); $("#searchForm #intype").removeClass("compileIdCheck");
$("#searchForm #intype").removeClass("compileIdCheckNum");
} }
// reset时去掉number // reset时去掉number
$("#resetBtn").on("click", function() { $("#resetBtn").on("click", function() {
if ($("#searchForm #seltype").val() == 'compileIdNew') { if ($("#searchForm #seltype").val() == 'compileIdNew') {
$("#searchForm #intype").addClass("compileIdCheck"); $("#searchForm #intype").addClass("compileIdCheck");
$("#searchForm #intype").addClass("compileIdCheckNum");
} else { } else {
$("#searchForm #intype").removeClass("compileIdCheck"); $("#searchForm #intype").removeClass("compileIdCheck");
$("#searchForm #intype").removeClass("compileIdCheckNum");
} }
}); });
// 切换时为compileId加上number // 切换时为compileId加上number
$("#searchForm #seltype").on("change", function() { $("#searchForm #seltype").on("change", function() {
if ($("#searchForm #seltype").val() == 'compileIdNew') { if ($("#searchForm #seltype").val() == 'compileIdNew') {
$("#searchForm #intype").addClass("compileIdCheck"); $("#searchForm #intype").addClass("compileIdCheck");
$("#searchForm #intype").addClass("compileIdCheckNum");
} else { } else {
$("#searchForm #intype").removeClass("compileIdCheck"); $("#searchForm #intype").removeClass("compileIdCheck");
$("#searchForm #intype").removeClass("compileIdCheckNum");
} }
}); });