Example #1
0
        private JSTreeNode GenerateParentNode(int id)
        {
            JSTreeNode nodeM = new JSTreeNode();

            nodeM.hasChildren = true;
            nodeM.id          = id.ToString();
            nodeM.text        = AppConfig.Get("QYDeptRootName");
            nodeM.type        = "root";
            //nodeM.icon = "root";
            //nodeM.value = Guid.Empty.ToString();
            nodeM.data = new Dictionary <string, string>()
            {
                { "type", "0" }, { "isexpand", "true" }
            };
            //nodeM.isexpand = true;
            //nodeM.complete = true;

            return(nodeM);
        }
Example #2
0
        private void SetTreeChildren(List <GROUP_INFO> cuAllList, ref JSTreeNode pNode, int pid, List <int> excludeIDs)
        {
            if (!pNode.hasChildren)
            {
                return;
            }
            var childList = cuAllList.FindAll(c => c.PARENT_ID == pid);

            foreach (var item in childList)
            {
                if (excludeIDs.Contains(item.ID))
                {
                    continue;
                }
                JSTreeNode node = new JSTreeNode();
                node.id   = item.ID.ToString();
                node.text = item.NAME;
                //node.value = item.ID.ToString();
                //node.isexpand = false;
                node.data = new Dictionary <string, string>()
                {
                    { "type", item.TYPE.ToString() }
                };
                //node.complete = true;
                pNode.children.Add(node);
                if (item.TYPE != 3) //大区or区域
                {
                    node.type        = "folder";
                    node.hasChildren = (cuAllList.Count(r => r.PARENT_ID == item.ID) > 0);
                    SetTreeChildren(cuAllList, ref node, item.ID, excludeIDs);
                }
                else
                {
                    node.type        = "file";
                    node.hasChildren = false;
                }
            }
        }