/// <summary> /// /// </summary> /// <param name="list_department"></param> /// <param name="list_treeGrid"></param> /// <param name="pid"></param> private static void LoadComboTree(List<P_DepartmentInfo> list_department, List<EasyUIComboTree_Department> list_comboTree, int pid) { foreach (var item in list_department) { //如果权限父id=PDID if (item.PDID == pid) { Department_ViewModel model = new Department_ViewModel(); //根据当前的ActionInfo对象转换为Node节点 EasyUIComboTree_Department node = model.ToComboTreeNode(item); //将该节点 加入到 树节点集合中 list_comboTree.Add(node); LoadComboTree(list_department, node.children, node.id); } } }
/// <summary> /// 将部门实体对象集合转换为TreeGrid /// </summary> /// <param name="list_department"></param> /// <param name="list_treeGrid"></param> /// <param name="pid"></param> /// <param name="hasisPass">是否包含isPass标签</param> /// <param name="checkedIds">选中的部门实体对象的id数组</param> private static void LoadTreeGrid(List<P_DepartmentInfo> list_department, List<EasyUITreeGrid_Department> list_treeGrid, int pid, bool hasisPass, params int[] checkedIds) { foreach (var item in list_department) { //如果权限父id=PDID if (item.PDID == pid) { Department_ViewModel model = new Department_ViewModel(); //根据当前的ActionInfo对象转换为Node节点 EasyUITreeGrid_Department node; if (checkedIds != null && checkedIds.Length > 0) { node = model.ToNode(item, hasisPass, checkedIds.Contains(item.DID)); } else { if (hasisPass) node = model.ToNode(item, hasisPass); else { node = model.ToNode(item, hasisPass); } } //将该节点 加入到 树节点集合中 list_treeGrid.Add(node); LoadTreeGrid(list_department, node.children, node.DID, hasisPass, checkedIds); } } }