public ActionResult GetTreeSelectJson()
        {
            var data     = equipmentTypeApp.GetList();
            var treeList = new List <TreeSelectModel>();

            foreach (EquipmentTypeEntity item in data)
            {
                TreeSelectModel treeModel = new TreeSelectModel();
                treeModel.id       = item.FId;
                treeModel.text     = item.FFullName;
                treeModel.parentId = item.FParentId;
                treeList.Add(treeModel);
            }
            return(Content(treeList.TreeSelectJson()));
        }
Ejemplo n.º 2
0
        public ActionResult GetUseItemPermissionTree(string FUserID = "", string FObjectType = "")
        {
            if (string.IsNullOrEmpty(FUserID))
            {
                FUserID = OperatorProvider.Provider.GetCurrent().UserId;
            }

            var treeList  = new List <TreeViewModel>();
            var Rightdata = itemRightApp.GetList(FUserID, FObjectType);

            switch (FObjectType)
            {
            default:
                var organizeList = organizeApp.GetPermissionGridList();
                var itemList     = organizeApp.GetList();

                foreach (var item in organizeList)
                {
                    TreeViewModel tree        = new TreeViewModel();
                    bool          hasChildren = itemList.Count(t => t.FParentId == item.FId) == 0 ? false : true;
                    tree.id          = item.FId;
                    tree.text        = item.FShortName;
                    tree.value       = item.FEnCode;
                    tree.parentId    = item.FParentId;
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    treeList.Add(tree);
                }
                break;

            case "EquipmentType":
                List <EquipmentTypeEntity> equipmentTypeList = new List <EquipmentTypeEntity>();
                equipmentTypeList = equipmentTypeApp.GetList();
                foreach (var item in equipmentTypeList)
                {
                    TreeViewModel tree        = new TreeViewModel();
                    bool          hasChildren = equipmentTypeList.Count(t => t.FParentId == item.FId) == 0 ? false : true;
                    tree.id          = item.FId;
                    tree.text        = item.FShortName;
                    tree.value       = item.FNumber;
                    tree.parentId    = item.FParentId;
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    treeList.Add(tree);
                }
                break;
            }

            return(Content(treeList.TreeViewJson()));
        }
Ejemplo n.º 3
0
        public ActionResult GetTreeJson()
        {
            var equipmentTypeList = equipmentTypeApp.GetList(); //获取所有设备类型
            var equipmentList     = equipmentApp.GetList();     //获取所有设备信息

            var treeList = new List <TreeViewModel>();

            foreach (EquipmentTypeEntity item in equipmentTypeList)
            {
                TreeViewModel tree        = new TreeViewModel();
                bool          hasChildren = (equipmentTypeList.Count(t => t.FParentId == item.FId) + equipmentList.Count(t => t.FEquipmentTypeId == item.FId)) == 0 ? false : true;
                tree.id          = item.FId;
                tree.text        = item.FShortName;
                tree.value       = item.FNumber;
                tree.parentId    = item.FParentId;
                tree.img         = "fa fa-folder-open";
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                treeList.Add(tree);
            }

            foreach (EquipmentEntity item in equipmentList)
            {
                TreeViewModel tree = new TreeViewModel();
                tree.id          = item.FId;
                tree.text        = item.FShortName;
                tree.value       = item.FNumber;
                tree.parentId    = item.FEquipmentTypeId;
                tree.img         = "fa fa-file-text-o";
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = false;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }