public IActionResult GetPowers(AuthorizationQueryModel queryModel)
        {
            var powers = powerDataService.GetList(queryModel.AppInfoID).MapperList <ExternalFunctionPowerViewModel, FunctionPower>();

            if (queryModel.Type.HasValue)
            {
                var departmentID = queryModel.NodeID;
                if (queryModel.Type == FunctionPowerType.Role)
                {
                    var role = roleDataService.Get(queryModel.NodeID);
                    departmentID = role.DepartmentID;
                }
                var departmentPowers = departmentDataService.GetPowers(departmentID, queryModel.AppInfoID);
                //赋予选中
                departmentPowers.ForEach(x => powers.Where(y => y.ID == x.FunctionPowerID).First().State = new ExternalFunctionPowerViewModelState {
                    Checked = true
                });
                if (queryModel.Type == FunctionPowerType.Role)
                {
                    foreach (var item in powers)
                    {
                        if (item.State != null && item.State.Checked)
                        {
                            item.Requisite = true;
                            item.Color     = "silver";
                            item.Icon      = "vp-requisite";
                            item.State     = new ExternalFunctionPowerViewModelState
                            {
                                Checked = true
                            };
                        }
                    }
                    var rolePowers = roleDataService.GetPowers(queryModel.NodeID, queryModel.AppInfoID);
                    rolePowers.ForEach(x =>
                                       powers.Where(y => y.ID == x.FunctionPowerID).First().State = new ExternalFunctionPowerViewModelState {
                        Checked = true
                    }
                                       );
                }
            }
            powers = ExternalFunctionPowerSort.Sort(powers);
            return(Json(powers));
        }
        public IActionResult Index(int?ID)
        {
            var appInfoList = appInfoDataService.GetList();

            if (!ID.HasValue)
            {
                if (appInfoList.Count() == 0)
                {
                    throw new Exception("暂无程序信息");
                }
                ID = appInfoList.First().ID;
            }
            var list = ExternalFunctionPowerSort.Sort(functionPowerDataService.GetList(ID.Value).MapperList <ExternalFunctionPowerViewModel, FunctionPower>());

            ViewBag.List = list;
            FunctionPower functionPower = new FunctionPower
            {
                AppInfoID = ID.Value
            };

            return(View(functionPower));
        }