Browse Source

部门选择设置默认值

RuoYi 6 years ago
parent
commit
c42f2d9f3a

+ 1 - 1
src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java

@@ -134,7 +134,7 @@ public class DeptController extends BaseController
     @GetMapping("/selectDeptTree/{deptId}")
     public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
     {
-        mmap.put("treeName", deptService.selectDeptById(deptId).getDeptName());
+        mmap.put("dept", deptService.selectDeptById(deptId));
         return prefix + "/tree";
     }
 

+ 1 - 2
src/main/resources/templates/system/dept/add.html

@@ -100,8 +100,7 @@
 	
 		/*部门管理-新增-选择父部门树*/
 		function selectDeptTree() {
-			var treeId = $("#treeId").val();
-        	var deptId = treeId == null || treeId == "" ? "100" : treeId;
+			var deptId = $("#treeId").val();
 			var url = prefix + "/selectDeptTree/" + deptId;
 			$.modal.open("选择部门", url, '380', '380');
 		}

+ 1 - 2
src/main/resources/templates/system/dept/edit.html

@@ -103,8 +103,7 @@
 	
 		/*部门管理-修改-选择部门树*/
 		function selectDeptTree() {
-			var treeId = $("#treeId").val();
-        	var deptId = treeId == null || treeId == "" ? "100" : treeId;
+			var deptId = $("#treeId").val();
 		    var url = prefix + "/selectDeptTree/" + deptId;
 		    $.modal.open("选择部门", url, '380', '380');
 		}

+ 2 - 2
src/main/resources/templates/system/dept/tree.html

@@ -8,8 +8,8 @@ body{height:auto;font-family: "Microsoft YaHei";}
 button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
 </style>
 <body class="hold-transition box box-main">
-	<input id="treeId"   name="treeId"    type="hidden"/>
-	<input id="treeName" name="treeName"  type="hidden" th:value="${treeName}"/>
+	<input id="treeId"   name="treeId"    type="hidden" th:value="${dept.deptId}"/>
+	<input id="treeName" name="treeName"  type="hidden" th:value="${dept.deptName}"/>
 	<div class="wrapper"><div class="treeShowHideButton" onclick="search();">
 		<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
 		<label id="btnHide" title="隐藏搜索">︽</label>