Sfoglia il codice sorgente

表单验证优化

RuoYi 6 anni fa
parent
commit
b033c858b8
27 ha cambiato i file con 134 aggiunte e 190 eliminazioni
  1. 0 10
      ruoyi-admin/src/main/resources/static/css/style.css
  2. 6 1
      ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css
  3. 7 16
      ruoyi-admin/src/main/resources/templates/monitor/job/add.html
  4. 7 6
      ruoyi-admin/src/main/resources/templates/monitor/job/edit.html
  5. 5 11
      ruoyi-admin/src/main/resources/templates/system/config/add.html
  6. 5 11
      ruoyi-admin/src/main/resources/templates/system/config/edit.html
  7. 8 6
      ruoyi-admin/src/main/resources/templates/system/dept/add.html
  8. 8 6
      ruoyi-admin/src/main/resources/templates/system/dept/edit.html
  9. 5 11
      ruoyi-admin/src/main/resources/templates/system/dict/data/add.html
  10. 5 11
      ruoyi-admin/src/main/resources/templates/system/dict/data/edit.html
  11. 4 7
      ruoyi-admin/src/main/resources/templates/system/dict/type/add.html
  12. 4 7
      ruoyi-admin/src/main/resources/templates/system/dict/type/edit.html
  13. 8 6
      ruoyi-admin/src/main/resources/templates/system/menu/add.html
  14. 8 6
      ruoyi-admin/src/main/resources/templates/system/menu/edit.html
  15. 2 6
      ruoyi-admin/src/main/resources/templates/system/notice/add.html
  16. 2 6
      ruoyi-admin/src/main/resources/templates/system/notice/edit.html
  17. 5 7
      ruoyi-admin/src/main/resources/templates/system/post/add.html
  18. 5 7
      ruoyi-admin/src/main/resources/templates/system/post/edit.html
  19. 5 7
      ruoyi-admin/src/main/resources/templates/system/role/add.html
  20. 5 7
      ruoyi-admin/src/main/resources/templates/system/role/edit.html
  21. 11 17
      ruoyi-admin/src/main/resources/templates/system/user/add.html
  22. 9 13
      ruoyi-admin/src/main/resources/templates/system/user/edit.html
  23. 2 1
      ruoyi-admin/src/main/resources/templates/system/user/profile/edit.html
  24. 2 1
      ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html
  25. 2 1
      ruoyi-admin/src/main/resources/templates/system/user/resetPwd.html
  26. 2 1
      ruoyi-generator/src/main/resources/vm/html/add.html.vm
  27. 2 1
      ruoyi-generator/src/main/resources/vm/html/edit.html.vm

+ 0 - 10
ruoyi-admin/src/main/resources/static/css/style.css

