From 6c55297aa4014e8cabf173118d5ed4c782b72226 Mon Sep 17 00:00:00 2001
From: wenc000 <450292408@qq.com>
Date: Fri, 17 Apr 2020 09:33:15 +0800
Subject: [PATCH] =?UTF-8?q?radio=E6=A0=A1=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../static/route/check/save-check.html | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
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 选择事件
|