Dtl.aspx
function DtlOpt(workId, fk_mapdtl) {
var url = 'DtlOpt.aspx?WorkID=' + workId + '&FK_MapDtl=' + fk_mapdtl;
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 400px; dialogWidth: 600px;center: yes; help: no');
window.location.href = 'Dtl.aspx?EnsName=' + fk_mapdtl + '&IsReadonly=1&RefPKVal=' + workId;
}// add &IsReadonly=1
Dtl.aspx.cs
this.Pub1.Add(mdtl.MTR);
if (this.IsReadonly == 1 && !string.IsNullOrEmpty(mdtl.MulColsMerge.Trim()))//add by haisheng
{
if (!mdtl.IsReadonly || mdtl.IsExp)
this.Pub1.Add("<TD class='FDesc'><img src='/WF/Img/Btn/Table.gif' οnclick=\"return DtlOpt('" + this.RefPKVal + "','" + this.EnsName + "');\" border=0/></TD>");
else
this.Pub1.AddTDTitle();
numOfCol++;
string [] colArray=mdtl.MulColsMerge.Split(new char[] { ';',' '} ,StringSplitOptions.RemoveEmptyEntries);
string [] colArr=null;
string colstr = null;
for (int i = 0; i < colArray.Length; i++)
{
colstr = string.Empty;
colArr = colArray[i].Split(',');
for (int j = 0; j < colArr.Length; j++)
{
foreach (MapAttr attr in attrs)
{
if (attr.KeyOfEn.Equals(colArr[j]))
{
colstr = colstr+attr.Name + "<br/>";
break;
}
}
}
colstr = colstr.Substring(0, colstr.Length - 5);
this.Pub1.AddTDTitleExt(colstr);
}
}
else if (mdtl.IsShowTitle)
{
......
}
---------------------------------在if (mdtl.IsEnableGroupField)后增加-----
if (mdtl.IsEnableGroupField)
{
.......
}
else if(this.IsReadonly==1 && !string.IsNullOrEmpty(mdtl.MulColsMerge.Trim()))//add by haisheng
{
foreach (BP.Sys.GEDtl dtl in dtls)
{
#region 增加rows
this.Pub1.AddTR();
this.Pub1.AddTDIdx(idx++);
string[] colArray = mdtl.MulColsMerge.Split(new char[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries);
string[] colatt = null;
string colstr = string.Empty;
for (int i = 0; i < colArray.Length; i++)
{
colatt = colArray[i].Split(',');
colstr = string.Empty;
for (int j = 0; j < colatt.Length; j++)
{
foreach (MapAttr attr in attrs)
{
if (attr.KeyOfEn==colatt[j])
{
if (attr.UIVisible == false || attr.KeyOfEn == "OID")
continue;
//处理它的默认值.
if (attr.DefValReal.Contains("@") == true && attr.UIIsEnable == false)
dtl.SetValByKey(attr.KeyOfEn, attr.DefVal);
string val = dtl.GetValByKey(attr.KeyOfEn).ToString();
if (attr.UIIsEnable == false && dtl.OID >= 100 && LinkFields.Contains("," + attr.KeyOfEn + ","))
{
if (string.IsNullOrEmpty(val))
val = "...";
MapExt meLink = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.Link,
MapExtAttr.AttrOfOper, attr.KeyOfEn) as MapExt;
string url = meLink.Tag.Clone() as string;
if (url.Contains("?") == false)
url = url + "?a3=2";
url = url + "&WebUserNo=" + WebUser.No + "&SID=" + WebUser.SID + "&EnName=" + mdtl.No + "&OID=" + dtl.OID;
if (url.Contains("@AppPath"))
url = url.Replace("@AppPath", "http://" + this.Request.Url.Host + this.Request.ApplicationPath);
if (url.Contains("@"))
{
if (attrs2.Count == 0)
attrs2 = new MapAttrs(mdtl.No);
foreach (MapAttr item in attrs2)
{
url = url.Replace("@" + item.KeyOfEn, dtl.GetValStrByKey(item.KeyOfEn));
if (url.Contains("@") == false)
break;
}
if (url.Contains("@"))
{
/*可能是主表也要有参数*/
if (mainEn == null)
mainEn = this.MainEn;
foreach (Attr attrM in mainEn.EnMap.Attrs)
{
url = url.Replace("@" + attrM.Key, mainEn.GetValStrByKey(attrM.Key));
if (url.Contains("@") == false)
break;
}
}
}
colstr = colstr + "<a href='" + url + "' target='" + meLink.Tag1 + "' >" + val + "</a><br/>";
//this.Pub1.AddTD("<a href='" + url + "' target='" + meLink.Tag1 + "' >" + val + "</a>");
continue;
}
if (string.IsNullOrEmpty(val.Trim()))
{
val = "No Data";
}
switch (attr.UIContralType)
{
case UIContralType.HLink://add by haisheng
string hlink = "<a href='www.baidu.com'>百度</a>";
colstr = colstr + val + "<br/>";
//this.Pub1.AddTD(hlink);
break;
default:
colstr = colstr + val + "<br/>";
break;
}
break;
}
}
}
if (colstr.Length >= 5)
{
colstr = colstr.Substring(0, colstr.Length - 5);
this.Pub1.AddTD(colstr);
}
}
if (mdtl.IsEnableAthM)
{
if (dtl.OID >= 100)
this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('AttachmentUpload.aspx?IsBTitle=1&PKVal=" + dtl.OID + "&Ath=AthM&FK_MapData=" + mdtl.No + "&FK_FrmAttachment=" + mdtl.No + "_AthM','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='/WF/Img/AttachmentM.png' border=0 width='16px' /></a>");
else
this.Pub1.AddTD("");
}
if (mdtl.IsEnableM2M)
{
if (dtl.OID >= 100)
this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('M2M.aspx?IsOpen=1&NoOfObj=M2M&OID=" + dtl.OID + "&FK_MapData=" + mdtl.No + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='/WF/Img/M2M.png' border=0 width='16px' /></a>");
else
this.Pub1.AddTD("");
}
if (mdtl.IsEnableM2MM)
{
if (dtl.OID >= 100)
this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('M2MM.aspx?IsOpen=1&NoOfObj=M2MM&OID=" + dtl.OID + "&FK_MapData=" + mdtl.No + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='/WF/Img/M2M.png' border=0 width='16px' /></a>");
else
this.Pub1.AddTD("");
}
if (mdtl.IsEnableLink)
{
string url = mdtl.LinkUrl.Clone() as string;
if (url.Contains("?") == false)
url = url + "?a3=2";
url = url.Replace("*", "@");
if (url.Contains("OID="))
url = url + "&WebUserNo=" + WebUser.No + "&SID=" + WebUser.SID + "&EnName=" + mdtl.No;
else
url = url + "&WebUserNo=" + WebUser.No + "&SID=" + WebUser.SID + "&EnName=" + mdtl.No + "&OID=" + dtl.OID;
if (url.Contains("@AppPath"))
url = url.Replace("@AppPath", "http://" + this.Request.Url.Host + this.Request.ApplicationPath);
url = BP.WF.Glo.DealExp(url, dtl, null);
url = url.Replace("@OID", dtl.OID.ToString());
url = url.Replace("@FK_Node", this.FK_Node.ToString());
url = url.Replace("'", "");
if (dtl.OID >= 100)
this.Pub1.AddTD("<a href=\"" + url + "\" target='" + mdtl.LinkTarget + "' >" + mdtl.LinkLabel + "</a>");
else
this.Pub1.AddTD("");
}
if (mdtl.IsDelete && this.IsReadonly == 0 && dtl.OID >= 100)
{
if (isRowLock == true && dtl.IsRowLock == true)
this.Pub1.AddTD("<img src='/WF/Img/Btn/Lock.png' class=ICON />"); //如果当前记录是锁定的,并且启动了锁定设置.
else
this.Pub1.Add("<TD border=0><img src='/WF/Img/Btn/Delete.gif' οnclick=\"javascript:Del('" + dtl.OID + "','" + this.EnsName + "','" + this.RefPKVal + "','" + this.PageIdx + "')\" /></TD>");
}
else if (mdtl.IsDelete)
{
if (this.IsReadonly == 0)
this.Pub1.Add("<TD class=TD border=0> </TD>");
}
this.Pub1.AddTREnd();
#endregion 增加rows
}
}
----------------------------------------
#region 生成合计
if (mdtl.IsShowSum && dtls.Count > 1 && this.IsReadonly == 0)//add IsReadonly==0 by haisheng
{
......
}