"businessUnit":{"reg":'',"title":""},//业主单位
"projectCode":{"reg":'',"title":""},//项目编号
"projectName":{"reg":/^[a-zA-Z\u4e00-\u9fa5]{1,50}$/,"title":"请最多输入50个汉字、字母"},//项目名称
"farmId":{"reg":'',"title":""},//场站编号
"farmName":{"reg":'',"title":""},//场站名称
"code":{"reg":/^\w{1,20}$/,"title":"长度最多20字符","url":'model/equipment/validByCode.action'},//设备编号
"surveyLayers":{"reg":/^[1-9]{0,1}[0-9]{1}$/,"title":"请输入两位整数"},//监测层数
"surveyAltitude":{"reg":/^(([1-9][0-9][0-9])|([1-9][0-9])|[0-9]){1}$/,"title":"请输入三位整数"},//监测高度
"longitude":{"reg": /^([E|W])(?:(?:180(?:\.0{1,4})?)|(?:(?:(?:1[0-7]\d)|(?:[1-9]?\d))(?:\.\d{1,4})?))$/,"title":"经度例:E101.2231"},//经度
"latitude":{"reg":/^([N|S])(?:90(?:\.0{1,4})?|(?:[1-8]?\d(?:\.\d{1,4})?))$/,"title":"纬度例:N38.2313"},//纬度
"gatherUnit":{"reg":/^[^\s]{1,20}$/,"title":"可输入最多20个字母、数字、字符"},//采集设备厂家
"contactUnit":{"reg":/^[^\s]{1,20}$/,"title":"可输入最多20个字母、数字、字符"},//通讯设备厂家
//"email":{"reg":/^[a-zA-Z0-9_-] @[a-zA-Z0-9_-] (\.[a-zA-Z0-9_-] ) $/,"title":"多个邮箱地址用','分隔"},//邮箱地址
"email":{"reg":/^((([a-z0-9_\.-] )@([\da-z\.-] )\.([a-z\.]{2,6}\,))*(([a-z0-9_\.-] )@([\da-z\.-] )\.([a-z\.]{2,6})))$/
,"title":"多个邮箱地址用','分隔"},//邮箱地址
//"email":{"reg":/^(\w) (\.\w )*@(\w) ((\.\w{2,3}){1,3})$/,"title":"多个邮箱地址用','分隔"},//邮箱地址
"equipmentParams":{"reg":/^\w{0,500}$/,"title":"最多输入500个字"},//设备参数
"modelCode":{"reg":"","title":""},//风机型号
"capacity":{"reg":/^[0-9] ([.]{1}[0-9] ){0,1}$/,"title":"仅能输入数字"},//单机容量
"supplier":{"reg":/^\S{0,50}$/,"title":"最多输入50个字符"},//供应商
"modleCode":{"reg":/^\S{0,20}$/,"title":"最多输入20个字符"},//设备型号
"beginDate":{"reg":"","title":""},//营运起始时间
"endDate":{"reg":"","title":""},//营运截止时间
"qcDate":{"reg":"","title":""},//质保到期日期
"altitude":{"reg":/^(([1-9] [0-9]*.{1}[0-9] )|([0].{1}[1-9] [0-9]*)|([1-9][0-9]*)|([0][.][0-9] [1-9]*))$/,"title":"请输入有效数字"},//海拔
"kname":{"reg":"","title":""},//场站名称
"farmorcordid":{"reg":"","title":""},//场站编号
"provinceName":{"reg":"","title":""},//所属区域名称
"province":{"reg":"","title":""},//所属区域
"realInstallCapacity":{"reg":/^[0-9] ([.]{1}[0-9] ){0,1}$/,"title":"仅能输入数字"},//装机容量
"fan_number":{"reg":/^[0-9] ([.]{1}[0-9] ){0,1}$/,"title":"仅能输入数字"},//风机数量
"telephone":{"reg":/^1[34578]\d{9}$/,"title":" 请输入正确的手机号"},//电话
"farmFile":{"reg":"","title":""},//场站图片
"projectFrom":{"reg":"","title":""},//项目来源
"commissioningTime":{"reg":"","title":""},//并网时间
"modeling_time":{"reg":"","title":""},//服务开始时间(启用时间)
"validdate":{"reg":"","title":""},//服务截止时间(授权截止日期)
"kstate":{"reg":"","title":""},//授权状态
"monitorstate":{"reg":"","title":""},//监控状态
"farmStatus":{"reg":"","title":""},//场站状态
"atten":{"reg":"","title":""},//联系人
"createUser":{"reg":"","title":""},//录入人
"createTime":{"reg":"","title":""},//录入时间
"kstate":{"reg":"","title":""}//授权状态
/**
*经项目验证有效
*/
//去除前后空格 --- 调用方法:common.wipeOffBlank(val);
wipeOffBlank: function(data){
return data.replace(/(^\s*)|(\s*$)/g, "");
},
//验证 --- 中文、英文、数字但不包括下划线等符号
oftenUseChars: function(str){
var reg = /^[\u4E00-\u9FA5A-Za-z0-9] $/;
return reg.test(str);
},
//验证 --- 是否含有特殊字符
specialChars: function(str){
var reg = new RegExp("[`~!@#$^&*()-_=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
return reg.test(str);
},
//验证 --- ip地址
verifyData: function(ip){
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return reg.test(ip);
},
//验证 --- 判断输入的字符是否(全部)为中文
IsChinese: function(str){
var reg = /^[\u0391-\uFFE5] $/;
return reg.test(str);
},
//验证 --- 判断输入的字符是否(含有)为中文
IsChinese2: function(str){
var reg = new RegExp("[\\u4E00-\\u9FFF] ","g");
return reg.test(str);
},
//验证 --- 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
isidCard: function (str){
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
return reg.test(str);
},
//验证 --- 国内电话号码、传真 (7777777或88888888或0511-4405222 或 021-87888822)
istell: function (str){
/*var result = str.match(/\d{3}-\d{8}|\d{4}-\d{7}/);
if(result == null) return false;
return true;*/
var reg = new RegExp(/^(0?\d{2,3}\-)?[1-9]\d{6,7}(\-\d{1,4})?$/);
return reg.test(str);
},
faxesChars: function(str){
var reg = /^(\d{3,4}-)?\d{7,8}$/;
return reg.test(str);
},
//验证 --- 手机号码验证
telphone:function(str){
var reg = new RegExp("/^1(3|4|5|7|8)\d{9}$/");
return reg.test(str);
},
//验证 --- 输入是否是一个由 0-9 / A-Z / a-z 组成的字符串
isalphanumber: function (str){
var result = str.match(/^[a-zA-Z0-9] $/);
if(result == null) return false;
return true;
},
//验证 --- 输入是否是有效的---电子邮件
isemail: function (str){
var result = str.match(/^\w ((-\w )|(\.\w ))*\@[A-Za-z0-9] ((\.|-)[A-Za-z0-9] )*\.[A-Za-z0-9] $/);
if(result == null) return false;
return true;
},
//验证 --- 中国邮政编码(6位)
ispostcode: function (str){
var result = str.match(/[1-9]\d{5}(?!\d)/);
if(result == null) return false;
return true;
},
/*
正则表达式校验
调用方法:
common.getExp(chinese,"正则表达式校验");
*/
正则验证积累
最新推荐文章于 2020-09-16 09:52:27 发布