//Report/Report2 //[HttpPost] public IActionResult Report2(string ReportID, string Params, string dataSourceUrl, string dbConnStringKey, string filterId, int pageIndex = 1, int perCount = 10) { //获取用户权限列表 var list = _permmisionService.GetFilterByUserId(DataContext.UserId, ReportID); var filter = "#all";//未配置数据权限时 默认取所有数据 if (list.Any()) { filter = list[0].filter_script; } //过滤脚本 //1=1 //#self //unitid in var filterScript = filter.Replace("#self", "uid='" + DataContext.UserId + "'"). Replace("#all", "1=1"). Replace("#unit", "unit_id in (" + _permmisionService.GetOrgIdByUserId(DataContext.UserId).Select(a => "'" + a + "'").ToList().PackString(',') + ")"); var config = dataSourceUrl.HasValue() ? _reportServices.ToView(ReportID, Params, new HttpClinetUtility(HttpContext).HttpGet <List <List <string> > >(GeRootUrl(dataSourceUrl)), pageIndex, perCount, filterScript) : _reportServices.ToView(ReportID, Params, dbConnStringKey, pageIndex, perCount, filterScript); config.DataFilter = list; config.pageParam.uid = DataContext.UserId; return(Json(State.Success, config, false)); }
//Report/Report2 //[HttpPost] public ActionResult Report2(string ReportID, string Params, string dataSourceUrl, string dbConnStringKey, int pageIndex = 1, int perCount = 10) { var config = dataSourceUrl.HasValue() ? reportServices.ToView(ReportID, Params, HttpGet <List <List <string> > >(GeRootUrl(dataSourceUrl)), pageIndex, perCount) : reportServices.ToView(ReportID, Params, dbConnStringKey, pageIndex, perCount); return(Json(config, JsonRequestBehavior.AllowGet)); }
//Report/Report2 //[HttpPost] public ActionResult Report2(string ReportID, string Params, string dataSourceUrl, string dbConnStringKey, string uid, string filterId, int pageIndex = 1, int perCount = 10) { //获取用户权限列表 // var list = _permmisionService.GetFilterByUserId(uid, ReportID); // var filter = filterId.HasValue() ? list.FirstOrDefault(a => a.data_filter_id == filterId) : list.FirstOrDefault(); var filterScript = "1=1";// filter == null?"": filter.filter_script; var config = dataSourceUrl.HasValue() ? _reportServices.ToView(ReportID, Params, HttpGet <List <List <string> > >(GeRootUrl(dataSourceUrl)), pageIndex, perCount, filterScript) : _reportServices.ToView(ReportID, Params, dbConnStringKey, pageIndex, perCount, filterScript); // config.DataFilter = list; return(Json(config, JsonRequestBehavior.AllowGet)); }