效果图
前端代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyTaskInfo.aspx.cs" Inherits="BRC.Workflow.Portal.Web.WebPages.MyTaskInfo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link href="../WebResource/Plugins/BootStrap/css/bootstrap-font.min.css" rel="stylesheet" />
<link href="../WebResource/Plugins/WEUI-CSS/dist/style/weui.min.css" rel="stylesheet" />
<link href="../WebResource/Plugins/WEUI-CSS/dist/example/example.css" rel="stylesheet" />
<link href="../WebResource/Common/Common.css" rel="stylesheet" />
<script src="../WebResource/Plugins/WEUI-CSS/dist/example/zepto.min.js" type="text/javascript"></script>
<script src="../WebResource/Plugins/WEUI-JS/dist/weui.min.js" type="text/javascript"></script>
<script src="../WebResource/Plugins/WEUI-CSS/dist/example/example.js" type="text/javascript"></script>
<script src="../WebResource/Common/WinHideMenu.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<!--接收后端的值-->
<asp:HiddenField ID="hid_processList" runat="server"></asp:HiddenField>
<!--右下角的总数-->
<asp:HiddenField ID="hid_totCount" runat="server"></asp:HiddenField>
<!--当前显示的流程名字-->
<asp:HiddenField ID="hid_processName" runat="server"></asp:HiddenField>
<!--当前显示的流程ID-->
<asp:HiddenField ID="hid_processID" runat="server"></asp:HiddenField>
<!--当前显示的流程code-->
<asp:HiddenField ID="hid_processCode" runat="server"></asp:HiddenField>
<!--分页用的-->
<!--总数-->
<asp:HiddenField ID="hid_totalCount" runat="server"></asp:HiddenField>
<!--当前页-->
<input type="hidden" id="hid_pageIndex" value="1" />
<!--查询条件-->
<input type="hidden" id="hid_condition" value="" />
<!--内容视图页面-->
<div class="container" id="container">
</div>
<!--页面模板-->
<script type="text/html" id="tpl_home">
<!--显示页面-->
<div class="page">
<!--视图显示区域-->
<div class="page__bd" style="height: 100%;">
<div class="weui-tab">
<!--头部-->
<div class="weui-navbar">
<table style="height: 50px; width: 100%; background-color: #014099;">
<tr>
<td style="padding-left: 5px; width: 33%;">
<span style="color: white;"><i style="color: white; cursor: pointer;" class="glyphicon glyphicon-home"></i> 待办审批</span>
</td>
<td style="width: 33%; text-align: center; color: white;"></td>
<td style="width: 33%; text-align: right; padding-right: 10px;">
<a id="searchButton" href="javascript:void(0)">
<i style="color: white; cursor: pointer;" class="glyphicon glyphicon-search"></i>
</a>
</td>
</tr>
</table>
</div>
<!--中部-->
<div class="weui-tab__panel">
<!--查找区域-->
<div id="searchArea" class="weui-cells weui-cells_form" style="position: absolute; height: 100%; z-index: 10000; width: 100%; display: none;">
<div class="weui-cell" style="z-index: 5000;">
<div class="weui-cell__hd">
<label for="" class="weui-label">单号</label>
</div>
<div class="weui-cell__bd">
<input id="txt_order" class="weui-input" value="" type="text" />
</div>
</div>
<div class="weui-cell" style="z-index: 5000;">
<div class="weui-cell__hd">
<label for="" class="weui-label">标题</label>
</div>
<div class="weui-cell__bd">
<input id="txt_title" class="weui-input" value="" type="text" />
</div>
</div>
<div class="weui-cell" style="z-index: 5000;">
<div class="weui-cell__hd">
<label for="" class="weui-label">内容</label>
</div>
<div class="weui-cell__bd">
<input id="txt_content" class="weui-input" value="" type="text" />
</div>
</div>
<div class="weui-cell" style="z-index: 5000;">
<div class="weui-cell__hd">
<label for="" class="weui-label">发起人</label>
</div>
<div class="weui-cell__bd">
<input id="txt_sender" class="weui-input" value="" type="text" />
</div>
</div>
<div class="weui-cell" style="z-index: 5000;">
<div class="weui-cell__hd">
<label for="" class="weui-label">日期起</label>
</div>
<div class="weui-cell__bd">
<input id="txt_dateStart" readonly="readonly" class="weui-input" value="" type="text" />
</div>
</div>
<div class="weui-cell" style="z-index: 5000;">
<div class="weui-cell__hd">
<label for="" class="weui-label">日期止</label>
</div>
<div class="weui-cell__bd">
<input id="txt_dateEnd" readonly="readonly" class="weui-input" value="" type="text" />
</div>
</div>
<div class="button-sp-area">
<table style="width: 100%;">
<tr>
<td><a style="z-index: 5000;" href="javascript:void(0);" id="btn_search" class="weui-btn weui-btn_primary">查询</a></td>
<td><a style="z-index: 5000;" href="javascript:void(0);" id="btn_reset" class="weui-btn weui-btn_primary">重置</a></td>
<td><a style="z-index: 5000;" href="javascript:void(0);" id="btn_close" class="weui-btn weui-btn_default">关闭</a></td>
</tr>
</table>
</div>
</div>
<!--当前所看的流程-->
<div class="weui-cells">
<div class="weui-cell weui-cell_access" id="processTypeName">
<div class="weui-cell__hd">当前流程: </div>
<div class="weui-cell__bd">加载中</div>
<div class="weui-cell__ft" style="font-size: 0">
<span style="vertical-align: middle; font-size: 17px;">切换</span>
</div>
</div>
</div>
<div id="loadLastList">
<a id="nextData" class="weui-cell" href="javascript:;" style="display: none;">
<div class="weui-cell__bd" style="height: 100px;">
<p style="text-align: center; color: gray; font-size: 12px;">
加载更多
剩余<span id="sycount"></span>条
</p>
</div>
</a>
<a id="noData" class="weui-cell" href="javascript:;" style="display: none;">
<div class="weui-cell__bd" style="height: 100px;">
<p style="text-align: center; color: gray; font-size: 12px;">
到底啦
</p>
</div>
</a>
</div>
</div>
</div>
<!--底部-->
<div class="weui-tabbar">
<a href="javascript:void(0);" data-src="MyTaskInfo.aspx" class="weui-tabbar__item weui-bar__item_on">
<span style="display: inline-block; position: relative;">
<img src="../WebResource/Plugins/WEUI-CSS/dist/example/images/newicon/icon_nav_cyl.png" alt="" class="weui-tabbar__icon" />
<span class="weui-badge circle" style="position: absolute; top: -2px; right: -13px;" id="totalCount">0</span>
</span>
<p class="weui-tabbar__label">待办</p>
</a>
<a href="javascript:void(0);" data-src="MyNotificationInfoAdd.aspx" class="weui-tabbar__item">
<img src="../WebResource/Plugins/WEUI-CSS/dist/example/images/newicon/icon_nav_cjh.png" alt="" class="weui-tabbar__icon" />
<p class="weui-tabbar__label">加签</p>
</a>
<a href="javascript:void(0);" data-src="MyNotificationInfo.aspx" class="weui-tabbar__item">
<img src="../WebResource/Plugins/WEUI-CSS/dist/example/images/newicon/icon_nav_fzh.png" alt="" class="weui-tabbar__icon" />
<p class="weui-tabbar__label">知会</p>
</a>
<a href="javascript:void(0);" data-src="MyApprovedInfo.aspx" class="weui-tabbar__item ">
<img src="../WebResource/Plugins/WEUI-CSS/dist/example/images/newicon/icon_nav_tzh.png" alt="" class="weui-tabbar__icon" />
<p class="weui-tabbar__label">已批</p>
</a>
<a href="javascript:void(0);" data-src="MyApplicationInfo.aspx" class="weui-tabbar__item">
<img src="../WebResource/Plugins/WEUI-CSS/dist/example/images/newicon/icon_nav_cjh.png" alt="" class="weui-tabbar__icon" />
<p class="weui-tabbar__label">已提</p>
</a>
</div>
</div>
<!--加载提醒-->
<div id="loadingToast" style="display: none;">
<div class="weui-mask_transparent"></div>
<div class="weui-toast">
<i class="weui-loading weui-icon_toast"></i>
<p class="weui-toast__content">数据加载中</p>
</div>
</div>
<!--页面跳转提醒-->
<div id="loadingPage" style="display: none;">
<div class="weui-mask_transparent"></div>
<div class="weui-toast">
<i class="weui-loading weui-icon_toast"></i>
<p class="weui-toast__content">页面跳转中</p>
</div>
</div>
</div>
<!--JS处理代码-->
<script type="text/javascript">
//索引
var index = 0;
//流程类型
var processList = eval('(' + $("#hid_processList").val() + ')');
function getProcessByVallue(val) {
var process = {};
for (var i = 0; i < processList.length; i++) {
if (processList[i].value == val) {
process = processList[i];
break;
}
}
return process;
}
$(function () {
debugger;
if(processList.length==0)
{
//没数据
$("#processTypeName .weui-cell__bd").text("没有数据哦");
return;
}
//重新计算数量title和数量
var tcount=0;
for(var i=0;i<processList.length;i++)
{
tcount+= parseInt(processList[i].count);
if(processList[i].value==$("#hid_processID").val())
{
$("#hid_processName").val(processList[i].name+"("+processList[i].count+")");
$("#hid_totalCount").val(processList[i].count);
}
}
$("#hid_totCount").val(tcount);
//加载初始数据
$("#totalCount").text($("#hid_totCount").val());
$("#processTypeName .weui-cell__bd").text($("#hid_processName").val());
//类型
$("#processTypeName").on("click", function () {
weui.picker(processList, {
onConfirm: function (result) {
var process = getProcessByVallue(result[0].value);
//当前所选类型的数据信息
$("#hid_processID").val(process.value);
$("#hid_processName").val(process.label);
$("#processTypeName .weui-cell__bd").text(process.label);
$("#hid_totalCount").val(process.count);
$("#hid_processCode").val(process.code);
//加载数据
loadingData(true);
}
});
});
//开始日期
$('#txt_dateStart').on('focus', function () {
var dt = new Date();
var df = [dt.getFullYear(), (dt.getMonth() + 1), dt.getDate()];
var id = dt.getFullYear() + "" + dt.getMonth() + "" + dt.getDate() + "" + dt.getHours() + "" + dt.getMinutes() + "" + dt.getSeconds();
var value = $.trim($("#txt_dateStart").val());
if (value != "") {
var arrays = value.split("-");
df = [parseInt(arrays[0]), parseInt(arrays[1]), parseInt(arrays[2])];
}
weui.datePicker({
id: "start" + id,
start: 2000,
end: dt.getFullYear() + 20,
defaultValue: df,
onConfirm: function (result) {
$("#txt_dateStart").val(result[0].label.replace("年", "-") + result[1].label.replace("月", "-") + result[2].label.replace("日", ""));
$("#txt_dateEnd").val("");
}
});
});
//结束日期
$('#txt_dateEnd').on('focus', function () {
var dt = new Date();
var df = [dt.getFullYear(), (dt.getMonth() + 1), dt.getDate()];
var id = dt.getFullYear() + "" + dt.getMonth() + "" + dt.getDate() + "" + dt.getHours() + "" + dt.getMinutes() + "" + dt.getSeconds();
var value = $.trim($("#txt_dateEnd").val());
if (value != "") {
var arrays = value.split("-");
df = [parseInt(arrays[0]), parseInt(arrays[1]), parseInt(arrays[2])];
}
var dfStart = "2000";
var startVal = $.trim($("#txt_dateStart").val());
if (startVal != "") {
dfStart = startVal;
}
weui.datePicker({
id: "end" + id,
start: dfStart,
end: dt.getFullYear() + 20,
defaultValue: df,
onConfirm: function (result) {
$("#txt_dateEnd").val(result[0].label.replace("年", "-") + result[1].label.replace("月", "-") + result[2].label.replace("日", ""));
}
});
});
//下一页
$('#nextData').on('click', function () {
var pageIndex = parseInt($("#hid_pageIndex").val()) + 1;
$("#hid_pageIndex").val(pageIndex);
loadingData(false);
});
//重置
$("#btn_reset").on("click", function () {
//清空查询条件
clearSearchWhere();
});
//查找
$("#searchButton").on("click", function () {
$("#searchArea").toggle();
});
//查找
$("#btn_search").on("click", function () {
$("#searchArea").hide();
loadProcess();
});
//关闭
$("#btn_close").on("click", function () {
$("#searchArea").hide();
});
//清空查询条件
clearSearchWhere();
//加载数据
loadingData(true);
//底部切换
$('.weui-tabbar__item').on('click', function () {
$("#loadingPage").fadeIn(100);
$(".weui-tabbar img").each(function () {
$(this).attr("src", $(this).attr("src").replace("l.png", "h.png"));
});
$(this).find("img").attr("src", $(this).find("img").attr("src").replace("h.png", "l.png"));
$(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
window.location.href = $(this).attr("data-src");
});
});
function loadProcess() {
$('#loadingToast').fadeIn(100);
debugger;
var param = {};
param.flag = new Date().getTime();
param.type = "getProcess";
param.order = encodeURIComponent($.trim($("#txt_order").val()));
param.title = encodeURIComponent($.trim($("#txt_title").val()));
param.content = encodeURIComponent($.trim($("#txt_content").val()));
param.sender = encodeURIComponent($.trim($("#txt_sender").val()));
param.dateStart = encodeURIComponent($.trim($("#txt_dateStart").val()));
param.dateEnd = encodeURIComponent($.trim($("#txt_dateEnd").val()));
$.post("../WebAjaxPages/GetMyTaskList.aspx", param, function (data) {
$('#loadingToast').fadeOut(100);
var json=eval('('+data+')');
debugger;
processList=json.data;
//如果找到了就直接看这类,没有就找第一个
var haveData=false;
//设置查询条件
$("#hid_condition").val(json.where);
//设置总数
$("#hid_totCount").val(json.total);
$("#totalCount").text($("#hid_totCount").val());
if(processList.length==0)
{
//没数据
$("#processTypeName .weui-cell__bd").text("没有数据哦");
//清空内容
$(".data-item-info").remove();
$("#noData").hide();
$("#nextData").hide();
return;
}
for(var i=0;i<processList.length;i++)
{
if(processList[i].value==$("#hid_processID").val())
{
//更新当前选择的信息
$("#hid_totalCount").val(processList[i].count);
$("#hid_processName").val(processList[i].label);
$("#processTypeName .weui-cell__bd").text($("#hid_processName").val());
haveData=true;
break;
}
}
if(haveData==false){
//显示第一个
for(var i=0;i<processList.length;i++)
{
//更新当前选择的信息
$("#hid_processID").val(processList[i].value);
$("#hid_processCode").val(processList[i].code);
$("#hid_totalCount").val(processList[i].count);
$("#hid_processName").val(processList[i].label);
$("#processTypeName .weui-cell__bd").text($("#hid_processName").val());
break;
}}
loadingData(true);
// //更新第一次获取的出来的流程
// for(var i=0;i<processList.length;i++)
// {
// //更新默认值值
// processList[i].label=processList[i].name+"(0)";
// processList[i].count=0;
//
//
// for(var j=0;j<json.data.length;j++){
// if(processList[i].value==json.data[j].value)
// {
// //更新值
// processList[i].count=json.data[j].count;
// processList[i].label=processList[i].name+"("+processList[i].count+")";
// }
// }
// }
// for(var i=0;i<processList.length;i++)
// {
// if(processList[i].value==$("#hid_processID").val())
// {
// //更新当前选择的信息
// $("#hid_totalCount").val(processList[i].count);
// $("#hid_processName").val(processList[i].label);
// $("#processTypeName .weui-cell__bd").text($("#hid_processName").val());
// break;
// }
// }
});
}
function clearSearchWhere() {
$("#txt_order").val("");
$("#txt_title").val("");
$("#txt_content").val("");
$("#txt_sender").val("");
$("#txt_dateStart").val("");
$("#txt_dateEnd").val("");
$("#hid_condition").val("");
}
function loadingData(isFirstLoad) {
//第一次加载
if (isFirstLoad == true) {
//初始化页索引
$("#hid_pageIndex").val("1");
index = 0;
//清空内容
$(".data-item-info").remove();
}
$('#loadingToast').fadeIn(100);
var param = {};
param.flag = new Date().getTime();
param.type = "getData";
param.isDraft = "false";
param.processName = $("#hid_processCode").val();
param.pageIndex = $("#hid_pageIndex").val();
param.totalCount = $("#hid_totalCount").val();
param.pageSize = $("#hid_pageSize").val();
param.condition = $("#hid_condition").val();
$.post("../WebAjaxPages/GetMyTaskList.aspx", param, function (data) {
var json = eval('(' + data + ')');
if (json.length == 0) {
$("#noData").show();
$("#nextData").hide();
$('#loadingToast').fadeOut(100);
return;
}
for (var i = 0; i < json.length; i++) {
index++;
var db = json[i].row;
var html = " <div class=\"weui-cells__title data-item-info\" style=\"font-size: 12px;\">";
html += "<table style=\"width:100%\">";
html += "<tr>";
html += "<td>";
html += " <div class=\"biaishinumber\" style=\"float: left;\"><span style=\"color: white; font-weight: bold;\">" +
index + "</span></div>";
html += "<div class=\"data-item-info\" style=\"margin-left: 10px;\"> ";
html += "<span style=\"color: gray\"> " + db[1].filed + ":</span><span style=\"color: black\">" + $(db[1].value).text() + "</span></div>";
html += "</td>";
html += "</tr>";
html += "</table>";
html += "</div>";
html += " <div class=\"weui-cells data-item-info\" style=\"font-size: 12px;\">";
html += "<a class=\"weui-cell weui-cell_access js_item \" data-href=\"" + $(db[1].value).attr("href") + "\" href=\"javascript:void(0);\">";
html += " <div class=\"weui-cell__bd\">";
html += " <table style=\"width: 100%;\">";
for (var j = 2; j < db.length - 1; j++) {
html += "<tr><td style=\"text-align: left\"><p><span style=\"color:gray\">" + db[j].filed + ":</span><span>" + $("<span>" + db[j].value + "</span>").text() + "</span></p></td></tr> ";
}
html += "</table>";
html += "</div>";
html += "</a>";
html += "</div>";
$("#nextData").before(html);
}
$('.js_item').on('click', function (event) {
var href = $(this).attr('data-href');
pageGo(href);
});
var sytiaoshu = parseInt($("#hid_totalCount").val()) - parseInt($(".biaishinumber").last().text());
if (sytiaoshu < 0) {
sytiaoshu = 0;
}
$("#sycount").text(sytiaoshu);
if (sytiaoshu == 0) {
$("#noData").show();
$("#nextData").hide();
} else {
$("#noData").hide();
$("#nextData").show();
}
$('#loadingToast').fadeOut(100);
});
}
function pageGo(value) {
$("#loadingPage").fadeIn(100);
window.location.href = value;
}
</script>
</script>
</form>
</body>
</html>
进来时的加载
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BRC.Workflow.Portal.Web.Pages.BaseClasses;
using BRC.K2Workflow.Lib.MyTask;
using System.Data;
using BRC.Workflow.Portal.Lib.Utility;
using BRC.Workflow.Portal.Lib.Model;
using BRC.Workflow.Portal.Lib.BLL;
namespace BRC.Workflow.Portal.Web.WebPages
{
public partial class MyTaskInfo : BasePage
{
private ProcessesBLL processBll = new ProcessesBLL();
protected void Page_Load(object sender, EventArgs e)
{
//绑定流程列表
BindProcess();
}
/// <summary>
/// 绑定流程列表
/// </summary>
private void BindProcess()
{
MyTask task = new MyTask();
DataTable dt = task.GetProcessesSearch(Utility.GetCurrentAD(false), false, "");
List<string> jsonList=new List<string>();
int totalCount=0;
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
//流程名称的编码
string processNameCode = TransforFullName(dr["ProcessFullName"].ToString());
//流程中文名
string processName = GetProcessName(dr["ProcessFullName"].ToString());
//流程类型ID
string processID = GetProcID(dr["ProcessFullName"].ToString());
//流程数量
int count = Convert.ToInt32(dr["Count"]);
//显示名字
string label = processName + "(" + count + ")";
totalCount+=count;
if (i == 0)
{
hid_processName.Value = label;
hid_processID.Value = processID;
hid_totalCount.Value = count.ToString();
hid_processCode.Value = processNameCode;
}
string json = "{\"count\":\"" + count + "\",\"name\":\"" + processName + "\",\"label\":\"" +label+"\",\"value\":\"" + processID + "\",\"code\":\"" + processNameCode + "\"}";
jsonList.Add(json);
}
hid_processList.Value ="["+ string.Join(",", jsonList.ToArray())+"]";
hid_totCount.Value = totalCount.ToString();
}
public string TransforFullName(string fullName)
{
return Utility.DecodeFullName(fullName);
}
public string GetProcessName(string fullName)
{
Processes process = processBll.FindByProcess(fullName);
return (process == null ? fullName : process.Name);
}
public string GetProcID(string fullName)
{
Processes process = processBll.FindByProcess(fullName);
return (process == null ? fullName : process.ID.ToString());
}
}
}
Ajax处理
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using BRC.Workflow.Portal.Web.Pages.BaseClasses;
using BRC.Workflow.Portal.Lib.BLL;
using BRC.Workflow.Portal.Lib.Model;
using BRC.Workflow.Portal.Lib.Utility;
using BRC.Workflow.Portal.Lib.Utility.Enums;
using BRC.K2Workflow.Lib.MyTask;
using K2Utility = BRC.K2Workflow.Lib.Utility;
namespace BRC.Workflow.Portal.Web.WebAjaxPages
{
public partial class GetMyTaskList : System.Web.UI.Page
{
private ColumnsBLL columnsBll = new ColumnsBLL();
private ColumnsDefaultBLL columnsDefaultBll = new ColumnsDefaultBLL();
private ProcessesBLL processesBll = new ProcessesBLL();
protected void Page_Load(object sender, EventArgs e)
{
string type = Request.Form["type"];
switch (type)
{
case "getData":
Response.Write(GetHtml());
break;
case "getProcess":
Response.Write(GetProcess());
break;
}
Response.End();
}
private string GetProcess()
{
try
{
string order = Server.UrlDecode(Request.Form["order"]);
string title = Server.UrlDecode(Request.Form["title"]);
string content = Server.UrlDecode(Request.Form["content"]);
string sender = Server.UrlDecode(Request.Form["sender"]);
string dateStart = Server.UrlDecode(Request.Form["dateStart"]);
string dateEnd = Server.UrlDecode(Request.Form["dateEnd"]);
string condition = "";
if (order != "")
{
condition += string.Format(" and Folio like N'%{0}%'", order.Trim().Replace("'", "''"));
}
if (dateStart != "")
{
condition += string.Format(" and datediff(d,startdate,'{0}') <= 0", dateStart);
}
if (dateEnd != "")
{
condition += string.Format(" and datediff(d,startdate,'{0}') >= 0", dateEnd);
}
if (sender != "")
{
condition += string.Format(" and Originator like N'%{0}%'", sender.Trim().Replace("'", "''"));
}
//标题和内容模糊查询
if (title != "")
{
condition += string.Format(" and Title like N'%{0}%'", title);
}
if (content != "")
{
condition += string.Format(" and Content like N'%{0}%'", content);
}
MyTask task = new MyTask();
DataTable dt = task.GetProcessesSearch(Utility.GetCurrentAD(false), false, condition);
List<string> jsonList = new List<string>();
int totalCount = 0;
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
//流程名称的编码
string processNameCode = TransforFullName(dr["ProcessFullName"].ToString());
//流程中文名
string processName = GetProcessName(dr["ProcessFullName"].ToString());
//流程类型ID
string processID = GetProcID(dr["ProcessFullName"].ToString());
//流程数量
int count = Convert.ToInt32(dr["Count"]);
//显示名字
string label = processName + "(" + count + ")";
totalCount += count;
string json = "{\"count\":\"" + count + "\",\"name\":\"" + processName + "\",\"label\":\"" + label + "\",\"value\":\"" + processID + "\",\"code\":\"" + processNameCode + "\"}";
jsonList.Add(json);
}
string data = "[" + string.Join(",", jsonList.ToArray()) + "]";
return "{\"total\":\"" + totalCount + "\",\"data\":" + data + ",\"where\":\"" + HttpUtility.UrlEncode(condition) + "\"}";
}
catch (Exception ex)
{
return ex.Message;
}
}
public string TransforFullName(string fullName)
{
return Utility.DecodeFullName(fullName);
}
public string GetProcessName(string fullName)
{
Processes process = processesBll.FindByProcess(fullName);
return (process == null ? fullName : process.Name);
}
public string GetProcID(string fullName)
{
Processes process = processesBll.FindByProcess(fullName);
return (process == null ? fullName : process.ID.ToString());
}
private string GetHtml()
{
try
{
string processName = Utility.EncodeFullName((Request.Form["processName"]));
bool isDraft = bool.Parse(Request.Form["isDraft"]);
int pageIndex = int.Parse(Request.Form["pageIndex"]);
int totalCount = int.Parse(Request.Form["totalCount"]);
string condition = HttpUtility.UrlDecode(Request.Form["condition"]);
Processes process = processesBll.FindByProcess(processName);
int pageSize = process.PageSize;
int pageCount = totalCount / pageSize;
if ((totalCount % pageSize) > 0)
{
pageCount = pageCount + 1;
}
MyTask myTask = new MyTask();
DataTable dt = myTask.GetTaskSearch(Utility.GetCurrentAD(false), processName, isDraft, pageIndex, pageSize, condition);
List<string> jsonList = new List<string>();
List<ColumnsDefault> defaultColumns = columnsDefaultBll.Find(ListType.MyTask);
List<Columns> columns = columnsBll.Find(ListType.MyTask, processName);
if (columns.Count == 0 && defaultColumns.Count == 0)
{
return "[" + string.Join(",", jsonList.ToArray()) + "]";
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
DataRow drBiz = processesBll.GetBizData(process, dr);
List<string> subJsonList = new List<string>();
foreach (ColumnsDefault column in defaultColumns)
{
string value = Utility.GetValue(column, dr, i, drBiz);
string subJson = "{";
subJson += "\"filed\":\"" + column.Title + "\",";
subJson += "\"value\":\"" + value + "\"";
subJson += "}";
subJsonList.Add(subJson);
}
foreach (Columns column in columns)
{
string value = Utility.GetValue(column, dr, i, drBiz);
string subJson = "{";
subJson += "\"filed\":\"" + column.Title + "\",";
subJson += "\"value\":\"" + value + "\"";
subJson += "}";
subJsonList.Add(subJson);
}
string json = "{\"row\":[" + string.Join(",", subJsonList.ToArray()) + "]}";
jsonList.Add(json);
}
return "[" + string.Join(",", jsonList.ToArray()) + "]";
}
catch (Exception ex)
{
return ex.Message;
}
}
}
}