324 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			324 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			C#
		
	
	
	
using Mysqlx.Crud;
 | 
						|
 | 
						|
namespace MasaBlazorApp3.Pojo
 | 
						|
{
 | 
						|
    [Serializable]
 | 
						|
    public class Premission
 | 
						|
    {
 | 
						|
 | 
						|
        public Premission Parent { get; set; } = null;
 | 
						|
 | 
						|
        public void AddChild(Premission item)
 | 
						|
        {
 | 
						|
            item.Parent = this;
 | 
						|
            this.Items = this.Items.Concat(new Premission[] { item });
 | 
						|
        }
 | 
						|
 | 
						|
        public int Id { get; set; }
 | 
						|
        public string PremissionName { get; set; }
 | 
						|
        /// <summary>
 | 
						|
        /// 菜单路径 
 | 
						|
        /// <summary>
 | 
						|
        public string PremissionPath { get; set; }
 | 
						|
 | 
						|
 | 
						|
        public IEnumerable<Premission> Items { get; set; } = Enumerable.Empty<Premission>();
 | 
						|
 | 
						|
        public List<Premission> getAdminPremission()
 | 
						|
        {
 | 
						|
            var list = new List<Premission>();
 | 
						|
            Premission q = new Premission
 | 
						|
            {
 | 
						|
                Id = 1,
 | 
						|
                PremissionName = "出库",
 | 
						|
                PremissionPath = "take"
 | 
						|
            };
 | 
						|
 | 
						|
            q.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 11,
 | 
						|
                PremissionName = "处方取药",
 | 
						|
                PremissionPath = "/take/order"
 | 
						|
            });
 | 
						|
            q.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 12,
 | 
						|
                PremissionName = "调拨取药",
 | 
						|
                PremissionPath = "/take/invoice"
 | 
						|
            });
 | 
						|
            q.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 13,
 | 
						|
                PremissionName = "抽屉取药",
 | 
						|
                PremissionPath = "/take/drawer"
 | 
						|
            });
 | 
						|
            q.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 14,
 | 
						|
                PremissionName = "自选取药",
 | 
						|
                PremissionPath = "/take/self"
 | 
						|
            });
 | 
						|
            q.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 15,
 | 
						|
                PremissionName = "取药记录",
 | 
						|
                PremissionPath = "/take/record/2"
 | 
						|
            });
 | 
						|
 | 
						|
            Premission j = new Premission
 | 
						|
            {
 | 
						|
                Id = 2,
 | 
						|
                PremissionName = "入库",
 | 
						|
                PremissionPath = "add"
 | 
						|
            };
 | 
						|
            j.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 21,
 | 
						|
                PremissionName = "调拨入库",
 | 
						|
                PremissionPath = "/add/invoice"
 | 
						|
            });
 | 
						|
            //j.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 22,
 | 
						|
            //    PremissionName = "请领入库",
 | 
						|
            //    PremissionPath = "/add/apply"
 | 
						|
            //});
 | 
						|
            j.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 23,
 | 
						|
                PremissionName = "抽屉入库",
 | 
						|
                PremissionPath = "/add/drawer"
 | 
						|
            });
 | 
						|
            j.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 24,
 | 
						|
                PremissionName = "入库记录",
 | 
						|
                PremissionPath = "/add/record/1"
 | 
						|
            });
 | 
						|
            Premission h = new Premission
 | 
						|
            {
 | 
						|
                Id = 3,
 | 
						|
                PremissionName = "归还",
 | 
						|
                PremissionPath = "return"
 | 
						|
            };
 | 
						|
 | 
						|
            //h.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 31,
 | 
						|
            //    PremissionName = "归还药品(处方)",
 | 
						|
            //    PremissionPath = "/return/order"
 | 
						|
            //});
 | 
						|
            h.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 32,
 | 
						|
                PremissionName = "归还药品(记录)",
 | 
						|
                PremissionPath = "/return/byRecord"
 | 
						|
            });
 | 
						|
            h.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 33,
 | 
						|
                PremissionName = "归还空瓶",
 | 
						|
                PremissionPath = "/return/empty"
 | 
						|
            });
 | 
						|
            h.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 34,
 | 
						|
                PremissionName = "归还记录(药品)",
 | 
						|
                PremissionPath = "/return/record1/31"
 | 
						|
            });
 | 
						|
            h.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 35,
 | 
						|
                PremissionName = "归还记录(空瓶)",
 | 
						|
                PremissionPath = "/return/record2/32"
 | 
						|
            });
 | 
						|
 | 
						|
            Premission k = new Premission
 | 
						|
            {
 | 
						|
                Id = 4,
 | 
						|
                PremissionName = "库存管理",
 | 
						|
                PremissionPath = "stock"
 | 
						|
            };
 | 
						|
            k.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 41,
 | 
						|
                PremissionName = "库存列表",
 | 
						|
                PremissionPath = "/stock/list"
 | 
						|
            });
 | 
						|
            k.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 42,
 | 
						|
                PremissionName = "库位绑定",
 | 
						|
                PremissionPath = "/stock/binding"
 | 
						|
            });
 | 
						|
            k.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 43,
 | 
						|
                PremissionName = "库存盘点",
 | 
						|
                //PremissionName = "盘点交接",
 | 
						|
                PremissionPath = "/stock/check"
 | 
						|
            });
 | 
						|
            k.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 44,
 | 
						|
                PremissionName = "盘点记录",
 | 
						|
                //PremissionPath = "/stock/checkRecord"
 | 
						|
                PremissionPath = "/stock/record/4"
 | 
						|
            });
 | 
						|
            k.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 45,
 | 
						|
                PremissionName = "药品信息",
 | 
						|
                PremissionPath = "/stock/drug"
 | 
						|
            });
 | 
						|
            //k.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 46,
 | 
						|
            //    PremissionName = "药品标定",
 | 
						|
            //    PremissionPath = "/stock/biaoDing"
 | 
						|
            //});
 | 
						|
            k.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 47,
 | 
						|
                PremissionName = "交接班列表",
 | 
						|
                PremissionPath = "/stock/Change"
 | 
						|
            });
 | 
						|
            Premission x = new Premission
 | 
						|
            {
 | 
						|
                Id = 5,
 | 
						|
                PremissionName = "系统管理",
 | 
						|
                PremissionPath = "manage"
 | 
						|
            };
 | 
						|
            x.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 51,
 | 
						|
                PremissionName = "用户管理",
 | 
						|
                PremissionPath = "/manage/user"
 | 
						|
            });
 | 
						|
            x.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 52,
 | 
						|
                PremissionName = "权限管理",
 | 
						|
                PremissionPath = "/manage/role"
 | 
						|
            });
 | 
						|
            Premission set = new Premission()
 | 
						|
            {
 | 
						|
                Id = 53,
 | 
						|
                PremissionName = "系统设置",
 | 
						|
                PremissionPath = "/manage/setting"
 | 
						|
                //PremissionPath = "/Box/Plan"
 | 
						|
            };
 | 
						|
            set.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 531,
 | 
						|
                PremissionName = "登录设置",
 | 
						|
                PremissionPath = "/manage/setting/login"
 | 
						|
 | 
						|
            });
 | 
						|
            set.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 532,
 | 
						|
                PremissionName = "冰箱设置",
 | 
						|
                PremissionPath = "/manage/setting/Fridge"
 | 
						|
 | 
						|
            });
 | 
						|
            //x.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 54,
 | 
						|
            //    PremissionName = "套餐管理",
 | 
						|
            //    PremissionPath = "/Box/Plan"
 | 
						|
            //});
 | 
						|
            //x.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 55,
 | 
						|
            //    PremissionName = "绑定药盒",
 | 
						|
            //    PremissionPath = "/Box/BoxBindings"
 | 
						|
            //});
 | 
						|
            //x.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 56,
 | 
						|
            //    PremissionName = "药盒核对",
 | 
						|
            //    PremissionPath = "/Box/Check"
 | 
						|
            //});
 | 
						|
            //x.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 57,
 | 
						|
            //    PremissionName = "药盒加药",
 | 
						|
            //    PremissionPath = "/Box/BoxAdd"
 | 
						|
            //});
 | 
						|
            //x.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 58,
 | 
						|
            //    PremissionName = "药盒入库",
 | 
						|
            //    PremissionPath = "/Box/BoxAddBox"
 | 
						|
            //});
 | 
						|
            //x.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 59,
 | 
						|
            //    PremissionName = "药盒库存",
 | 
						|
            //    PremissionPath = "/Box/BoxStock"
 | 
						|
            //});
 | 
						|
 | 
						|
 | 
						|
            Premission b = new Premission
 | 
						|
            {
 | 
						|
                Id = 6,
 | 
						|
                PremissionName = "药盒管理",
 | 
						|
                PremissionPath = "Box"
 | 
						|
            };
 | 
						|
            b.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 61,
 | 
						|
                PremissionName = "套餐管理",
 | 
						|
                PremissionPath = "/Box/Plan"
 | 
						|
            });
 | 
						|
            b.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 62,
 | 
						|
                PremissionName = "绑定药盒",
 | 
						|
                PremissionPath = "/Box/BoxBindings"
 | 
						|
            });
 | 
						|
            b.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 63,
 | 
						|
                PremissionName = "药盒核对",
 | 
						|
                //PremissionName = "盘点交接",
 | 
						|
                PremissionPath = "/Box/Check"
 | 
						|
            });
 | 
						|
            b.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 66,
 | 
						|
                PremissionName = "药盒加药",
 | 
						|
                //PremissionPath = "/stock/checkRecord"
 | 
						|
                PremissionPath = "/Box/BoxAdd"
 | 
						|
            });
 | 
						|
            //b.AddChild(new Premission()
 | 
						|
            //{
 | 
						|
            //    Id = 65,
 | 
						|
            //    PremissionName = "药盒入库",
 | 
						|
            //    PremissionPath = "/Box/BoxAddBox"
 | 
						|
            //});
 | 
						|
            b.AddChild(new Premission()
 | 
						|
            {
 | 
						|
                Id = 66,
 | 
						|
                PremissionName = "药盒库存",
 | 
						|
                PremissionPath = "/Box/BoxStock"
 | 
						|
            });
 | 
						|
            list.Add(q);
 | 
						|
            list.Add(j);
 | 
						|
            list.Add(h);
 | 
						|
            list.Add(k);
 | 
						|
            list.Add(b);
 | 
						|
            x.AddChild(set);
 | 
						|
            list.Add(x);
 | 
						|
 | 
						|
            return list;
 | 
						|
        }
 | 
						|
 | 
						|
        public bool HasChild()
 | 
						|
        {
 | 
						|
            return this.Items.Count() > 0;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |