Ejemplo n.º 1
0
        public string QueryCompleted()
        {
            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() ? "CompletedTime1" : sidx) + " " + (sord.IsNullOrEmpty() ? "ASC" : sord);
            int    size   = Tools.GetPageSize();
            int    number = Tools.GetPageNumber();

            Business.FlowTask flowTask  = new Business.FlowTask();
            DataTable         dataTable = flowTask.GetCompletedTask(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(
                    "<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;\"><i class=\"fa fa-file-text-o\"></i>表单</a>" +
                    "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"detail('" + dr["FlowId"] + "','" + dr["GroupId"] + "','" + dr["Id"] + "');return false;\"><i class=\"fa fa-navicon\"></i>过程</a>");
                bool isHasten = flowTask.IsHasten(dr["Id"].ToString().ToGuid(), out bool isWithdraw);
                if (isWithdraw)
                {
                    opation.Append("<a class=\"list\" href=\"javascript:void(0);\" onclick=\"withdraw('" + dr["Id"] + "','" + dr["GroupId"] + "');return false;\"><i class=\"fa fa-mail-reply\"></i>收回</a>");
                }
                if (isHasten)
                {
                    opation.Append("<a class=\"list\" href=\"javascript:void(0);\" onclick=\"hasten('" + dr["Id"] + "','" + dr["GroupId"] + "');return false;\"><i class=\"fa fa-bullhorn\"></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 note = dr["Note"].ToString();
                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() },
                    { "CompletedTime", dr["CompletedTime1"].ToString().ToDateTime().ToDateTimeString() },
                    { "Note", note },
                    { "Opation", opation.ToString() }
                };
                jArray.Add(jObject);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + size + ",\"pagenumber\":" + number + "},\"rows\":" + jArray.ToString() + "}");
        }