列表中 用 strHtmlData.AppendFormat(" | <a id='{0}' href='#' title='点评进度'>点评进度</a>", dt.Rows[j]["bchID"].ToString());
前台页面用
<script type="text/javascript" language="javascript">
$(function () {
//展开拜访记录页面
var $a = $("#dtVisitRecord tr>td>a[href='#']");
$a.toggle(function () {
//展开
var $curr = $(this);
var $parenttr = $curr.parent().parent();
var id = $curr.attr("id");
$parenttr.addClass("bgcolorblue");
$curr.css("font-size", "12px");
getIdOAndtBuMenHtml(id);
}, function () {
//收起
var $curr = $(this);
var $parenttr = $curr.parent().parent();
$parenttr.removeClass("bgcolorblue");
$parenttr.next("tr").hide();
// $curr.css("font-size", "10px");
});
});
function getIdOAndtBuMenHtml(id) {
var $curr = $("#" + id);
var $parenttr = $curr.parent().parent();
getBuMenHtml($parenttr, id);
}
function getBuMenHtml($parenttr, id) {
var key = "";
key = "key=VisitRecord&id=" + id + "&type=1&net4=" + Math.random();
$.ajax({
type: 'get',
url: '../Ajax/HospitalAjax.aspx',
data: key + "&net4=" + Math.random(),
dataType: 'html',
async: false,
success: function (data, status) {
$parenttr.next('tr').html(data);
},
error: function (error, errormsg, errorobj) {
alert("error");
result = false;
}
});
var aID = 0;
var aid = $("#" + id).eq(0);
var pWidth = $(aid).parent().width();
aID = $(aid).offset().left - (pWidth / 3);
var width = $(document.body).width();
var margionleft = (aID / width) * 100;
// $parenttr.next("tr").find("div.div_float").css('left', margionleft + "%");
$parenttr.next("tr").show();
}
</script>
Ajax 中代码
case "VisitRecord":
#region 根据批次ID查看详细
string id = string.Empty;
string module_ID = string.Empty;
StringBuilder strHtmlData;
id = string.IsNullOrEmpty(Request["id"]) ? "" : Request["id"].ToString();
if (id.IndexOf('|') > 0)
{
module_ID=id.Split('|')[1];
id = id.Split('|')[0];
}
strHtmlData = new StringBuilder();
try
{
PHHC.PrescriptionReviewManage.BLL.PrescriptionReviewNew.BLL_PM_Batch bll = new BLL.PrescriptionReviewNew.BLL_PM_Batch();
DataTable dt = bll.GetDetailedList(id, PageIndex, PageSize, out rCount, out pCount).Tables[0];
strHtmlData.Append("<td colspan=\"8\" >");
strHtmlData.Append("<div class='list_msg'>");
strHtmlData.Append("<div class='div_float'>");
strHtmlData.Append("</div>");
strHtmlData.Append("<div class='div_up'> ");
strHtmlData.Append("</div>");
strHtmlData.Append("<div class='div_down'>");
strHtmlData.Append("<table class='table_list' cellpadding='0' cellspacing='0'>");
strHtmlData.Append("<tr class='tr_title'>");
//strHtmlData.Append("<th style='width:25%;'>科室</th>");
strHtmlData.Append("<th style='width:25%;'>药师</th>");
strHtmlData.Append("<th style='width:25%;'>已完成/总数</th>");
strHtmlData.Append("<th style='width:25%;'>点评进度</th>");
strHtmlData.Append("<th>操作</th>");
strHtmlData.Append("</tr>");
for (int i = 0; i < dt.Rows.Count; i++)
{
string css = string.Empty;
if (i % 2 == 0) { css = "tr_con_001"; } else { css = "tr_con_002"; }
strHtmlData.Append("<tr class='" + css + "'>");
//strHtmlData.Append("<td>" + dt.Rows[i]["HospitalDepartment_Name"].ToString() + "</td>");
strHtmlData.Append("<td>" + dt.Rows[i]["DoctorInfo_Name"].ToString() + "</td>");
int all = new PHHC.PrescriptionReviewManage.BLL.PrescriptionReviewNew.BLL_PM_BatchSecond().GetCount(id, dt.Rows[i]["DoctorInfo_ID"].ToString(), -1);
int value = new PHHC.PrescriptionReviewManage.BLL.PrescriptionReviewNew.BLL_PM_BatchSecond().GetCount(id, dt.Rows[i]["DoctorInfo_ID"].ToString(), 1);
strHtmlData.Append("<td>" + (value + "/" + all) + "</td>");
strHtmlData.Append("<td>" + (all == 0 ? "0%" : ((Math.Round((double.Parse(value.ToString()) / all), 1) * 100).ToString()) + "%") + "</td>");
strHtmlData.AppendFormat(@"<td> <a href='../PrescriptionReviewNew/AdministratorBatchPrescriptionList.aspx?Batch_ID={0}&DoctorInfo_ID={1}&Batch_Name={2}&Module_ID={3}&type={4}' title='查看'>查看</a>",
clsUtility.Encrypt(id), clsUtility.Encrypt(dt.Rows[i]["DoctorInfo_ID"].ToString()), clsUtility.Encrypt(dt.Rows[i]["Batch_Name"].ToString()), clsUtility.Encrypt(module_ID), clsUtility.Encrypt(Request["type"]));
strHtmlData.Append("</td>");
strHtmlData.Append("</tr>");
strHtmlData.Append("<tr></tr>");
}
if (dt.Rows.Count <= 0)
{
strHtmlData.Append(" <tr><td colspan=\"8\"><div class='nodata_div'>暂无数据!</td></td></tr>");
}
strHtmlData.Append("</table>");
strHtmlData.Append("<div class='clear'> </div>");
strHtmlData.Append("</div>");
strHtmlData.Append("</div>");
strHtmlData.Append("</td>");
}
catch (Exception ex)
{
new BLL_clsAuth().AddLogErrorFromBS("BatchList.aspx", string.Format("类:{0},方法:{1},错误信息:{2}, 详细:{3}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message, ex.StackTrace));
Response.Write("0");
Response.End();
}
Response.Write(strHtmlData.ToString());
Response.End();
break;
#endregion