diff --git a/src/main/resources/static/route/check/save-check.html b/src/main/resources/static/route/check/save-check.html index 9daac55..8b40ec8 100644 --- a/src/main/resources/static/route/check/save-check.html +++ b/src/main/resources/static/route/check/save-check.html @@ -109,7 +109,7 @@ {{# for(var j = 0, jItem; jItem = item.checkItemOptions[j++]; ) { }} {{# if(jItem.type == 1) { }} - + {{# } else if(jItem.type == 2) { }}
{{jItem.name}} {{jItem.unit}}
{{# } else if(jItem.type == 3) { }} @@ -477,6 +477,23 @@ // 校验 form.verify({ + otherReq: function(value,item){ + var verifyName = $(item).attr('name') + ,verifyType = $(item).attr('type') + ,formElem = $(item).parents('.layui-form')//获取当前所在的form元素,如果存在的话 + ,verifyElem = formElem.find('input[name='+verifyName+']')//获取需要校验的元素 + ,isTrue = verifyElem.is(':checked')//是否命中校验 + ,focusElem = verifyElem.next().find('i.layui-icon');//焦点元素 + if(!isTrue || !value){ + //定位焦点 + focusElem.css(verifyType=='radio' ? {"color":"#FF5722"} : {"border-color":"#FF5722"}); + //对非输入框设置焦点 + focusElem.first().attr("tabIndex","1").css("outline","0").blur(function() { + focusElem.css(verifyType=='radio' ? {"color":""} : {"border-color":""}); + }).focus(); + return '必填项不能为空'; + } + } }); // area1 选择事件