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.
610 lines
23 KiB
Plaintext
610 lines
23 KiB
Plaintext
<!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="../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
|
|
<script src="../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
|
|
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
|
|
<script src="../../Scripts/config.js" type="text/javascript"></script>
|
|
<script src="../../Comm/Gener.js" type="text/javascript"></script>
|
|
<script src="../../Scripts/layui/layui/layui.js" type="text/javascript"></script>
|
|
<script src="../../Scripts/layui/LayuiDialog.js" type="text/javascript"></script>
|
|
<style type="text/css">
|
|
|
|
.layui-table-cell {
|
|
height: auto;
|
|
white-space: normal;
|
|
}
|
|
|
|
.layui-table-view .layui-form-checkbox {
|
|
top: 10px !important;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="layui-fluid">
|
|
<div class="layui-row layui-col-space15">
|
|
<div class="layui-col-md12">
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<table class="layui-hide" id="qua_standard_table" lay-filter="qua_standard_table"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var fk_mapData = GetQueryString("FK_MapData");
|
|
//明细表ID.
|
|
var fk_mapDtl = GetQueryString("FK_MapDtl");
|
|
var fk_flow = GetQueryString("FK_Flow");
|
|
layui.extend({ // 模块别名
|
|
soulTable: '../../Scripts/layui/ext/soulTable',
|
|
tableFilter: '../../Scripts/layui/ext/tableFilter',
|
|
tableChild: '../../Scripts/layui/ext/tableChild',
|
|
tableMerge: '../../Scripts/layui/ext/tableMerge',
|
|
excel: '../../Scripts/layui/ext/excel',
|
|
});
|
|
|
|
layui.use(['table', 'soulTable'], function () {
|
|
var table = layui.table,
|
|
soulTable = layui.soulTable;
|
|
|
|
//数据的基本信息
|
|
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 isSecMulti = false;
|
|
if (multiTitle == null || multiTitle == undefined || multiTitle == "" || multiTitle == "undefined") {
|
|
isThrMulti = false;
|
|
multiTitle = multiTitle1;
|
|
}
|
|
if (multiTitle == null || multiTitle == undefined || multiTitle == "" && multiTitle == "undefined")
|
|
multiTitle = "";
|
|
|
|
if (multiTitle != "")
|
|
isSecMulti = true;
|
|
//分析表头数据
|
|
var cols = [];
|
|
if (isSecMulti == false)
|
|
cols = showTable(attrs, fk_mapDtl, fk_flow, enEntity)
|
|
if (isSecMulti == true)
|
|
cols = showSecTable(attrs, multiTitle, fk_mapDtl, fk_flow, enEntity);
|
|
var data = GetDataTable(attrs);
|
|
|
|
//主页面数据
|
|
table.render({
|
|
elem: '#qua_standard_table',
|
|
id: 'qua_standard_table',
|
|
data: data,
|
|
title: '数据表',
|
|
//height: 'full-60',
|
|
cellMinWidth: 120,
|
|
size: 'lg',
|
|
cols: isSecMulti == true ? cols : [cols],
|
|
drag: {
|
|
done: function (obj) {
|
|
var data = obj.cache;
|
|
var ids = '';
|
|
if (data.length > 0) {
|
|
for (i = 0; i < data.length; i++) {
|
|
ids += data[i].id + ",";
|
|
}
|
|
}
|
|
console.log(ids);
|
|
}
|
|
},
|
|
done: function () {
|
|
soulTable.render(this);
|
|
setIframeHeight();
|
|
}
|
|
});
|
|
|
|
/**
|
|
* 只有一级表头的解析
|
|
* @param mapAttr
|
|
*/
|
|
function showTable(attrs, fk_mapDtl, fk_flow, mapDtl) {
|
|
|
|
var cols = [];
|
|
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 namelink = GenerNameLink(attr);
|
|
if (attr.MyDataType == 4) {
|
|
cols.push({
|
|
field: attr.KeyOfEn,
|
|
title: namelink,
|
|
width: attr.UIWidth,
|
|
align: 'center',
|
|
name: attr.Name,
|
|
templet: function (d) {
|
|
return "<input type=checkbox value='1' id='" + this.field + "_" + d.LAY_INDEX + "' name='" + this.field + "_" + d.LAY_INDEX + "' lay-skin='primary'/>";
|
|
}
|
|
|
|
});
|
|
} else {
|
|
cols.push({
|
|
field: attr.KeyOfEn,
|
|
title: namelink,
|
|
width: attr.UIWidth
|
|
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if (mapDtl.IsEnableAthM == 1) {
|
|
cols.push({
|
|
field: 'certificate',
|
|
title: '附件',
|
|
align: 'center',
|
|
templet: function (d) {
|
|
return '<span class="layui-breadcrumb" lay-separator="|">' +
|
|
'<a href="javascript:;">添加附件</a>' +
|
|
'</span>';
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
cols.push({
|
|
field: 'operation',
|
|
title: '操作',
|
|
align: 'center',
|
|
templet: function (d) {
|
|
return '<span class="layui-breadcrumb" lay-separator="|"></span>';
|
|
}
|
|
});
|
|
return cols;
|
|
}
|
|
/**
|
|
* 二级表头,从表最多二级表头
|
|
* @param mapAttrs
|
|
* @param multiTitle
|
|
* @param fk_mapDtl
|
|
* @param fk_flow
|
|
* @param enEntity
|
|
*/
|
|
function showSecTable(mapAttrs, multiTitle, fk_mapDtl, fk_flow, mapDtl) {
|
|
var secondCols = [], firstCols = [];
|
|
var currentGroup = "";
|
|
|
|
$.each(mapAttrs, function (i, attr) {
|
|
if (attr.UIVisible == 0)
|
|
return true;
|
|
if (fk_mapDtl == "BP.WF.ReturnWorks" && fields.indexOf(attr.KeyOfEn + ",") != -1)
|
|
return true;
|
|
if (fk_flow != null && attr.AtPara.indexOf("FK_Flow=" + fk_flow) == -1)
|
|
return true;
|
|
|
|
//判断该字段是否隶属于二级表头的分组
|
|
if (multiTitle.indexOf("," + attr.KeyOfEn + ",") == -1)
|
|
if (attr.MyDataType == 4) {
|
|
secondCols.push({
|
|
field: attr.KeyOfEn,
|
|
title: GenerNameLink(attr),
|
|
width: attr.UIWidth,
|
|
rowspan: 2,
|
|
align: 'center',
|
|
templet: function (d) {
|
|
return "<input type=checkbox value='1' id='" + this.field + "_" + d.LAY_INDEX + "' name='" + this.field + "_" + d.LAY_INDEX + "' /></label>";
|
|
}
|
|
|
|
|
|
});
|
|
} else {
|
|
secondCols.push({
|
|
field: attr.KeyOfEn,
|
|
title: GenerNameLink(attr),
|
|
width: attr.UIWidth,
|
|
rowspan: 2
|
|
});
|
|
}
|
|
|
|
else {
|
|
var fields = getMutliFile(attr.KeyOfEn, multiTitle);
|
|
if (fields != "" && (currentGroup == "" || currentGroup != fields[0])) {
|
|
secondCols.push({
|
|
field: fields[0],
|
|
title: fields[0],
|
|
colspan: fields.length - 1,
|
|
align: 'center'
|
|
});
|
|
currentGroup = fields[0];
|
|
}
|
|
|
|
if (attr.MyDataType == 4) {
|
|
firstCols.push({
|
|
field: attr.KeyOfEn,
|
|
title: GenerNameLink(attr),
|
|
width: attr.UIWidth,
|
|
align: 'center',
|
|
templet: function (d) {
|
|
return "<input type=checkbox value='1' id='" + this.field + "_" + d.LAY_INDEX + "' name='" + this.field + "_" + d.LAY_INDEX + "' /></label>";
|
|
}
|
|
|
|
|
|
});
|
|
} else {
|
|
firstCols.push({
|
|
field: attr.KeyOfEn,
|
|
title: GenerNameLink(attr),
|
|
width: attr.UIWidth,
|
|
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
|
|
});
|
|
if (mapDtl.IsEnableAthM == 1) {
|
|
secondCols.push({
|
|
field: 'certificate',
|
|
title: '附件',
|
|
align: 'center',
|
|
rowspan: 2,
|
|
templet: function (d) {
|
|
return '<span class="layui-breadcrumb" lay-separator="|">' +
|
|
'<a href="javascript:;">添加附件</a>' +
|
|
'</span>';
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
secondCols.push({
|
|
field: 'operation',
|
|
title: '操作',
|
|
align: 'center',
|
|
rowspan: 2,
|
|
templet: function (d) {
|
|
return '<span class="layui-breadcrumb" lay-separator="|"></span>';
|
|
}
|
|
});
|
|
cols.push(secondCols);
|
|
cols.push(firstCols);
|
|
return cols;
|
|
}
|
|
|
|
/**
|
|
* 获取二级表头
|
|
* @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 "";
|
|
}
|
|
/**
|
|
* 获取label标签
|
|
* @param attr
|
|
*/
|
|
function GenerNameLink(attr) {
|
|
var mypk = attr.MyPK;
|
|
var dataType = attr.MyDataType;
|
|
if (attr.UIIsInput == 1)
|
|
attr.Name = attr.Name + "<font color=red>*</font>";
|
|
var name = attr.Name;
|
|
var lgType = attr.LGType;
|
|
var uiBindKey = attr.UIBindKey;
|
|
var uiContralType = attr.UIContralType; //控件类型.
|
|
|
|
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>";
|
|
}
|
|
return nameLink;
|
|
}
|
|
|
|
function GetDataTable(attrs) {
|
|
var data = [];
|
|
var rowData = {};
|
|
$.each(attrs, function (i, attr) {
|
|
if (attr.UIVisible == 0)
|
|
return true;
|
|
if (fk_mapDtl == "BP.WF.ReturnWorks" && fields.indexOf(attr.KeyOfEn + ",") != -1)
|
|
return true;
|
|
if (fk_flow != null && attr.AtPara.indexOf("FK_Flow=" + fk_flow) == -1)
|
|
return true;
|
|
var defVal = attr.DefVal; //默认值.
|
|
defVal = defVal == "null" || defVal == null ? "" : defVal;
|
|
|
|
var myDataType = parseInt(attr.MyDataType);
|
|
//if (defVal == "" && (myDataType == 2 || myDataType == 3 || myDataType == 4)) {
|
|
// if (myDataType == 4)
|
|
// defVal = "0.00";
|
|
// else
|
|
// defVal = "0";
|
|
//}
|
|
|
|
switch (myDataType) {
|
|
case 1:
|
|
if (attr.UIContralType == 0)
|
|
rowData[attr.KeyOfEn] = defVal;
|
|
break;
|
|
case 2:
|
|
case 3:
|
|
case 5:
|
|
case 8:
|
|
case 4:
|
|
rowData[attr.KeyOfEn] = defVal;
|
|
break;
|
|
case 6:
|
|
rowData[attr.KeyOfEn] = "yyyy-MM-dd";
|
|
break;
|
|
case 7:
|
|
rowData[attr.KeyOfEn] = "yyyy-MM-dd HH:mm";
|
|
break;
|
|
}
|
|
if (attr.UIContralType == 1)
|
|
rowData[attr.KeyOfEn] = "[下拉框]";
|
|
});
|
|
for (var i = 0; i < 6; i++) {
|
|
data.push(rowData);
|
|
}
|
|
return data;
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
});
|
|
|
|
function RecordCols(myTable) {
|
|
var cols = myTable.cols[0];
|
|
var columns = [];
|
|
var fk_mapDtl = GetQueryString("FK_MapDtl");
|
|
$.each(cols, function (i, col) {
|
|
if (col.field == "operation" || col.field == "certificate")
|
|
return true;
|
|
columns.push(fk_mapDtl + "_" + col.field);
|
|
});
|
|
var en = new Entity("BP.Sys.MapDtl", fk_mapDtl);
|
|
var data = en.DoMethodReturnString("ChangeMapAttrIdx", columns.join(","));
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
}
|
|
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 getWindowWH() {
|
|
//获取页面的大小
|
|
if (window.innerWidth)
|
|
W = window.innerWidth;
|
|
else if ((document.body) && (document.body.clientWidth))
|
|
W = document.body.clientWidth;
|
|
W = W - 400;
|
|
if (window.innerHeight)
|
|
H = window.innerHeight;
|
|
else if ((document.body) && (document.body.clientHeight))
|
|
H = document.body.clientHeight;
|
|
H = H - 80;
|
|
}
|
|
|
|
function Edit(mypk, ftype, gf, fk_mapdata, uiControlType) {
|
|
var parentwin = parent.window;
|
|
if (parentwin) {
|
|
var iFrame = parentwin.document.getElementById("F" + fk_mapdata);
|
|
if (iFrame != null && 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);
|
|
//return;
|
|
}
|
|
|
|
var url = '';
|
|
var title = ''
|
|
|
|
//普通字段类型.
|
|
if (ftype == "1") {
|
|
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;
|
|
}
|
|
getWindowWH();
|
|
OpenLayuiDialog(url, title, W, 0, null, true);
|
|
|
|
}
|
|
|
|
function EditEnumForDtl(fk_mapdata, mypk, enumKey) {
|
|
|
|
var parentwin = parent.window;
|
|
if (parentwin) {
|
|
var iFrame = parentwin.document.getElementById("F" + fk_mapdata);
|
|
|
|
if (iFrame != null && 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();
|
|
getWindowWH();
|
|
OpenLayuiDialog(url, "编辑枚举字段", W, 0, null, true);
|
|
|
|
}
|
|
function EditTable(fk_mapdata, mypk, fk_sfTable) {
|
|
|
|
var parentwin = parent.window;
|
|
|
|
if (parentwin) {
|
|
|
|
var iFrame = parentwin.document.getElementById("F" + fk_mapdata);
|
|
|
|
|
|
if (iFrame != null && 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();
|
|
getWindowWH();
|
|
OpenLayuiDialog(url, "外键字段属性", W, 0, null, true);
|
|
|
|
}
|
|
|
|
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 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>
|
|
</body>
|
|
</html>
|