//编辑部门 public ActionResult EditDept(int deptId = 0, int parentId = 0) { SysDepartment dept = _deptManager.GetDeptById(deptId); if (dept == null) { var parentName = CurrentTenant.TenantName; if (parentId > 0) { var p = _deptManager.GetDeptById(parentId); if (p != null) { parentName = p.DeptName; } else { parentId = 0; } } dept = new SysDepartment() { ParentId = parentId, ParentName = parentName }; } else if (dept.ParentId == 0) { dept.ParentName = CurrentTenant.TenantName; } return(View(dept)); }
private EasyuiTreeNode GetChildDeptsByApprove(SysDepartment dept, IEnumerable <SysDepartment> all, int[] deptIds, int parentDeptId, int wayType) { var node = new EasyuiTreeNode { id = dept.DeptId.ToString(), @checked = false }; int originalApprovedept; if (dept.DeptId == parentDeptId) { node.text = dept.DeptName; } else if (deptIds.Contains(dept.DeptId)) { node.text = "<input type='checkbox' value='" + dept.DeptId + "' checked='checked' />" + dept.DeptName; } else if (_approveWayManager.CanSetApproveWay(parentDeptId, dept.DeptId, wayType, CurrentTenant.TenantId, out originalApprovedept)) { node.text = "<input type='checkbox' value='" + dept.DeptId + "' />" + dept.DeptName; if (originalApprovedept != -1) { node.text += string.Format(RetechWing.LanguageResources.SystemManage.ApproveLang.String5, _deptManager.GetDeptById(originalApprovedept).DeptName); } } else { node.text = dept.DeptName + string.Format(RetechWing.LanguageResources.SystemManage.ApproveLang.String5, _deptManager.GetDeptById(originalApprovedept).DeptName); } var tmp = all.Where(p => p.ParentId == dept.DeptId); if (tmp.Any()) { foreach (var item in tmp) { node.children.Add(GetChildDeptsByApprove(item, all, deptIds, parentDeptId, wayType)); } } return(node); }