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() + "}"); }