Example #1
0
        public override async void Edit()
        {
            try
            {
                if (GridModel == null)
                {
                    return;
                }
                UpdateLoading(true, "正在查询...");
                await UpdateMenuModules();

                var g = await service.GetGroupAsync(GridModel.Id);

                if (!g.success)
                {
                    await Msg.Warning("获取数据异常!");

                    return;
                }
                //其实这一步操作就是把当前用户组包含的权限,
                //绑定到所有菜单的列表当中,设定选中
                g.dynamicObj.GroupFuncs?.ForEach(f =>
                {
                    for (int i = 0; i < MenuModules.Count; i++)
                    {
                        var m = MenuModules[i];
                        if (m.MenuCode == f.MenuCode)
                        {
                            for (int j = 0; j < m.Modules.Count; j++)
                            {
                                if ((f.Auth & m.Modules[j].Value) == m.Modules[j].Value)
                                {
                                    m.Modules[j].IsChecked = true;
                                }
                            }
                        }
                    }
                });
                GroupHeader     = g.dynamicObj;//绑定编辑项GroupHeader
                SelectPageTitle = "编辑组信息";
                SelectPageIndex = 1;
                base.Edit();
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
            }
            finally
            {
                UpdateLoading(false);
            }
        }