public string GetDptIdeasData()
{ StringBuilder temp = new StringBuilder();
for (int i = 0; i < mainIdeas.Rows.Count; i++)
{ string strJSON = WCFHelper.GetWCFValue(mainIdeas.Rows[i]["部门"].ToString(), ConfigurationManager.AppSettings["GetWFUserByID"]); WFUser wfuser = JsonConvert.DeserializeObject<WFUser>(strJSON);
temp.Append(@"<div id=" + mainIdeas.Rows[i]["UserID"].ToString() + " fid=0> ");
temp.Append(@"<table border=0 style='border-collapse: collapse; font-size: 12px; width: 100%;'>
<colgroup>
<col width='15%' />
<col width='15%' />
<col width='70%' />
</colgroup>
<tr style='text-align: left' onmouseover='TrOnMouseOver(this)' onmouseout='TrOnMouseOut(this)'> ");
temp.Append(@"<td> <img id=imgsign fid='" + mainIdeas.Rows[i]["UserID"].ToString() + "' onclick='ImageClick(" + mainIdeas.Rows[i]["UserID"].ToString() + wfuser.DptId.ToString() + ",this)' src='../Images/p.gif' align=middle /> " + wfuser.DptName.ToString());
temp.Append(@"</td> <td>" + mainIdeas.Rows[i]["处理人"].ToString()); temp.Append(@"</td> <td>");
for (int j = 0; j < Dsource.Rows.Count; j++)//每个人的所有处理意见 { string strJSONs = WCFHelper.GetWCFValue(Dsource.Rows[j]["部门"].ToString(), ConfigurationManager.AppSettings["GetWFUserByID"]);
WFUser wfusers = JsonConvert.DeserializeObject<WFUser(strJSON); if (wfusers.DptId.ToString() == wfusers.DptId.ToString() && mainIdeas.Rows[i]["UserID"].ToString() == Dsource.Rows[j]["UserID"].ToString()) { temp.Append(Dsource.Rows[j]["处理意见"].ToString() + "<br/>");
}
}
temp.Append("</td></tr></table>");
temp.Append("</div>");
temp.Append("<div id=" + mainIdeas.Rows[i]["UserID"].ToString() + wfuser.DptId.ToString() + " fid='1' style='display:none;'>"); temp.Append(@"<table border=0 style='border-collapse: collapse; font-size: 12px; width: 100%;'>");
temp.Append(@"<colgroup>
<col width='15%' />
<col width='15%' />
<col width='70%' />
</colgroup>");
for (int k = 0; k < Dsource.Rows.Count; k++)//每条处理意见 { string strJSONs = WCFHelper.GetWCFValue(Dsource.Rows[k]["部门"].ToString(), ConfigurationManager.AppSettings["GetWFUserByID"]);
WFUser wfusers = JsonConvert.DeserializeObject<WFUser>(strJSON); if (wfuser.DptId.ToString() == wfusers.DptId.ToString()) {
temp.Append("<tr style='text-align: left' onmouseover='TrOnMouseOver(this)' onmouseout='TrOnMouseOut(this)'>"); temp.Append(@"<td> " + wfusers.DptName.ToString()); temp.Append(@"</td> <td>" + Dsource.Rows[k]["处人"].ToString()); temp.Append(@"</td> <td>");
temp.Append(Dsource.Rows[k]["处理意见"].ToString());
temp.Append(@"</td></tr>");
}
}
temp.Append(@"</table></div>");
} return temp.ToString();
}上面代码实现的效果
部门相同时合并(达到下面的效果,点记加号展开全部)
其实这些操作还不如放到前台去做呢