示例#1
0
        public async Task <IActionResult> Index(string moduleKey)
        {
            var moduleInfo = await _moduleInfoManager.GetModuleInfo(moduleKey);

            if (moduleInfo == null)
            {
                throw new Exception($"Module {moduleKey} not found");
            }
            if (moduleInfo.IsInterModule)
            {
                throw new Exception($"Module {moduleKey} is inter Module");
            }

            return(View(moduleInfo));
        }
示例#2
0
        public async Task <IViewComponentResult> InvokeAsync(ModuleFormViewParam param)
        {
            //获取模块信息
            var moduleInfo = await _moduleManager.GetModuleInfo(param.ModuleKey);

            if (moduleInfo == null)
            {
                return(Content($"modulekey:{param.ModuleKey} not available"));
            }

            var vm = new ModuleFormViewModel()
            {
                ModuleInfo = moduleInfo
            };

            param.MapTo(vm);

            //使用默认视图
            if (vm.FormType == FormType.Add || vm.FormType == FormType.Edit)
            {
                return(View(vm));
            }
            //批量修改需要特殊处理
            if (vm.FormType == FormType.MultiEdit && !string.IsNullOrEmpty(vm.Data["Keys"].ToString()))
            {
                //如果有keys说明是第二步
                return(View("MultiEdit_Form", vm));
            }
            return(View(vm.FormType.ToString(), vm));
        }
示例#3
0
        /// <summary>
        /// 列信息
        /// </summary>
        /// <param name="moduleKey"></param>
        /// <returns></returns>
        public virtual async Task <IEnumerable <ColumnInfoDto> > GetColumnInfos(string moduleKey)
        {
            var tenantId = AbpSession.TenantId;

            //如果是Host登录,从session中获取账套信息
            if (AbpSession.MultiTenancySide == Abp.MultiTenancy.MultiTenancySides.Host)
            {
                tenantId = _httpContextAccessor.HttpContext.Session.Get <int?>("TenantId");
            }
            using (CurrentUnitOfWork.SetTenantId(tenantId))
            {
                var moduleInfo = await _moduleManager.GetModuleInfo(moduleKey);

                var columns = ObjectMapper.Map <List <ColumnInfoDto> >(moduleInfo.ColumnInfos.OrderBy(o => o.Sort));
                return(columns);
            }
        }
示例#4
0
        public async Task <IViewComponentResult> InvokeAsync(string moduleKey)
        {
            //获取模块信息
            var moduleInfo = await _moduleManager.GetModuleInfo(moduleKey);

            if (moduleInfo == null)
            {
                return(Content($"modulekey:{moduleKey} not available"));
            }

            return(View(moduleInfo));
        }
        public async Task <IViewComponentResult> InvokeAsync(ModuleTableViewParam param)
        {
            //获取模块信息
            var moduleInfo = await _moduleManager.GetModuleInfo(param.ModuleKey);

            if (moduleInfo == null)
            {
                return(Content($"modulekey:{param.ModuleKey} not available"));
            }

            var vm = new ModuleTableViewModel()
            {
                ModuleInfo   = moduleInfo,
                ColumnFilter = param.ColumnFilter
            };

            param.MapTo(vm);

            if (string.IsNullOrEmpty(vm.Filter))
            {
                vm.Filter = vm.ID;
            }

            if (string.IsNullOrEmpty(vm.DataUrl))
            {
                //todo:统一进行数据处理
                if (vm.ModuleInfo.IsInterModule)
                {
                    var pluginName = vm.ModuleInfo.GetData <string>("PluginName");
                    if (string.IsNullOrEmpty(pluginName) || pluginName == "core")
                    {
                        pluginName = "app";
                    }
                    vm.DataUrl = $"/api/services/{pluginName}/{param.ModuleKey}/GetPageResult";
                }
                else
                {
                    vm.DataUrl = $"/api/services/app/ModuleData/GetPageResult?moduleKey=" + param.ModuleKey;
                }
            }

            return(View(vm));
        }