瀏覽代碼

优化新增部门时验证用户所属部门

RuoYi 3 年之前
父節點
當前提交
366459e8f3
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. 9 4
      ruoyi-admin/src/main/resources/templates/system/dept/add.html

+ 9 - 4
ruoyi-admin/src/main/resources/templates/system/dept/add.html

@@ -6,12 +6,12 @@
 <body class="white-bg">
 	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
 		<form class="form-horizontal m" id="form-dept-add">
-			<input id="treeId" name="parentId" type="hidden" th:value="${dept.deptId}"   />
+			<input id="treeId" name="parentId" type="hidden" th:value="${dept?.deptId}"   />
 			<div class="form-group">
-				<label class="col-sm-3 control-label">上级部门:</label>
+				<label class="col-sm-3 control-label is-required">上级部门:</label>
 				<div class="col-sm-8">
 				    <div class="input-group">
-						<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.deptName}">
+						<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept?.deptName}" required>
 					    <span class="input-group-addon"><i class="fa fa-search"></i></span>
 				    </div>
 				</div>
@@ -108,10 +108,15 @@
 	
 		/*部门管理-新增-选择父部门树*/
 		function selectDeptTree() {
+			var treeId = $("#treeId").val();
+			if ($.common.isEmpty(treeId)) {
+       			$.modal.alertWarning("请先添加用户所属的部门!");
+       			return;
+       		}
 			var options = {
 				title: '部门选择',
 				width: "380",
-				url: prefix + "/selectDeptTree/" + $("#treeId").val(),
+				url: prefix + "/selectDeptTree/" + treeId,
 				callBack: doSubmit
 			};
 			$.modal.openOptions(options);