public IActionResult InstanceManage() { string groupId = Request.Querys("groupid"); Business.FlowTask flowTask = new Business.FlowTask(); var groupTasks = flowTask.GetListByGroupId(groupId.ToGuid()); Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); foreach (var groupTask in groupTasks) { Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject(); string opation = "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"cngStatus('" + groupTask.Id.ToString() + "');\"><i class=\"fa fa-exclamation\"></i>状态</a>"; if (groupTask.ExecuteType.In(0, 1) && 5 != groupTask.TaskType) { opation += "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"designate('" + groupTask.Id.ToString() + "');\"><i class=\"fa fa-hand-o-right\"></i>指派</a>" + "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"goTo('" + groupTask.Id.ToString() + "');\"><i class=\"fa fa-level-up\"></i>跳转</a>"; } jObject.Add("id", groupTask.Id); jObject.Add("StepID", groupTask.StepName); jObject.Add("SenderName", groupTask.SenderName); jObject.Add("ReceiveTime", groupTask.ReceiveTime.ToDateTimeString()); jObject.Add("ReceiveName", groupTask.ReceiveName); jObject.Add("CompletedTime1", groupTask.CompletedTime1.HasValue ? groupTask.CompletedTime1.Value.ToDateTimeString() : ""); jObject.Add("Status", flowTask.GetExecuteTypeTitle(groupTask.ExecuteType)); jObject.Add("Comment", groupTask.Comments); jObject.Add("Note", groupTask.Note); jObject.Add("Opation", opation); jArray.Add(jObject); } ViewData["json"] = jArray.ToString(); ViewData["appid"] = Request.Querys("appid"); ViewData["iframeid"] = Request.Querys("iframeid"); return(View()); }
/// <summary> /// 查询我的已委托事项 /// </summary> /// <returns></returns> public string QueryMyEntrust() { string appid = Request.Querys("appid"); string tabid = Request.Querys("tabid"); string flowid = Request.Forms("flowid"); string title = Request.Forms("title"); string date1 = Request.Forms("date1"); string date2 = Request.Forms("date2"); string sidx = Request.Forms("sidx"); string sord = Request.Forms("sord"); string order = (sidx.IsNullOrEmpty() ? "ReceiveTime" : sidx) + " " + (sord.IsNullOrEmpty() ? "ASC" : sord); int size = Tools.GetPageSize(); int number = Tools.GetPageNumber(); Business.FlowTask flowTask = new Business.FlowTask(); DataTable dataTable = flowTask.GetEntrustTask(size, number, Current.UserId, flowid, title, date1, date2, order, out int count); Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); foreach (DataRow dr in dataTable.Rows) { int openModel = 0, width = 0, height = 0; StringBuilder opation = new StringBuilder(); bool isEntrustWithdraw = flowTask.IsEntrustWithdraw(dr["Id"].ToString().ToGuid()); if (isEntrustWithdraw) { opation.Append("<a class=\"list\" href=\"javascript:void(0);\" onclick=\"withdraw('" + dr["Id"] + "');return false;\"><i class=\"fa fa-mail-reply\"></i>收回</a>"); } string taskTitle = "<a href=\"javascript:void(0);\" class=\"list\" onclick=\"openTask('" + Url.Content("~/RoadFlowCore/FlowRun/Index") + "?" + string.Format("flowid={0}&stepid={1}&instanceid={2}&taskid={3}&groupid={4}&appid={5}&display=1", dr["FlowId"], dr["StepId"], dr["InstanceId"], dr["Id"], dr["GroupId"], appid ) + "','" + dr["Title"].ToString().RemoveHTML().UrlEncode() + "','" + dr["Id"] + "'," + openModel + "," + width + "," + height + ");return false;\">" + dr["Title"] + "</a>"; string status = flowTask.GetExecuteTypeTitle(dr["ExecuteType"].ToString().ToInt()); Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "id", dr["Id"].ToString() }, { "Title", taskTitle }, { "FlowName", dr["FlowName"].ToString() }, { "StepName", dr["StepName"].ToString() }, { "SenderName", dr["SenderName"].ToString() }, { "ReceiveTime", dr["ReceiveTime"].ToString().ToDateTime().ToDateTimeString() }, { "ReceiveName", dr["ReceiveName"].ToString() }, { "Status", status }, { "Opation", opation.ToString() } }; jArray.Add(jObject); } return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + size + ",\"pagenumber\":" + number + "},\"rows\":" + jArray.ToString() + "}"); }
public IActionResult DetailSubFlow() { string taskid = Request.Querys("taskid"); string ismobile = Request.Querys("ismobile"); if (!taskid.IsGuid(out Guid taskId)) { return(new ContentResult() { Content = "任务ID错误!" }); } Business.FlowTask flowTask = new Business.FlowTask(); var currentTask = flowTask.Get(taskId); if (null == currentTask) { return(new ContentResult() { Content = "未找到当前任务!" }); } if (currentTask.SubFlowGroupId.IsNullOrWhiteSpace()) { return(new ContentResult() { Content = "未找到当前任务的子流程任务!" }); } string[] subFlowGroupIds = currentTask.SubFlowGroupId.Split(','); if (subFlowGroupIds.Length == 1) { var groupTasks = flowTask.GetListByGroupId(subFlowGroupIds[0].ToGuid()); if (groupTasks.Count > 0) { return(Redirect("Detail?flowid=" + groupTasks.First().FlowId + "&stepid=" + groupTasks.First().StepId + "&groupid=" + subFlowGroupIds[0] + "&taskid=" + groupTasks.First().Id + "&appid=" + Request.Querys("appid") + "&tabid=" + Request.Querys("tabid") + "&iframeid=" + Request.Querys("iframeid") + "&ismobile=" + ismobile)); } } else { Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); foreach (var id in subFlowGroupIds) { var groupTasks = flowTask.GetListByGroupId(id.ToGuid()); if (groupTasks.Count == 0) { continue; } var groupTask = groupTasks.First(); Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "FlowName", groupTask.FlowName }, { "StepName", groupTask.StepName }, { "SenderName", groupTask.SenderName }, { "SenderTime", groupTask.ReceiveTime.ToDateTimeString() }, { "ReceiveName", groupTask.ReceiveName }, { "CompletedTime1", groupTask.CompletedTime1.HasValue ? groupTask.CompletedTime1.Value.ToShortDateString() : "" }, { "StatusTitle", flowTask.GetExecuteTypeTitle(groupTask.ExecuteType) }, { "Show", "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"detail('" + groupTask.FlowId + "', '" + groupTask.GroupId + "');return false;\"><i class=\"fa fa-search\"></i>查看</a>" } }; jArray.Add(jObject); } ViewData["json"] = jArray.ToString(); ViewData["ismobile"] = ismobile; } return(View()); }
public IActionResult Detail() { string flowid = Request.Querys("flowid"); string groupid = Request.Querys("groupid"); string taskid = Request.Querys("taskie"); string appid = Request.Querys("appid"); string tabid = Request.Querys("tabid"); string displaymodel = Request.Querys("displaymodel"); string ismobile = Request.Querys("ismobile"); Business.FlowTask bflowTask = new Business.FlowTask(); var flowTasks = bflowTask.GetListByGroupId(groupid.ToGuid()); //判断不是流程参与者不能查看 if (!flowTasks.Exists(p => p.ReceiveId == Current.UserId)) { return(new ContentResult() { Content = "您不是流程参与者,不能查看!" }); } Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); Newtonsoft.Json.Linq.JArray jArray1 = new Newtonsoft.Json.Linq.JArray(); foreach (var flowTask in flowTasks) { string stepName = flowTask.StepName; if (!flowTask.SubFlowGroupId.IsNullOrWhiteSpace()) { stepName = "<a href=\"javascript:;\" class=\"blue1\" onclick=\"showSubFlow('" + flowTask.Id + "')\">" + stepName + "</a>"; } Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "StepName", stepName }, { "SenderName", flowTask.SenderName }, { "SenderTime", flowTask.ReceiveTime.ToDateTimeString() }, { "ReceiveName", flowTask.ReceiveName }, { "CompletedTime1", flowTask.CompletedTime1.ToDateTimeString() }, { "StatusTitle", bflowTask.GetExecuteTypeTitle(flowTask.ExecuteType) }, { "Comment", flowTask.Comments }, { "Note", flowTask.Note } }; jArray.Add(jObject); if (true) { Newtonsoft.Json.Linq.JObject jObject1 = new Newtonsoft.Json.Linq.JObject { { "stepid", flowTask.StepId }, { "prevstepid", flowTask.PrevStepId }, { "status", flowTask.Status }, { "sender", flowTask.SenderName }, { "sendtime", flowTask.ReceiveTime.ToDateTimeString() }, { "receiver", flowTask.ReceiveName }, { "completedtime1", flowTask.CompletedTime1.ToDateTimeString() }, { "comment", flowTask.Comments }, { "sort", flowTask.Sort }, { "tasktype", flowTask.TaskType }, { "statustitle", bflowTask.GetExecuteTypeTitle(flowTask.ExecuteType) } }; jArray1.Add(jObject1); } } ViewData["json"] = jArray.ToString(); ViewData["json1"] = jArray1.ToString(); ViewData["displaymodel"] = displaymodel.IsNullOrWhiteSpace() ? "0" : displaymodel; ViewData["tabid"] = tabid; ViewData["query"] = "flowid=" + flowid + "&stepid=" + Request.Querys("stepid") + "&groupid=" + groupid + "&taskid=" + taskid + "&appid=" + appid + "&tabid=" + tabid + "&iframeid=" + Request.Querys("iframeid") + "&ismobile=" + ismobile; ViewData["flowid"] = flowid; ViewData["ismobile"] = ismobile; //判断如果有动态步骤,流程图要从rf_flowdynamic表中取 var dynamicSteps = Config.EnableDynamicStep ? flowTasks.Where(p => p.BeforeStepId.IsNotEmptyGuid()).OrderByDescending(p => p.Sort).ToList() : new List <Model.FlowTask>(); if (dynamicSteps.Count > 0) { ViewData["stepid"] = dynamicSteps.First().BeforeStepId.ToString(); ViewData["groupid"] = dynamicSteps.First().GroupId.ToString(); } else { ViewData["stepid"] = string.Empty; ViewData["groupid"] = string.Empty; } return(View()); }
public string QueryInstance() { string appid = Request.Querys("appid"); string tabid = Request.Querys("tabid"); string FlowID = Request.Forms("FlowID"); string Title = Request.Forms("Title"); string ReceiveID = Request.Forms("ReceiveID"); string Date1 = Request.Forms("Date1"); string Date2 = Request.Forms("Date2"); string sidx = Request.Forms("sidx"); string sord = Request.Forms("sord"); string order = (sidx.IsNullOrEmpty() ? "ReceiveTime" : sidx) + " " + (sord.IsNullOrEmpty() ? "DESC" : sord); int size = Tools.GetPageSize(); int number = Tools.GetPageNumber(); Business.FlowTask flowTask = new Business.FlowTask(); Guid userId = new Business.User().GetUserId(ReceiveID); if (FlowID.IsNullOrWhiteSpace()) { FlowID = new Business.Flow().GetManageInstanceFlowIds(Current.UserId).JoinSqlIn(); } DataTable dataTable = flowTask.GetInstanceList(size, number, FlowID, Title, userId.IsEmptyGuid() ? "" : userId.ToString(), Date1, Date2, order, out int count); Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); foreach (DataRow dr in dataTable.Rows) { var groupTasks = flowTask.GetListByGroupId(dr["GroupId"].ToString().ToGuid()); Model.FlowTask taskModel = null; if (!Title.IsNullOrWhiteSpace()) { taskModel = groupTasks.Where(p => p.Title.ContainsIgnoreCase(Title)).OrderByDescending(p => p.Sort).ThenBy(p => p.Status).First(); } if (null == taskModel) { taskModel = groupTasks.OrderByDescending(p => p.Sort).ThenBy(p => p.Status).First(); } int openModel = 0, width = 0, height = 0; string opation = "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"manage('" + taskModel.Id.ToString() + "', '" + taskModel.GroupId.ToString() + "');\"><i class=\"fa fa-check-square-o\"></i>管理</a>"; //if (taskModel.ExecuteType.In(-1, 0, 1)) //{ opation += "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"delete1('" + taskModel.Id.ToString() + "', '" + taskModel.GroupId.ToString() + "');\"><i class=\"fa fa-trash-o\"></i>删除</a>"; //} string status = flowTask.GetExecuteTypeTitle(taskModel.ExecuteType); string taskTitle = "<a href=\"javascript:void(0);\" class=\"list\" onclick=\"openTask('" + Url.Content("~/RoadFlowCore/FlowRun/Index") + "?" + string.Format("flowid={0}&stepid={1}&instanceid={2}&taskid={3}&groupid={4}&appid={5}&display=1", taskModel.FlowId.ToString(), taskModel.StepId.ToString(), taskModel.InstanceId, taskModel.Id.ToString(), taskModel.GroupId.ToString(), appid ) + "','" + taskModel.Title.TrimAll() + "','" + taskModel.Id.ToString() + "'," + openModel + "," + width + "," + height + ");return false;\">" + taskModel.Title + "</a>"; Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "id", taskModel.Id.ToString() }, { "Title", taskTitle }, { "FlowName", taskModel.FlowName }, { "StepName", taskModel.StepName }, { "ReceiveName", taskModel.ReceiveName }, { "ReceiveTime", taskModel.ReceiveTime.ToDateTimeString() }, { "StatusTitle", status }, { "Opation", opation } }; jArray.Add(jObject); } return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + size + ",\"pagenumber\":" + number + "},\"rows\":" + jArray.ToString() + "}"); }