@@ -2318,16 +2318,6 @@ table.dataTable thead .sorting:after {
 .google-map {
     height: 300px;
 }
-/* Validation */
-label.error {
-    color: #cc5965;
-    display: inline-block;
-    margin-left: 5px;
-}
-
-.form-control.error {
-    border: 1px dotted #cc5965;
-}
 /* ngGrid */
 .gridStyle {
     border: 1px solid #d4d4d4;

+ 6 - 1
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css

@@ -171,11 +171,16 @@
 label.error {
 	position: absolute;
 	right: 18px;
-	top: 7px;
+	top: 10px;
 	color: #ef392b;
 	font-size: 12px
 }
 
+.input-group label.error {
+	left: 255px;
+	z-index:99;
+}
+
 .Validform_error,input.error,select.error {
 	background-color: #fbe2e2;
 	border-color: #c66161;

+ 7 - 16
ruoyi-admin/src/main/resources/templates/monitor/job/add.html

@@ -8,31 +8,31 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">任务名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="jobName" id="jobName">
+					<input class="form-control" type="text" name="jobName" id="jobName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">任务组名:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="jobGroup" id="jobGroup">
+					<input class="form-control" type="text" name="jobGroup" id="jobGroup" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">方法名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="methodName" id="methodName"/>
+					<input class="form-control" type="text" name="methodName" id="methodName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">方法参数:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="methodParams" id="methodParams"/>
+					<input class="form-control" type="text" name="methodParams" id="methodParams">
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">cron表达式:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="cronExpression" id="cronExpression"/>
+					<input class="form-control" type="text" name="cronExpression" id="cronExpression" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -66,17 +66,7 @@
 	
 		$("#form-job-add").validate({
 			rules:{
-				jobName:{
-					required:true,
-				},
-				jobGroup:{
-					required:true,
-				},
-				methodName:{
-					required:true,
-				},
 				cronExpression:{
-					required:true,
 					remote: {
 	                    url: prefix + "/checkCronExpressionIsValid",
 	                    type: "post",
@@ -96,7 +86,8 @@
 	            "cronExpression": {
 	                remote: "表达式不正确"
 	            }
-	        }
+	        },
+	        focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 7 - 6
ruoyi-admin/src/main/resources/templates/monitor/job/edit.html

@@ -9,31 +9,31 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">任务名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="jobName" id="jobName" th:field="*{jobName}"/>
+					<input class="form-control" type="text" name="jobName" id="jobName" th:field="*{jobName}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">任务组名:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="jobGroup" id="jobGroup" th:field="*{jobGroup}"/>
+					<input class="form-control" type="text" name="jobGroup" id="jobGroup" th:field="*{jobGroup}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">方法名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="methodName" id="methodName" th:field="*{methodName}"/>
+					<input class="form-control" type="text" name="methodName" id="methodName" th:field="*{methodName}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">方法参数:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="methodParams" id="methodParams" th:field="*{methodParams}"/>
+					<input class="form-control" type="text" name="methodParams" id="methodParams" th:field="*{methodParams}">
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">cron表达式:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="cronExpression" id="cronExpression" th:field="*{cronExpression}"/>
+					<input class="form-control" type="text" name="cronExpression" id="cronExpression" th:field="*{cronExpression}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -97,7 +97,8 @@
 	            "cronExpression": {
 	                remote: "表达式不正确"
 	            }
-	        }
+	        },
+	        focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 11
ruoyi-admin/src/main/resources/templates/system/config/add.html

@@ -8,19 +8,19 @@
         <div class="form-group">	
             <label class="col-sm-3 control-label">参数名称:</label>
             <div class="col-sm-8">
-                <input id="configName" name="configName" class="form-control" type="text">
+                <input id="configName" name="configName" class="form-control" type="text" required>
             </div>
         </div>
         <div class="form-group">	
             <label class="col-sm-3 control-label">参数键名:</label>
             <div class="col-sm-8">
-                <input id="configKey" name="configKey" class="form-control" type="text">
+                <input id="configKey" name="configKey" class="form-control" type="text" required>
             </div>
         </div>
         <div class="form-group">	
             <label class="col-sm-3 control-label">参数键值:</label>
             <div class="col-sm-8">
-                <input id="configValue" name="configValue" class="form-control" type="text">
+                <input id="configValue" name="configValue" class="form-control" type="text" required>
             </div>
         </div>
         <div class="form-group">
@@ -47,7 +47,6 @@
 	    $("#form-config-add").validate({
 	        rules: {
 	            configKey: {
-	                required: true,
 	                remote: {
 	                    url: prefix + "/checkConfigKeyUnique",
 	                    type: "post",
@@ -62,18 +61,13 @@
 	                    }
 	                }
 	            },
-	            configName: {
-	                required: true
-	            },
-	            configValue: {
-	                required: true
-	            },
 	        },
 	        messages: {
 	            "configKey": {
 	                remote: "参数键名已经存在"
 	            }
-	        }
+	        },
+	        focusCleanup: true
 	    });
 	    
 	    function submitHandler() {

+ 5 - 11
ruoyi-admin/src/main/resources/templates/system/config/edit.html

@@ -9,19 +9,19 @@
             <div class="form-group">	
                 <label class="col-sm-3 control-label">参数名称:</label>
                 <div class="col-sm-8">
-                    <input id="configName" name="configName" th:field="*{configName}" class="form-control" type="text">
+                    <input id="configName" name="configName" th:field="*{configName}" class="form-control" type="text" required>
                 </div>
             </div>
             <div class="form-group">	
                 <label class="col-sm-3 control-label">参数键名:</label>
                 <div class="col-sm-8">
-                    <input id="configKey" name="configKey" th:field="*{configKey}" class="form-control" type="text">
+                    <input id="configKey" name="configKey" th:field="*{configKey}" class="form-control" type="text" required>
                 </div>
             </div>
             <div class="form-group">	
                 <label class="col-sm-3 control-label">参数键值:</label>
                 <div class="col-sm-8">
-                    <input id="configValue" name="configValue" th:field="*{configValue}" class="form-control" type="text">
+                    <input id="configValue" name="configValue" th:field="*{configValue}" class="form-control" type="text" required>
                 </div>
             </div>
 			<div class="form-group">
@@ -48,7 +48,6 @@
 	    $("#form-config-edit").validate({
 	        rules: {
 	            configKey: {
-	                required: true,
 	                remote: {
 	                    url: prefix + "/checkConfigKeyUnique",
 	                    type: "post",
@@ -66,18 +65,13 @@
 	                    }
 	                }
 	            },
-	            configName: {
-	                required: true
-	            },
-	            configValue: {
-	                required: true
-	            },
 	        },
 	        messages: {
 	            "configKey": {
 	                remote: "参数键名已经存在"
 	            }
-	        }
+	        },
+	        focusCleanup: true
 	    });
 	    
 	    function submitHandler() {

+ 8 - 6
ruoyi-admin/src/main/resources/templates/system/dept/add.html

@@ -9,19 +9,22 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">上级部门:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.deptName}"/>
+				    <div class="input-group">
+						<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.deptName}">
+					    <span class="input-group-addon"><i class="fa fa-search"></i></span>
+				    </div>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">部门名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="deptName" id="deptName">
+					<input class="form-control" type="text" name="deptName" id="deptName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示排序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="orderNum">
+					<input class="form-control" type="text" name="orderNum" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -60,7 +63,6 @@
 		$("#form-dept-add").validate({
 			rules:{
 				deptName:{
-					required:true,
 					remote: {
 		                url: prefix + "/checkDeptNameUnique",
 		                type: "post",
@@ -79,7 +81,6 @@
 		            }
 				},
 				orderNum:{
-					required:true,
 					digits:true
 				},
 				email:{
@@ -93,7 +94,8 @@
 		        "deptName": {
 		            remote: "部门已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 8 - 6
ruoyi-admin/src/main/resources/templates/system/dept/edit.html

@@ -10,19 +10,22 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">上级部门:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}"/>
+				    <div class="input-group">
+						<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}">
+					    <span class="input-group-addon"><i class="fa fa-search"></i></span>
+				    </div>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">部门名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName">
+					<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示排序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}">
+					<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -61,7 +64,6 @@
 		$("#form-dept-edit").validate({
 			rules:{
 				deptName:{
-					required:true,
 					remote: {
 		                url: prefix + "/checkDeptNameUnique",
 		                type: "post",
@@ -83,7 +85,6 @@
 		            }
 				},
 				orderNum:{
-					required:true,
 					digits:true
 				},
 				email:{
@@ -97,7 +98,8 @@
 		        "deptName": {
 		            remote: "部门已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 11
ruoyi-admin/src/main/resources/templates/system/dict/data/add.html

@@ -8,13 +8,13 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">字典标签:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictLabel" id="dictLabel"/>
+					<input class="form-control" type="text" name="dictLabel" id="dictLabel" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">字典键值:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictValue" id="dictValue"/>
+					<input class="form-control" type="text" name="dictValue" id="dictValue" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -32,7 +32,7 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">字典排序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictSort">
+					<input class="form-control" type="text" name="dictSort" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -82,17 +82,11 @@
 	
 		$("#form-dict-add").validate({
 			rules:{
-				dictLabel:{
-					required:true,
-				},
-				dictValue:{
-					required:true,
-				},
 				dictSort:{
-					required:true,
 					digits:true
 				},
-			}
+			},
+			focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 11
ruoyi-admin/src/main/resources/templates/system/dict/data/edit.html

@@ -9,13 +9,13 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">字典标签:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictLabel" id="dictLabel" th:field="*{dictLabel}"/>
+					<input class="form-control" type="text" name="dictLabel" id="dictLabel" th:field="*{dictLabel}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">字典键值:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictValue" id="dictValue" th:field="*{dictValue}"/>
+					<input class="form-control" type="text" name="dictValue" id="dictValue" th:field="*{dictValue}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -33,7 +33,7 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">字典排序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictSort" th:field="*{dictSort}">
+					<input class="form-control" type="text" name="dictSort" th:field="*{dictSort}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -83,17 +83,11 @@
 	
 		$("#form-dict-edit").validate({
 			rules:{
-				dictLabel:{
-					required:true,
-				},
-				dictValue:{
-					required:true,
-				},
 				dictSort:{
-					required:true,
 					digits:true
 				},
-			}
+			},
+			focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 4 - 7
ruoyi-admin/src/main/resources/templates/system/dict/type/add.html

@@ -8,13 +8,13 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">字典名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictName" id="dictName"/>
+					<input class="form-control" type="text" name="dictName" id="dictName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">字典类型:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictType" id="dictType">
+					<input class="form-control" type="text" name="dictType" id="dictType" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -40,11 +40,7 @@
 	
 		$("#form-dict-add").validate({
 			rules:{
-				dictName:{
-					required:true,
-				},
 				dictType:{
-					required:true,
 					minlength: 5,
 					remote: {
 		                url: prefix + "/checkDictTypeUnique",
@@ -65,7 +61,8 @@
 		        "dictType": {
 		            remote: "该字典类型已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 4 - 7
ruoyi-admin/src/main/resources/templates/system/dict/type/edit.html

@@ -9,13 +9,13 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">字典名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictName" id="dictName" th:field="*{dictName}"/>
+					<input class="form-control" type="text" name="dictName" id="dictName" th:field="*{dictName}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">字典类型:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="dictType" id="dictType" th:field="*{dictType}">
+					<input class="form-control" type="text" name="dictType" id="dictType" th:field="*{dictType}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -41,11 +41,7 @@
 	
 		$("#form-dict-edit").validate({
 			rules:{
-				dictName:{
-					required:true,
-				},
 				dictType:{
-					required:true,
 					minlength: 5,
 					remote: {
 		                url: prefix + "/checkDictTypeUnique",
@@ -69,7 +65,8 @@
 		        "dictType": {
 		            remote: "该字典类型已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 8 - 6
ruoyi-admin/src/main/resources/templates/system/menu/add.html

@@ -9,7 +9,10 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">上级菜单:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" onclick="selectMenuTree()" id="treeName" readonly="true" th:value="${menu.menuName}"/>
+				    <div class="input-group">
+					    <input class="form-control" type="text" onclick="selectMenuTree()" id="treeName" readonly="true" th:value="${menu.menuName}">
+				        <span class="input-group-addon"><i class="fa fa-search"></i></span>
+				    </div>
 				</div>
 			</div>
 			<div class="form-group">
@@ -23,7 +26,7 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">菜单名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="menuName" id="menuName">
+					<input class="form-control" type="text" name="menuName" id="menuName" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -41,7 +44,7 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示排序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="orderNum">
+					<input class="form-control" type="text" name="orderNum" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -76,7 +79,6 @@
         			required:true,
         		},
         		menuName:{
-        			required:true,
         			remote: {
                         url: prefix + "/checkMenuNameUnique",
                         type: "post",
@@ -95,7 +97,6 @@
                     }
         		},
         		orderNum:{
-        			required:true,
         			digits:true
         		},
         	},
@@ -103,7 +104,8 @@
                 "menuName": {
                     remote: "菜单已经存在"
                 }
-            }
+            },
+            focusCleanup: true
         });
         
         function submitHandler() {

+ 8 - 6
ruoyi-admin/src/main/resources/templates/system/menu/edit.html

@@ -10,7 +10,10 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">上级菜单:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" onclick="selectMenuTree()" id="treeName" readonly="true" th:value="${menu.parentName == null ? '无' : menu.parentName}"/>
+				    <div class="input-group">
+						<input class="form-control" type="text" onclick="selectMenuTree()" id="treeName" readonly="true" th:value="${menu.parentName == null ? '无' : menu.parentName}">
+					    <span class="input-group-addon"><i class="fa fa-search"></i></span>
+				    </div>
 				</div>
 			</div>
 			<div class="form-group">
@@ -24,7 +27,7 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">菜单名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="menuName" id="menuName" th:field="*{menuName}">
+					<input class="form-control" type="text" name="menuName" id="menuName" th:field="*{menuName}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -42,7 +45,7 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示排序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}">
+					<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -82,7 +85,6 @@
         			required:true,
         		},
         		menuName:{
-        			required:true,
         			remote: {
                         url: prefix + "/checkMenuNameUnique",
                         type: "post",
@@ -104,7 +106,6 @@
                     }
         		},
         		orderNum:{
-        			required:true,
         			digits:true
         		},
         	},
@@ -112,7 +113,8 @@
                 "menuName": {
                     remote: "菜单已经存在"
                 }
-            }
+            },
+            focusCleanup: true
         });
         
         function submitHandler() {

+ 2 - 6
ruoyi-admin/src/main/resources/templates/system/notice/add.html

@@ -10,7 +10,7 @@
 			<div class="form-group">	
 				<label class="col-sm-3 control-label">公告标题:</label>
 				<div class="col-sm-8">
-					<input id="noticeTitle" name="noticeTitle" class="form-control" type="text">
+					<input id="noticeTitle" name="noticeTitle" class="form-control" type="text" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -81,11 +81,7 @@
 	    }
 		
 		$("#form-notice-add").validate({
-			rules:{
-				noticeTitle:{
-					required:true,
-				}
-			}
+			focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 2 - 6
ruoyi-admin/src/main/resources/templates/system/notice/edit.html

@@ -11,7 +11,7 @@
             <div class="form-group">	
                 <label class="col-sm-3 control-label">公告标题:</label>
                 <div class="col-sm-8">
-                    <input id="noticeTitle" name="noticeTitle" th:field="*{noticeTitle}" class="form-control" type="text">
+                    <input id="noticeTitle" name="noticeTitle" th:field="*{noticeTitle}" class="form-control" type="text" required>
                 </div>
             </div>
             <div class="form-group">
@@ -86,11 +86,7 @@
 	    }
 	    
 		$("#form-notice-edit").validate({
-			rules:{
-				noticeTitle:{
-					required:true,
-				}
-			}
+			focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 7
ruoyi-admin/src/main/resources/templates/system/post/add.html

@@ -8,19 +8,19 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">岗位名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="postName" id="postName">
+					<input class="form-control" type="text" name="postName" id="postName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">岗位编码:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="postCode" id="postCode"/>
+					<input class="form-control" type="text" name="postCode" id="postCode" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示顺序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="postSort" id="postSort">
+					<input class="form-control" type="text" name="postSort" id="postSort" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -47,7 +47,6 @@
 		$("#form-post-add").validate({
 			rules:{
 				postName:{
-					required:true,
 					remote: {
 		                url: ctx + "system/post/checkPostNameUnique",
 		                type: "post",
@@ -63,7 +62,6 @@
 		            }
 				},
 				postCode:{
-					required:true,
 					remote: {
 		                url: ctx + "system/post/checkPostCodeUnique",
 		                type: "post",
@@ -79,7 +77,6 @@
 		            }
 				},
 				postSort:{
-					required:true,
 					digits:true
 				},
 			},
@@ -90,7 +87,8 @@
 		        "postName": {
 		            remote: "岗位名称已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 7
ruoyi-admin/src/main/resources/templates/system/post/edit.html

@@ -9,19 +9,19 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">岗位名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="postName" id="postName" th:field="*{postName}">
+					<input class="form-control" type="text" name="postName" id="postName" th:field="*{postName}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">岗位编码:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="postCode" id="postCode" th:field="*{postCode}"/>
+					<input class="form-control" type="text" name="postCode" id="postCode" th:field="*{postCode}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示顺序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="postSort" id="postSort" th:field="*{postSort}">
+					<input class="form-control" type="text" name="postSort" id="postSort" th:field="*{postSort}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -48,7 +48,6 @@
 		$("#form-post-edit").validate({
 			rules:{
 				postName:{
-					required:true,
 					remote: {
 		                url: ctx + "system/post/checkPostNameUnique",
 		                type: "post",
@@ -67,7 +66,6 @@
 		            }
 				},
 				postCode:{
-					required:true,
 					remote: {
 		                url: ctx + "system/post/checkPostCodeUnique",
 		                type: "post",
@@ -86,7 +84,6 @@
 		            }
 				},
 				postSort:{
-					required:true,
 					digits:true
 				},
 			},
@@ -97,7 +94,8 @@
 		        "postName": {
 		            remote: "岗位名称已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 7
ruoyi-admin/src/main/resources/templates/system/role/add.html

@@ -9,19 +9,19 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">角色名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="roleName" id="roleName"/>
+					<input class="form-control" type="text" name="roleName" id="roleName" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">权限字符:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="roleKey" id="roleKey">
+					<input class="form-control" type="text" name="roleKey" id="roleKey" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示顺序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="roleSort" id="roleSort">
+					<input class="form-control" type="text" name="roleSort" id="roleSort" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -67,7 +67,6 @@
 		$("#form-role-add").validate({
 			rules:{
 				roleName:{
-					required:true,
 					remote: {
 		                url: ctx + "system/role/checkRoleNameUnique",
 		                type: "post",
@@ -83,7 +82,6 @@
 		            }
 				},
 				roleKey:{
-					required:true,
 					remote: {
 		                url: ctx + "system/role/checkRoleKeyUnique",
 		                type: "post",
@@ -99,7 +97,6 @@
 		            }
 				},
 				roleSort:{
-					required:true,
 					digits:true
 				},
 			},
@@ -110,7 +107,8 @@
 		        "roleKey": {
 		            remote: "角色权限已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 5 - 7
ruoyi-admin/src/main/resources/templates/system/role/edit.html

@@ -10,19 +10,19 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label ">角色名称:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="roleName" id="roleName" th:field="*{roleName}"/>
+					<input class="form-control" type="text" name="roleName" id="roleName" th:field="*{roleName}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">权限字符:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="roleKey" id="roleKey" th:field="*{roleKey}">
+					<input class="form-control" type="text" name="roleKey" id="roleKey" th:field="*{roleKey}" required>
 				</div>
 			</div>
 			<div class="form-group">
 				<label class="col-sm-3 control-label">显示顺序:</label>
 				<div class="col-sm-8">
-					<input class="form-control" type="text" name="roleSort" id="roleSort" th:field="*{roleSort}">
+					<input class="form-control" type="text" name="roleSort" id="roleSort" th:field="*{roleSort}" required>
 				</div>
 			</div>
 			<div class="form-group">
@@ -68,7 +68,6 @@
 		$("#form-role-edit").validate({
 			rules:{
 				roleName:{
-					required:true,
 					remote: {
 		                url: ctx + "system/role/checkRoleNameUnique",
 		                type: "post",
@@ -87,7 +86,6 @@
 		            }
 				},
 				roleKey:{
-					required:true,
 					remote: {
 		                url: ctx + "system/role/checkRoleKeyUnique",
 		                type: "post",
@@ -106,7 +104,6 @@
 		            }
 				},
 				roleSort:{
-					required:true,
 					digits:true
 				},
 			},
@@ -117,7 +114,8 @@
 		        "roleKey": {
 		            remote: "角色权限已经存在"
 		        }
-		    }
+		    },
+		    focusCleanup: true
 		});
 
 		function edit() {

+ 11 - 17
ruoyi-admin/src/main/resources/templates/system/user/add.html

@@ -12,7 +12,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>用户名称:</label>
                         <div class="col-sm-8">
-                            <input name="userName" autocomplete="off" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30"/>
+                            <input name="userName" autocomplete="off" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" required>
                         </div>
                     </div>
                 </div>
@@ -20,7 +20,10 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>归属部门:</label>
                         <div class="col-sm-8">
-                            <input name="deptName" onclick="selectDeptTree()" id="treeName" readonly="readonly" type="text" placeholder="请选择归属部门" class="form-control"/>
+                            <div class="input-group">
+                            	<input name="deptName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择归属部门" class="form-control" required>
+                                <span class="input-group-addon"><i class="fa fa-search"></i></span>
+                            </div>
                         </div>
                     </div>
                 </div>
@@ -30,7 +33,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>手机号码:</label>
                         <div class="col-sm-8">
-                            <input name="phonenumber" autocomplete="off" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11"/>
+                            <input name="phonenumber" autocomplete="off" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" required>
                         </div>
                     </div>
                 </div>
@@ -38,7 +41,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>邮箱:</label>
                         <div class="col-sm-8">
-                            <input name="email" autocomplete="off" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱">
+                            <input name="email" autocomplete="off" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" required>
                         </div>
                     </div>
                 </div>
@@ -48,7 +51,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>登录账号:</label>
                         <div class="col-sm-8">
-                            <input name="loginName" placeholder="请输入登录账号" autocomplete="off" class="form-control required" type="text" maxlength="30">
+                            <input name="loginName" placeholder="请输入登录账号" autocomplete="off" class="form-control required" type="text" maxlength="30" required>
                         </div>
                     </div>
                 </div>
@@ -56,7 +59,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>登录密码:</label>
                         <div class="col-sm-8">
-                            <input name="password" placeholder="请输入登录密码" autocomplete="off" class="form-control" type="password" th:value="${@config.getKey('sys.user.initPassword')}">
+                            <input name="password" placeholder="请输入登录密码" autocomplete="off" class="form-control" type="password" th:value="${@config.getKey('sys.user.initPassword')}" required>
                         </div>
                     </div>
                 </div>
@@ -140,7 +143,6 @@
         $("#form-user-add").validate({
         	rules:{
         		loginName:{
-        			required:true,
         			minlength: 2,
         			maxlength: 20,
         			remote: {
@@ -157,19 +159,11 @@
                         }
                     }
         		},
-        		userName:{
-        			required:true,
-        		},
-        		deptName:{
-        			required:true,
-        		},
         		password:{
-        			required:true,
         			minlength: 5,
         			maxlength: 20
         		},
         		email:{
-        			required:true,
                     email:true,
                     remote: {
                         url: prefix + "/checkEmailUnique",
@@ -186,7 +180,6 @@
                     }
         		},
         		phonenumber:{
-        			required:true,
         			isPhone:true,
                     remote: {
                         url: prefix + "/checkPhoneUnique",
@@ -213,7 +206,8 @@
         		"phonenumber":{
                 	remote: "手机号码已经存在"
         		}
-            }
+            },
+            focusCleanup: true
         });
         
         function submitHandler() {

+ 9 - 13
ruoyi-admin/src/main/resources/templates/system/user/edit.html

@@ -13,7 +13,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>用户名称:</label>
                         <div class="col-sm-8">
-                            <input name="userName" autocomplete="off" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{userName}"/>
+                            <input name="userName" autocomplete="off" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{userName}" required>
                         </div>
                     </div>
                 </div>
@@ -21,7 +21,10 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>归属部门:</label>
                         <div class="col-sm-8">
-                            <input class="form-control" type="text" name="deptName" onclick="selectDeptTree()" readonly="true" id="treeName" th:field="*{dept.deptName}">
+                            <div class="input-group">
+                                <input class="form-control" type="text" name="deptName" onclick="selectDeptTree()" id="treeName" th:field="*{dept.deptName}" required>
+                            	<span class="input-group-addon"><i class="fa fa-search"></i></span>
+                            </div>
                         </div>
                     </div>
                 </div>
@@ -31,7 +34,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>手机号码:</label>
                         <div class="col-sm-8">
-                            <input name="phonenumber" autocomplete="off" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}"/>
+                            <input name="phonenumber" autocomplete="off" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}" required>
                         </div>
                     </div>
                 </div>
@@ -39,7 +42,7 @@
                     <div class="form-group">
                         <label class="col-sm-4 control-label"><span style="color: red; ">*</span>邮箱:</label>
                         <div class="col-sm-8">
-                            <input name="email" autocomplete="off" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}">
+                            <input name="email" autocomplete="off" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}" required>
                         </div>
                     </div>
                 </div>
@@ -130,14 +133,7 @@
         
         $("#form-user-edit").validate({
         	rules:{
-        		userName:{
-        			required:true,
-        		},
-        		deptName:{
-        			required:true,
-        		},
         		email:{
-        			required:true,
                     email:true,
                     remote: {
                         url: prefix + "/checkEmailUnique",
@@ -157,7 +153,6 @@
                     }
         		},
         		phonenumber:{
-        			required:true,
         			isPhone:true,
                     remote: {
                         url: prefix + "/checkPhoneUnique",
@@ -184,7 +179,8 @@
         		"phonenumber":{
                 	remote: "手机号码已经存在"
         		}
-            }
+            },
+            focusCleanup: true
         });
         
         function submitHandler() {

+ 2 - 1
ruoyi-admin/src/main/resources/templates/system/user/profile/edit.html

@@ -107,7 +107,8 @@
 				"phonenumber":{
 		        	remote: "手机号码已经存在"
 				}
-		    }
+		    },
+		    focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 2 - 1
ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html

@@ -76,7 +76,8 @@
 	                equalTo: "两次密码输入不一致"
 	            }
 
-	        }
+	        },
+	        focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 2 - 1
ruoyi-admin/src/main/resources/templates/system/user/resetPwd.html

@@ -29,7 +29,8 @@
 					minlength: 5,
 					maxlength: 20
 				},
-			}
+			},
+			focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 2 - 1
ruoyi-generator/src/main/resources/vm/html/add.html.vm

@@ -46,7 +46,8 @@
 				xxxx:{
 					required:true,
 				},
-			}
+			},
+			focusCleanup: true
 		});
 		
 		function submitHandler() {

+ 2 - 1
ruoyi-generator/src/main/resources/vm/html/edit.html.vm

@@ -47,7 +47,8 @@
 				xxxx:{
 					required:true,
 				},
-			}
+			},
+			focusCleanup: true
 		});
 		
 		function submitHandler() {