public JsonResult GetWorkflowPackage(string id, string objectType, string parentId, string parentCode) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); string bizTreeCode = string.Empty; if (!string.IsNullOrEmpty(id)) { var bizTreeNode = this.Engine.FunctionAclManager.GetFunctionNode(id); bizTreeCode = bizTreeNode.Code; OThinker.Reporting.ReportPage schema = this.Engine.ReportManager.GetReportPage(bizTreeNode.Code); if (schema == null) { schema = this.Engine.ReportManager.GetReportPage(bizTreeNode.Code); } ReportPagePackageViewModel report = new ReportPagePackageViewModel() { ObjectID = bizTreeNode.ObjectID, Code = bizTreeNode.Code, DisplayName = bizTreeNode.DisplayName, Folder = bizTreeNode.ParentCode, SortKey = bizTreeNode.SortKey.ToString(), CheckedUser = bizTreeNode.IsLocked ? this.Engine.Organization.GetName(bizTreeNode.LockedBy) : "Reporting.UnLocked", ParentId = parentId, ObjectType = objectType }; result.Extend = new { WorkflowPackage = report, Folders = GetFloders(objectType, parentId) }; } else { result.Extend = new { WorkflowPackage = new ReportPagePackageViewModel() { Folder = string.IsNullOrWhiteSpace(parentCode) ? this.Engine.FunctionAclManager.GetFunctionNode(parentId).Code : parentCode, SortKey = "1", ParentId = parentId, ObjectType = objectType }, Folders = GetFloders(objectType, parentId) }; } return Json(result.Extend, JsonRequestBehavior.AllowGet); })); }
/// <summary> /// 保存报表数据到function /// </summary> /// <param name="model">工作流程信息</param> /// <returns>是否成功</returns> private ActionResult SavePackage(ReportPagePackageViewModel model) { ActionResult result = new ActionResult(); FunctionNode functionNode = new FunctionNode(); if (string.IsNullOrEmpty(model.ObjectID)) { if (!ValidateExist(model.Code, out result)) { return(result); } functionNode.ParentCode = model.Folder; functionNode.Code = model.Code.Trim(); functionNode.NodeType = FunctionNodeType.ReportFolderPage; functionNode.IconCss = "fa icon-charubiaoge"; int sortKey; if (Int32.TryParse(model.SortKey, out sortKey)) { functionNode.SortKey = sortKey; } functionNode.DisplayName = model.DisplayName.Trim(); functionNode.Url = "Reporting/IndexInfo.html&RportCode=" + model.Code.Trim(); if (model.Folder == "ReportModel") { FunctionNode fun = this.Engine.FunctionAclManager.GetFunctionNodeByCode(model.Folder); if (fun != null) { result.Extend = fun.ObjectID; } } else { result.Extend = model.ParentId; } //添加功能节点 result.Success = this.Engine.FunctionAclManager.AddFunctionNode(functionNode) == ErrorCode.SUCCESS; string code = model.Code.Trim(); //新增报表页 OThinker.Reporting.ReportPage report = new OThinker.Reporting.ReportPage(); report.ObjectID = Guid.NewGuid().ToString(); report.Code = code; report.Creator = this.UserValidator.UserID; report.DisplayName = model.DisplayName; report.CreatedTime = DateTime.Now; report.ParentObjectID = model.ParentId; report.ParentPropertyName = ""; if (result.Success == true) { result.Success = this.Engine.ReportManager.AddReportPage(report); } } else { functionNode = this.Engine.FunctionAclManager.GetFunctionNode(model.ObjectID); int sortKey; if (Int32.TryParse(model.SortKey, out sortKey)) { functionNode.SortKey = sortKey; } functionNode.DisplayName = model.DisplayName.Trim(); string nodeParentId = this.Engine.FunctionAclManager.GetFunctionNodeByCode(functionNode.ParentCode).ObjectID; functionNode.ParentCode = model.Folder; result.Success = this.Engine.FunctionAclManager.UpdateFunctionNode(functionNode) == ErrorCode.SUCCESS; result.Extend = nodeParentId; } return(result); }