You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

552 lines
20 KiB
Plaintext

11 months ago
<!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>
<title>明细表属性</title>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" />
<link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
<script src="../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../../Comm/Gener.js" type="text/javascript"></script>
<base target="_self" />
<script type="text/javascript">
closeWhileEscUp();
var multiTitle = null; //表头
var multiTitle1 = null; //表头1
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
//公共变量.
//表单ID.
var fk_mapData = GetQueryString("FK_MapData");
//明细表ID.
var fk_mapDtl = GetQueryString("FK_MapDtl");
var fk_flow = GetQueryString("FK_Flow");
var attrs = new Entities("BP.Sys.MapAttrs");
attrs.Retrieve("FK_MapData", fk_mapDtl, "Idx");
var enEntity = new Entity("BP.Sys.MapDtl", fk_mapDtl);
//获得表头.
multiTitle = enEntity.GetPara("MultiTitle");
multiTitle1 = enEntity.GetPara("MultiTitle1");
//是否是三级表头
/* var isThrMulti = false;
if (multiTitle1 == null || multiTitle1 == undefined || multiTitle1 == "" && multiTitle1 == "undefined")
multiTitle1 = "";
if (multiTitle1 != "")
isThrMulti = true;*/
//是否是二级表头
var isSecMulti = false;
if (multiTitle == null || multiTitle == undefined || multiTitle == "" || multiTitle == "undefined")
multiTitle = multiTitle1;
if (multiTitle == null || multiTitle == undefined || multiTitle == "" && multiTitle == "undefined")
multiTitle = "";
if (multiTitle != "")
isSecMulti = true;
var fields = "WorkID,ReturnNode,ReturnNodeName,Returner,ReturnerName,ReturnToNode,ReturnToEmp,BeiZhu,RDT,IsBackTracking,";
//生成表头..
//一级表头
if (isSecMulti == false) {
$("#trTitle").append("<th>序</th>");
showTable(attrs, fk_mapDtl, fk_flow, enEntity);
}
//二级表头
if (isSecMulti == true) {
showSecTable(attrs, multiTitle, fk_mapDtl, fk_flow, enEntity);
}
//生成内容行.
for (var idx = 0; idx < 6; idx++) {
var newRow = "<tr>";
newRow += "<td class=Idx >" + idx + "</td>";
for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
var visable = attr.UIVisible;
if (visable == 0)
continue;
if (fk_mapDtl == "BP.WF.ReturnWorks" && fields.indexOf(attr.KeyOfEn + ",") != -1)
continue;
if (fk_flow != null && attr.AtPara.indexOf("FK_Flow=" + fk_flow) == -1)
continue;
var mypk = attr.MyPK;
var dataType = attr.MyDataType;
var field = attr.KeyOfEn;
var name = attr.Name;
var lgType = attr.LGType;
var uiBindKey = attr.UIBindKey;
var uiContralType = attr.UIContralType; //控件类型.
var uiWidth = attr.UIWidth; //宽度.
var defVal = attr.DefVal; //默认值.
if (defVal == "null" || defVal == null)
defVal = "";
var td = "";
td = "<td >" + defVal + "</td>";
//doubble, float 类型.
if (dataType == 3 || dataType == 5 || dataType == 2)
td = "<td style='text-align:right' >" + defVal + "</td>";
//money 类型.
if (dataType == 8)
td = "<td style='text-align:right' >" + defVal + "</td>";
//日期类型.
if (dataType == 6) {
td = "<td >yyyy-MM-dd</td>";
}
//日期时间类型.
if (dataType == 7) {
td = "<td >yyyy-MM-dd HH:mm</td>";
}
if (dataType == 4) {
td = "<td ><label for='" + field + "_" + i + "'><input type=checkbox value='1' id=" + field + "_" + i + " name=" + field + "_" + i + " />" + name + "</label></td>";
}
if (uiContralType == 1)
td = "<td >[下拉框]</td>";
newRow += td;
}
if (enEntity.IsEnableAthM == 1) {
var opt = "";
opt += "<a href=\"javascript:alert('1.点击可以上传附件.\t\r 2.附件权限控制在从表属性里设置.')\" >上传</a>";
newRow += "<td>" + opt + "</td>";
}
newRow += "<td></td>";
newRow += "</tr>";
$("#dtlTable tr:last").after(newRow);
}
$("#Msg").html("");
setIframeHeight();
});
function setIframeHeight() {
var h = $("body").height();
if ($("body").height() < 240) {
h = 240;
}
if (window.frameElement != null)
$("#" + window.frameElement.getAttribute("id"), parent.document).height(h + 20);
}
/**
* 只有一级表头的解析
* @param mapAttr
*/
function showTable(attrs, fk_mapDtl, fk_flow, mapDtl) {
var colNum = 0;
for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
var visable = attr.UIVisible;
if (visable == 0)
continue;
if (fk_mapDtl == "BP.WF.ReturnWorks" && fields.indexOf(attr.KeyOfEn + ",") != -1)
continue;
if (fk_flow != null && attr.AtPara.indexOf("FK_Flow=" + fk_flow) == -1)
continue;
colNum++;
var namelink = GenerNameLink(attr);
var dataType = attr.MyDataType;
var col = "";
if (dataType == 2 || dataType == 3 || dataType == 5 || dataType == 6 || dataType == 8)
col = "<th style='word-break: keep-all;' nowarp=true >" + namelink + "</th>";
else
col = "<th style='width:" + attr.UIWidth + "px;word-break: keep-all;' nowarp=true >" + namelink + "</th>";
$("#trTitle").append(col);
}
if (mapDtl.IsEnableAthM == 1) {
$("#trTitle").append("<th>附件</th>");
}
$("#trTitle").append("<th>操作</th>");
}
function GenerNameLink(attr) {
var mypk = attr.MyPK;
var dataType = attr.MyDataType;
var field = attr.KeyOfEn;
var name = attr.Name;
var lgType = attr.LGType;
var uiBindKey = attr.UIBindKey;
var uiContralType = attr.UIContralType; //控件类型.
var uiWidth = attr.UIWidth; //宽度.
var nameLink = "";
var fk_mapDtl = GetQueryString("FK_MapDtl");
//普通类型字段.
if (lgType == 0) {
if (attr.MyDataType == "1" && attr.UIContralType == 1)
nameLink = "<a href=\"javascript:EditTable('" + fk_mapDtl + "','" + mypk + "','" + uiBindKey + "')\" > " + name + "</a>";
else
nameLink = "<a href=\"javascript:Edit('" + mypk + "','" + dataType + "',null,'" + attr.FK_MapData + "'," + uiContralType + ")\" > " + name + "</a>";
}
//枚举.
if (lgType == 1) {
nameLink = "<a href=\"javascript:EditEnumForDtl('" + fk_mapDtl + "','" + mypk + "','" + uiBindKey + "')\" > " + name + "</a>";
}
//外键.
if (lgType == 2) {
nameLink = "<a href=\"javascript:EditTable('" + fk_mapDtl + "','" + mypk + "','" + uiBindKey + "')\" > " + name + "</a>";
}
var tdUp = "<a href=\"javascript:Up('" + attr.MyPK + "','1');\" class='easyui-linkbutton l-btn l-btn-plain' data-options='iconCls:icon-left,plain:true' alt='向左动顺序' ><span class='l-btn-left'><span class='l-btn-text'><span class='l-btn-empty icon-left'>-</span></a>";
var tdDown = "<a href=\"javascript:Down('" + attr.MyPK + "','1');\" class='easyui-linkbutton l-btn l-btn-plain' data-options='iconCls:icon-right,plain:true' alt='向右动顺序' ><span class='l-btn-left'><span class='l-btn-text'><span class='l-btn-empty icon-right'>-</span></a>";
var col = "";
col = tdUp + nameLink + tdDown; // "<a href=\"javascript:Down('" + mypk + "')\" ><img src='../../../WF/Img/Btn/Right.gif' /></a>";
return col;
}
/**
* 二级表头,从表最多二级表头
* @param mapAttrs
* @param multiTitle
* @param fk_mapDtl
* @param fk_flow
* @param enEntity
*/
function showSecTable(mapAttrs, multiTitle, fk_mapDtl, fk_flow, enEntity) {
var _html = "<tr>";
_html += "<th rowspan=2>序</th>";
var _secHtml = "";
var currentGroup = "";
var idx1 = 0;
var idx = 0;
for (var i = 0; i < mapAttrs.length; i++) {
var attr = mapAttrs[i];
if (attr.UIVisible == 0)
continue;
if (fk_mapDtl == "BP.WF.ReturnWorks" && fields.indexOf(attr.KeyOfEn + ",") != -1)
continue;
if (fk_flow != null && attr.AtPara.indexOf("FK_Flow=" + fk_flow) == -1)
continue;
idx++;
var mypk = attr.MyPK;
var dataType = attr.MyDataType;
var field = attr.KeyOfEn;
var name = attr.Name;
var lgType = attr.LGType;
var uiBindKey = attr.UIBindKey;
var uiContralType = attr.UIContralType; //控件类型.
var uiWidth = attr.UIWidth; //宽度.
var nameLink = "";
//判断该字段是否隶属于二级表头的分组
if (multiTitle.indexOf("," + attr.KeyOfEn + ",") == -1)
_html += "<th rowspan=2>" + GenerNameLink(attr) + "</th>";
else {
var fields = getMutliFile(attr.KeyOfEn, multiTitle);
if (fields != "" && (currentGroup == "" || currentGroup != fields[0])) {
_html += "<th colspan=" + (fields.length - 1) + " style='text-align:center'><label>" + fields[0] + "</label>&nbsp;</th>";
currentGroup = fields[0];
idx1++;
}
nameLink = GenerNameLink(attr);
if (dataType == 2 || dataType == 3 || dataType == 5 || dataType == 6 || dataType == 8)
_secHtml += "<th style='word-break: keep-all;' nowarp=true >" + nameLink + "</th>";
else
_secHtml += "<th style='width:" + uiWidth + "px;word-break: keep-all;' nowarp=true >" + nameLink + "</th>";
}
}
if (enEntity.IsEnableAthM == 1)
_html += "<th rowspan=2>附件</th>";
_html += "<th rowspan=2>操作</th>";
_html += "</tr>";
_html += "<tr>" + _secHtml + "</tr>";
$("#trTitle").html(_html);
}
/**
* 获取二级表头
* @param keyOfEn
* @param multi
*/
function getMutliFile(keyOfEn, multi) {
var fields = multi.split(";");
for (var i = 0; i < fields.length; i++) {
var str = fields[i];
if (str == "")
continue;
if (str.indexOf("," + keyOfEn + ",") == -1)
continue;
var strs = str.substring(0, str.length - 1).split(",");
return strs;
}
return "";
}
function AddF(fk_mapdata) {
var url = 'FieldTypeList.htm?FK_MapData=' + fk_mapdata;
OpenEasyUiDialog(url, "eudlgframe", '新增字段', 800, 500, "icon-property", true, null, null, null, function () {
Reload();
});
// var b = window.showModalDialog(url, 'ass', 'dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no');
//Reload();
}
function AddFGroup(fk_mapdata) {
var url = 'Do.aspx?DoType=AddFGroup&FK_MapData=' + fk_mapdata;
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no');
Reload();
}
function CopyF(fk_mapdata) {
var url = 'CopyDtlField.htm?FK_MapData=' + fk_mapdata + '&s=' + Math.random();
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 600px; dialogWidth: 800px;center: yes; help: no');
Reload();
}
function HidAttr(mypk) {
var url = 'HidAttr.htm?FK_MapData=' + mypk + '&s=' + Math.random();
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 600px; dialogWidth: 800px;center: yes; help: no');
// Reload();
}
function Edit(mypk, ftype, gf, fk_mapdata, uiControlType) {
var parentwin = parent.window;
if (parentwin) {
var iFrame = parentwin.document.getElementById("F");
if (iFrame && iFrame.contentWindow && iFrame.contentWindow.location.href == location.href) {
parentwin.Edit(mypk, ftype, gf, fk_mapdata, uiControlType);
return;
}
parentwin.Edit(mypk, ftype, gf, fk_mapdata, uiControlType);
//alert("err");
return;
}
var url = '';
var title = ''
//普通字段类型.
if (ftype == "1") {
if (uiControlType == 6) {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.FrmAttachmentExt&inlayer=1&PKVal=" + mypk;
title = '字段附件属性';
} else {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&inlayer=1&PKVal=" + mypk;
title = '字段String属性';
}
}
//数值字段类型.
if (ftype == "2") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrNum&inlayer=1&PKVal=" + mypk;
title = '字段Int属性';
}
//数值字段类型.
if (ftype == "3") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrNum&inlayer=1&PKVal=" + mypk;
title = '字段Float属性';
}
//数值字段类型.
if (ftype == "5") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrNum&inlayer=1&PKVal=" + mypk;
title = '字段Double属性';
}
//数值字段类型.
if (ftype == "8") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrNum&inlayer=1&PKVal=" + mypk;
title = '字段Moeny属性';
}
//日期类型date.
if (ftype == "6") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrDT&inlayer=1&PKVal=" + mypk;
title = '字段Date属性';
}
//日期类型datetime.
if (ftype == "7") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrDT&inlayer=1&PKVal=" + mypk;
title = '字段DateTime属性';
}
// boolen 类型.
if (ftype == "4") {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrBoolen&inlayer=1&PKVal=" + mypk;
title = '字段Boolen属性';
}
if (url == '') {
alert('@没有判断的类型' + ftype);
return;
}
OpenEasyUiDialog(url, "eudlgframe", title, 800, 500, "icon-edit", true, null, null, null, function () {
Reload();
});
}
function EditEnumForDtl(fk_mapdata, mypk, enumKey) {
var parentwin = parent.window;
if (parentwin) {
var iFrame = parentwin.document.getElementById("F");
if (iFrame && iFrame.contentWindow && iFrame.contentWindow.location.href == location.href) {
parentwin.EditEnum(fk_mapdata, mypk, enumKey);
return;
}
parentwin.EditEnum(fk_mapdata, mypk, enumKey);
return;
}
var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrEnum&inlayer=1&PKVal=' + mypk + '&s=' + Math.random();
OpenEasyUiDialog(url, "eudlgframe", "编辑枚举字段", 800, 500, "icon-edit", true, null, null, null, function () {
Reload();
});
}
function EditTable(fk_mapdata, mypk, fk_sfTable) {
var parentwin = parent.window;
if (parentwin) {
var iFrame = parentwin.document.getElementById("F");
if (iFrame && iFrame.contentWindow && iFrame.contentWindow.location.href == location.href) {
parentwin.EditTable(fk_mapdata, mypk, fk_sfTable);
return;
}
parentwin.EditTable(fk_sfTable, mypk, fk_mapdata);
return;
}
var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrSFTable&inlayer=1&PKVal=' + mypk + '&s=' + Math.random();
OpenEasyUiDialog(url, "eudlgframe", "外键字段属性", 800, 500, "icon-edit", true, null, null, null, function () {
Reload();
});
}
function closeDlg() {
$("#eudlg").dialog("close");
}
function Up(mypk) {
var en = new Entity("BP.Sys.MapAttr", mypk);
var data = en.DoMethodReturnString("DoUpForMapDtl");
if (data.indexOf('err@') != -1)
alert(data);
Reload();
}
function Down(mypk) {
var en = new Entity("BP.Sys.MapAttr", mypk);
var data = en.DoMethodReturnString("DoDownForMapDtl");
if (data.indexOf('err@') != -1)
alert(data);
Reload();
}
function Del(fk_mapdata, refNo) {
if (window.confirm('您确定要删除吗?') == false)
return;
var url = 'Do.aspx?DoType=Del&MyPK=' + fk_mapdata + '&RefNo=' + refNo;
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 400px; dialogWidth: 600px;center: yes; help: no');
Reload();
}
function DtlMTR(MyPK) {
var url = 'MapDtlMTR.aspx?MyPK=' + MyPK + '&s=' + Math.random();
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 350px; dialogWidth: 550px;center: yes; help: no');
Reload();
}
function Attachment(fk_mapdtl) {
var url = 'Ath.htm?IsBTitle=1&PKVal=0&FK_MapData=' + fk_mapdtl + '&FK_FrmAttachment=' + fk_mapdtl + '_AthMDtl&Ath=AthMDtl&s=' + Math.random();
window.showModalDialog(url, 'xx', 'dialogWidth=750px;dialogHeight=700px');
}
</script>
</head>
<body>
<table id='dtlTable' style="width:99%;">
<tr id='trTitle'>
</tr>
</table>
</body>
</html>