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.

1194 lines
57 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>
<meta charset="UTF-8" />
<base target="_self" />
<script src="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<script language="JavaScript" src="../Comm/JScript.js" type="text/javascript"></script>
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../Scripts/config.js" type="text/javascript"></script>
<link href="../../DataUser/Style/Dtl.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.css" rel="stylesheet" />
<script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
<script src="../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap/BootstrapUIDialog.js"></script>
<link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/commonYangYH.js"></script>
<!--End Pop弹出框、小范围多选-->
<script src="../Comm/JS/TBHelpDiv.js" type="text/javascript"></script>
<script src="../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/bootstrap/BootstrapUIDialog.js"></script>
<link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Scripts/config.js"></script>
<script src="../Comm/Gener.js" type="text/javascript"></script>
<script src="../Data/JSLibData/CovertMoneyToDaXie.js" type="text/javascript"></script>
<script src="../../DataUser/JSLibData/CCFormRef.js" type="text/javascript"></script>
<script src="../../DataUser/SFTable.js" type="text/javascript"></script>
<style>
th, td {
white-space: normal;
}
.pagination-detail{
color:black !important;
}
* {
font-family: '微软雅黑';
font-size: 14px;
}
.errorInput {
border-color: red !important;
}
.table thead {
width: 100%;
box-sizing: border-box;
}
input[type=text], input[type=password], select {
box-sizing: border-box;
}
* {
scrollbar-color: #9cc9f0 #f7f7f9;
scrollbar-width: thin;
}
* {
font-family: microsoftYaHei,'微软雅黑';
}
.table > thead > tr > th {
border-top: 1px solid #ddd !important;
}
</style>
<script language="javascript" type="text/javascript">
var hjl = new Array(); //合计列名称集合
var ensName = GetQueryString("EnsName");
var isShowFull = GetQueryString("IsShowFull");
isShowFull = isShowFull == null || isShowFull == undefined || isShowFull == "" ? "0 " : isShowFull;
var webUser = new WebUser();
var sys_mapAttr = null;
//页面启动函数.
$(function () {
//增加自定义的函数
jQuery.getScript("../../DataUser/JSLibData/" + ensName + ".js");
jQuery.getScript("../../DataUser/JSLibData/" + ensName + "_Self.js");
//初始化从表数据
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddUrlData();
var data = handler.DoMethodReturnString("FrmDB_DtlCompare");
// 检查是否有错误.
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
//解析.
data = JSON.parse(data);
workNodeData = data;
//从表信息.
sys_MapDtl = data["Sys_MapDtl"][0]; //从表描述.
sys_mapAttr = data["Sys_MapAttr"]; //从表字段.
var sys_mapExtDtl = data["Sys_MapExt"]; //扩展信息.
mapAttrs = sys_mapAttr;
mapExts = sys_mapExtDtl;
var mainDtl = data["Main_" + sys_MapDtl.PTable]; //主版本从表数据.
if (mainDtl == null || mainDtl == undefined)
mainDtl = [];
var compareDtl = data["Compare_" + sys_MapDtl.PTable]; //比对版本从表数据.
if (compareDtl == null || compareDtl == undefined)
compareDtl = [];
Parse_Dtl(mainDtl, "mainDtlDiv");
Parse_Dtl(compareDtl, "compareDtlDiv");
setIframeHeight();
});
//初始化数据.
var sys_MapDtl; //从表的属性
var isMulti = false;
var mapAttrs = [];
function Parse_Dtl(dtlData,dtlDiv) {
$('#'+dtlDiv+' div table tbody').html(''); //清空表格数据
if (sys_MapDtl.ShowCols) {
var ShowCols = sys_MapDtl.ShowCols.split(",");
$.each(sys_mapAttr, function (i, o) {
if (o.UIVisible == 1 && ShowCols.indexOf(o.KeyOfEn) == -1) {
o.UIVisible = 0;
}
});
}
// 表头start --------------------
if ($('#' + dtlDiv +' div table thead tr').length == 0) {
var multi = GetPara(sys_MapDtl.AtPara, "MultiTitle");
if (multi == null || multi == undefined || multi == "")
multi = GetPara(sys_MapDtl.AtPara, "MultiTitle1")
if (multi != null && multi != undefined && multi != "")
isMulti = true;
var rowspan = "rowspan=1";
if (isMulti == true)
rowspan = "rowspan=2";
var threadTr = $('<tr data-data="true"></tr>');
var secondTr = $('<tr data-data="true"></tr>');
var currentGroup = "";
var snTh = $('<th data-coltype="SN" ' + rowspan + ' style=\'width:20px;border-left:none;\' ></th>');
threadTr.append(snTh);
$.each(sys_mapAttr, function (i, mapAttrObj) {
var mustInput = "";
if (mapAttrObj.UIIsInput == 1)
mustInput = '<span style="color:red" class="mustInput" data-keyofen="' + mapAttrObj.KeyOfEn + '">*</span>';
if (isMulti == false || multi.indexOf(mapAttrObj.KeyOfEn + ",") == -1) {
var th = $('<th class="thStyle"' + rowspan + '></th>');
if (mapAttrObj.MyDataType == 8)
th = $('<th data-coltype="Money"' + rowspan + '></th>');
th.data(mapAttrObj);
if (mapAttrObj.MyDataType == 6)
th.css('width', 110);
if (mapAttrObj.MyDataType == 7)
th.css('width', 127);
else
th.css('width', mapAttrObj.UIWidth);
th.html("<div style='min-width:" + th.css("width") + ";white-space:noraml;'>" + mapAttrObj.Name + "</div>");
if (mapAttrObj.UIVisible == 0)
th.css("display", "none");
th.data().colname = mapAttrObj.KeyOfEn;
th.append(mustInput);
threadTr.append(th);
} else {
var fields = getMutliField(mapAttrObj.KeyOfEn, multi);
if (fields != "" && (currentGroup == "" || currentGroup != fields[0])) {
var info = fields.join(",");
info = "Multi," + info.substring(info.indexOf(",") + 1) + ",";
var th = $('<th class="thStyle" style="text-align:center" data-info="' + info + '" colspan=' + (fields.length - 1) + '></th>');
th.text(fields[0]);
threadTr.append(th);
currentGroup = fields[0];
}
var th = $('<th class="thStyle" data-info="' + mapAttrObj.KeyOfEn + '"></th>');
if (mapAttrObj.MyDataType == 8)
th = $('<th data-coltype="Money" data-info="' + mapAttrObj.KeyOfEn + '"></th>');
th.data(mapAttrObj);
if (mapAttrObj.MyDataType == 6)
th.css('width', 110);
if (mapAttrObj.MyDataType == 7)
th.css('width', 127);
else
th.css('width', mapAttrObj.UIWidth);
th.html("<div style='min-width:" + th.css("width") + ";white-space:noraml;'>" + mapAttrObj.Name + "</div>");
if (mapAttrObj.UIVisible == 0)
th.css("display", "none");
th.data().colname = mapAttrObj.KeyOfEn;
th.append(mustInput);
secondTr.append(th);
}
});
//增加附件.
var athTh = $('<th style="width:50px;"' + rowspan + '>附件</th>');
var athThData;
athThData = {
custom: true,
customcontent: 1,
customcontent1: "a@href='javaScript:void(0);' onclick='OpenDtlAth(this)' style='margin-left:20px' titile=附件 @<i class='fa fa-upload' aria-hidden='true'></i>",
coltype: 'Operation1'
};
if (sys_MapDtl.IsEnableAthM == 1) {
//引入js
Skip.addJs(basePath + "/WF/CCForm/Ath.js", parent.document.getElementsByTagName('script')[0]);
Skip.addJs(basePath + "/WF/CCForm/JS/FileUpload/fileUpload.js", parent.document.getElementsByTagName('script')[0]);
Skip.addJs(basePath + "/WF/Scripts/jquery-form.js", parent.document.getElementsByTagName('script')[0]);
Skip.addJs(basePath + "/DataUser/OverrideFiles/Ath.js", parent.document.getElementsByTagName('script')[0]);
parent.$('head').append("<link href='" + basePath + "/WF/CCForm/JS/FileUpload/css/fileUpload.css' rel='stylesheet' type='text/css' />");
athTh.data(athThData);
threadTr.append(athTh);
}
//超链接
if (sys_MapDtl.IsEnableLink == 1) {
var linkTh = $('<th style="width:50px;"' + rowspan + '>链接</th>');
var target = sys_MapDtl.LinkTarget;
var LinkLabel = sys_MapDtl.LinkLabel;
var linkThData;
linkThData = {
custom: true,
customcontent: 1,
customcontent1: "a@href='javaScript:void(0);' onclick='OpenLink(this)' titile='链接' @" + LinkLabel,
coltype: 'Operation1'
};
linkTh.data(linkThData);
threadTr.append(linkTh);
}
//添加删除,保存列
var delTh = "";
var impModel = sys_MapDtl.ImpModel;
var IsExp = sys_MapDtl.IsImp;//导出
var th = $("<th style='width:120px;white-space: nowrap;'" + rowspan + "></th>");
var imgStr = "";
if (impModel != 0) {
imgStr += '<img title="选项" style="width: 40px;padding: 0px 5px;cursor:pointer;" src="../Img/Btn/Option.gif" onclick="Option(' + impModel + ');" />';
}
if (isShowFull != "1")
imgStr += '<img title="全屏显示" style="width: 30px;padding: 0px 5px;cursor:pointer;" src="../Img/Full.png" onclick="WindowOpenDtl()" />'
var delTh = $($(th).append(imgStr));
threadTr.append(delTh);
delTh = $('<th style=" border-right:none;"' + rowspan + '></th>');
delTh.text("操作");
var delThData = {
custom: true,
customcontent: 1,
customcontent1: 'img@src="../Img/Btn/Save.gif" onclick="saveTrRow(this)" titile="保存" style="cursor:pointer;"@',
coltype: 'Operation1'
};
delTh.attr('title', "title");
delTh.data(delThData);
$('#' + dtlDiv +' div table thead').append(threadTr);
if (isMulti == true)
$('#' + dtlDiv +' div table thead').append(secondTr);
}
//初始化表数据
var dbDtlTmp = { DTObjs: dtlData };
var dtlDataOption = {
IsShowAll: true,
PageSize: 10,
PageIndex: 1,
DivId: dtlDiv,
IsUseLocalData: true,
LocalData: JSON.stringify(dbDtlTmp),
RenderOverFun: function () {
//循环TBODY
var tbodyTrs = $('#' + dtlDiv +' div table tbody tr');
$.each(tbodyTrs, function (m, tbodyTrObj) {
var threadTh = getUseHeadTh(dtlDiv);
var index = m;
$.each(threadTh, function (k, threadThObj) {
if ($(threadThObj).data().colname != undefined) {
var o = $(threadThObj);
var tmplate = figure_MapAttr_Template(o.data());
// 1=自由表单模式 2=傻瓜表单模式
if (sys_MapDtl.EditModel != 0) {
tmplate.attr("disabled", "disabled");
}
var rowIndex = (parseInt($($(tbodyTrObj).find('td')[0]).text()) - 1);
var mapAttr = o.data();
//枚举复选框
if (mapAttr.MyDataType == "1" && mapAttr.UIContralType == "2" && mapAttr.LGType == 1) {
$.each(tmplate, function (idx, obj) {
if (obj.nodeName != "LABEL") {
$(obj).attr('name', $(obj).attr('name') + '_' + rowIndex);
$(obj).attr('id', $(obj).attr('id') + '_' + rowIndex);
$(obj).data({ KeyOfEn: o.data().KeyOfEn });
}
});
var ckEles = $.grep(tmplate, function (obj) {
return $(obj).attr('name') == 'CB_' + o.data().KeyOfEn;
});
var textVal = "," + $($(tbodyTrObj).children('td')[k]).text() + ",";
$.each(ckEles, function () {
if (textVal.indexOf("," + $(this).val() + ",") != -1)
$(this).attr("checked", true);
else
$(this).attr("checked", false);
});
$($(tbodyTrObj).children('td')[k]).text('');
$($(tbodyTrObj).children('td')[k]).append(tmplate);
//枚举单选按钮
} else if (mapAttr.MyDataType == "2" && mapAttr.UIContralType == "3") {
$.each(tmplate, function (idx, obj) {
if (obj.nodeName != "LABEL") {
$(obj).attr('name', $(obj).attr('name') + '_' + rowIndex);
$(obj).attr('id', $(obj).attr('id') + '_' + rowIndex);
$(obj).data({ KeyOfEn: o.data().KeyOfEn });
}
});
var radioEles = $.grep(tmplate, function (obj) {
return $(obj).attr('name') == 'RB_' + o.data().KeyOfEn;
});
var textVal = $($(tbodyTrObj).children('td')[k]).text();
$.each(radioEles, function () {
if (textVal == $(this).val())
$(this).attr("checked", true);
else
$(this).attr("checked", false);
});
$($(tbodyTrObj).children('td')[k]).text('');
$($(tbodyTrObj).children('td')[k]).append(tmplate);
} else {
if (tmplate.length >= 2) {
if (tmplate[1].nodeName == "SPAN") {
$(tmplate[0]).data({ KeyOfEn: o.data().KeyOfEn });
//ID 设置为 id+'_1'
//先写出 NAME 单选扭会出问题
$(tmplate[0]).attr('id', $(tmplate[0]).attr('name') + '_' + rowIndex);
}
if (tmplate[1].nodeName == "INPUT") {
$(tmplate[0]).data({ KeyOfEn: o.data().KeyOfEn + "T" });
$(tmplate[1]).data({ KeyOfEn: o.data().KeyOfEn });
}
$(tmplate[0]).attr('id', $(tmplate[0]).attr('name') + '_' + rowIndex);
$(tmplate[1]).attr('id', $(tmplate[1]).attr('name') + '_' + rowIndex);
} else {
tmplate.data({ KeyOfEn: o.data().KeyOfEn });
//ID 设置为 id+'_1'
var rowIndex = (parseInt($($(tbodyTrObj).find('td')[0]).text()) - 1);
//先写出 NAME 单选扭会出问题
tmplate.attr('id', tmplate.attr('name') + '_' + rowIndex);
}
//处理复选框 设置表格中数据的值
var textVal = $($(tbodyTrObj).children('td')[k]).text();
var ckEle = tmplate.find('[name=CB_' + o.data().KeyOfEn + ']');
if (ckEle.length == 1) {
var ckId = 'CB_' + o.data().KeyOfEn + '_' + rowIndex;
ckEle.attr('id', ckId);
tmplate.find('label').attr('for', ckId);
if (textVal == "1") {
ckEle[0].checked = true;
} else {
ckEle[0].checked = false;
}
}
else {
// 判断下拉框是否有对应option, 若没有则追加
if (o.data().LGType == 2 || o.data().UIContralType == "1") {
if ($("option[value='" + textVal + "']", tmplate).length == 0) {
try {
var c = dtlData[index];
if (c) {
var text = c[o.data().KeyOfEn + "Text"];
if (text == "" || text == undefined)
text = c[o.data().KeyOfEn + "T"];
tmplate.append("<option value='" + textVal + "'>" + text + "</option>");
}
} catch (e) {
}
}
}
tmplate.val(textVal);
}
//处理单选按钮。。。 还没做
$($(tbodyTrObj).children('td')[k]).text('');
$($(tbodyTrObj).children('td')[k]).append(tmplate);
}
if (tmplate.attr('name') != undefined && tmplate.length == 1 && tmplate.attr('name').indexOf('TB_') == 0) {
$(tmplate).bind('blur', function (obj) {
$(obj.target).parent().parent().data().data[$(obj.target).data().KeyOfEn] = $(obj.target).val();
});
} else if (tmplate.attr('name') != undefined && tmplate.attr('name').indexOf('DDL_') == 0 || (tmplate.length > 1 && $(tmplate[1]).attr('name') != undefined && $(tmplate[1]).attr('name').indexOf('DDL_') == 0)) {
//对于只读的下拉框做如下处理 为只读的下拉框赋值.
if (o.data().UIIsEnable == "0") {
} else {
$(tmplate).bind('change', function (obj) {
$(obj.target).parent().parent().data().data[$(obj.target).data().KeyOfEn] = $(obj.target).val();
});
}
} else if (tmplate.attr('name') == undefined && tmplate.find('[name^=CB_]').length == 1) {
$(tmplate).find('[name^=CB_]').bind('change', function (obj) {
$(obj.target).parent().parent().parent().data().data[$(obj.target).parent().data().KeyOfEn] = $(tmplate).find('[name^=CB_]')[0].checked == true ? 1 : 0;
});
}
}
});
})
$('#'+dtlDiv+' div table tbody tr input[type=text]').attr('disabled', 'disabled');
$('#' + dtlDiv +' div table tbody tr textarea').attr('disabled', 'disabled');
$('#' + dtlDiv +' div table tbody tr select').attr('disabled', 'disabled');
$('#' + dtlDiv +' div table tbody tr input[type=checkbox]').attr('disabled', 'disabled');
}
};
$('#' + dtlDiv +' div table tbody tr').remove();
Common.CustomPagePlug(dtlDataOption); //绑定表格
if (typeof sys_MapDtl.ColAutoExp != "undefined" && sys_MapDtl.ColAutoExp != "") {
window.columnExp = [];
// 解析统计规则字符串
$.each(sys_MapDtl.ColAutoExp.split("@"), function (i, e) {
if (e.indexOf(":") != -1) {
var sp = e.split(":");
columnExp.push({
"KeyOfEn": sp[0], // 字段
"exp": sp[1] // 表达式
});
}
});
}
if ($.isArray(dtlData) && dtlData.length >= 0) {
if (typeof sys_MapDtl.ColAutoExp != "undefined" && sys_MapDtl.ColAutoExp != "") {
addStatisticsRow(dtlDiv);
bindStatistics(dtlDiv);
}
var formExt = $("#formExt").val();
var extObj = null;
try {
if (formExt && formExt != "") {
extObj = JSON.parse(formExt);
}
} catch (e) {
}
if (extObj) {
parentStatistics(extObj, dtlDiv);
}
}
//textarea的高度自适应的设置
var textareas = $("textarea");
$.each(textareas, function (idex, item) {
autoTextarea(item);
});
$('#Msg').hide();
return;
}
//升级表单元素 初始化文本框、日期、时间
function figure_MapAttr_Template(mapAttr) {
var eleHtml = '';
if (mapAttr.UIVisible == 1) {//是否显示
var str = '';
var defValue = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn);
var isInOneRow = false; //是否占一整行
var islabelIsInEle = false; //
eleHtml += '';
if (mapAttr.UIContralType != 6) {
if (mapAttr.LGType == 2) {
eleHtml += "<select name='DDL_" + mapAttr.KeyOfEn + "' " + (mapAttr.UIIsEnable ? '' : 'disabled="disabled"') + ">" + InitDDLOperation(workNodeData, mapAttr, defValue) + "</select>";
} else {
//枚举复选框
if (mapAttr.MyDataType == "1" && mapAttr.UIContralType == "2" && mapAttr.LGType == 1) {
var ses = workNodeData[mapAttr.KeyOfEn];
if (ses == undefined)
ses = workNodeData[mapAttr.UIBindKey];
if (ses == undefined) {
var sess = workNodeData.Sys_Enum;
ses = $.grep(sess, function (value) {
return value.EnumKey == mapAttr.UIBindKey;
});
}
var enableAttr = "";
if (mapAttr.UIIsEnable == 1)
enableAttr = "";
else
enableAttr = "disabled='disabled'";
//显示方式,默认为横向展示.
var RBShowModel = 0;
if (mapAttr.AtPara.indexOf('@RBShowModel=0') > 0)
RBShowModel = 1;
for (var i = 0; i < ses.length; i++) {
var se = ses[i];
var br = "";
if (RBShowModel == 1)
br = "<br>";
var checked = "";
if (("," + defValue + ",").indexOf("," + se.No + ",") != -1)
checked = " checked=true";
eleHtml += "<input type=checkbox name='CB_" + mapAttr.KeyOfEn + "' id='CB_" + mapAttr.KeyOfEn + "_" + se.No + "' value='" + se.No + "' " + checked + enableAttr + "/><span>" + se.Name + "&nbsp;</span>" + br;
}
}
//添加文本框 ,日期控件等
//AppString
else if (mapAttr.MyDataType == "1" && mapAttr.LGType != "2") {//不是外键
if (mapAttr.UIContralType == "1") {//DDL 下拉列表框
eleHtml += "<select name='DDL_" + mapAttr.KeyOfEn + "' value='" + ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn) + "' " + (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') + InitDDLOperation(workNodeData, mapAttr, defValue) + "</select>";
eleHtml += "<input type='hidden' name='TB_" + mapAttr.KeyOfEn + "' value='" + ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn + "T") + "' />";
} else if (mapAttr.IsSupperText == "1") {
eleHtml += "<textarea id='TB_" + mapAttr.KeyOfEn + "' maxlength=" + mapAttr.MaxLen + " style='height:" + mapAttr.UIHeight + "px;' name='TB_" + mapAttr.KeyOfEn + "' type='text' " + (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') + "/>";
} else {
eleHtml += "<input maxlength=" + mapAttr.MaxLen + " name='TB_" + mapAttr.KeyOfEn + "' type='text' " + (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') + "/>";
}
} //AppDate
else if (mapAttr.MyDataType == 6) {//AppDate
var enableAttr = '';
var frmDate = mapAttr.IsSupperText;//获取日期格式
var dateFmt = '';
if (frmDate == 0) {
dateFmt = "yyyy-MM-dd";
} else if (frmDate == 3) {
dateFmt = "yyyy-MM";
} else if (frmDate == 6) {
dateFmt = "MM-dd";
} else if (frmDate == 7) {
dateFmt = "yyyy";
} else
dateFmt = "yyyy-MM-dd";
if (mapAttr.UIIsEnable == 1) {
enableAttr = 'onfocus="' + 'WdatePicker({dateFmt:' + '\'' + dateFmt + '\'});SetChange(false);" onchange="SetChange(true);" style="width:110px;"';
} else {
enableAttr = "disabled='disabled'";
}
eleHtml += "<input maxlength=" + mapAttr.MaxLen + " type='text' " + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "' class='Wdate'/>";
}
else if (mapAttr.MyDataType == 7) {// AppDateTime = 7
var enableAttr = '';
var frmDate = mapAttr.IsSupperText; //获取日期格式
var dateFmt = '';
if (frmDate == 1) {
dateFmt = "yyyy-MM-dd HH:mm";
} else if (frmDate == 2) {
dateFmt = "yyyy-MM-dd HH:mm:ss";
} else if (frmDate == 4) {
dateFmt = "HH:mm";
} else if (frmDate == 5) {
dateFmt = "HH:mm:ss";
} else
dateFmt = "yyyy-MM-dd HH:mm";
if (mapAttr.UIIsEnable == 1) {
enableAttr = 'onfocus="WdatePicker({dateFmt:' + '\'' + dateFmt + '\'});SetChange(false);" onchange="SetChange(true);" style="width:127px;"';
} else {
enableAttr = "disabled='disabled'";
}
eleHtml += "<input maxlength=" + mapAttr.MaxLen / 2 + " type='text' " + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "' class='Wdate'/>";
}
else if (mapAttr.MyDataType == 4) {// AppBoolean = 7
if (mapAttr.UIIsEnable == 1) {
} else {
enableAttr = "disabled='disabled'";
}
//CHECKBOX 默认值
eleHtml += "<div style='white-space: nowrap;align:center;'><input style='text-align:center;' type='checkbox' name='CB_" + mapAttr.KeyOfEn + "' /></div>";
}
if (mapAttr.MyDataType == 2 && mapAttr.LGType == 1) { //AppInt Enum
if (mapAttr.UIContralType == 1) {//DDL
eleHtml += "<select name='DDL_" + mapAttr.KeyOfEn + "' " + (mapAttr.UIIsEnable ? '' : 'disabled="disabled"') + ">" + InitDDLOperation(workNodeData, mapAttr, defValue) + "</select>";
}
if (mapAttr.UIContralType == 3) {
//横向排列
var RBShowModel = 3;
if (mapAttr.AtPara.indexOf("@RBShowModel=3") == -1)
RBShowModel = 0;
var enums = workNodeData[mapAttr.KeyOfEn];
if (enums == undefined)
enums = workNodeData[mapAttr.UIBindKey];
if (enums == undefined) {
var enumss = workNodeData.Sys_Enum;
enums = $.grep(enumss, function (value) {
return value.EnumKey == mapAttr.UIBindKey;
});
}
var enableAttr = "";
if (mapAttr.UIIsEnable == 1)
enableAttr = "";
else
enableAttr = "disabled='disabled'";
$.each(enums, function (i, obj) {
if (RBShowModel == 3)
eleHtml += "<input " + enableAttr + " " + (obj.No == defValue ? "checked='checked' " : "") + " type='radio' name='RB_" + mapAttr.KeyOfEn + "' id='RB_" + mapAttr.KeyOfEn + "_" + obj.No + "' value='" + obj.No + "' /><label>&nbsp;" + obj.Name + "</label>";
else
eleHtml += "<input " + enableAttr + " " + (obj.No == defValue ? "checked='checked' " : "") + " type='radio' name='RB_" + mapAttr.KeyOfEn + "' id='RB_" + mapAttr.KeyOfEn + "_" + obj.No + "' value='" + obj.No + "'/><label>&nbsp;" + obj.Name + "</label><br/>";
});
}
}
// AppDouble AppFloat
if (mapAttr.MyDataType == 5 || mapAttr.MyDataType == 3) {
var enableAttr = '';
if (mapAttr.UIIsEnable == 1) {
} else {
enableAttr = "disabled='disabled'";
}
//获取DefVal,根据默认的小数点位数来限制能输入的最多小数位数
var defVal = mapAttr.DefVal;
var bit;
if (defVal != null && defVal !== "" && defVal.indexOf(".") >= 0)
bit = defVal.substring(defVal.indexOf(".") + 1).length;
eleHtml += "<input class='form-control' style='text-align:right;' maxlength=" + mapAttr.MaxLen / 2 + " type='text'" + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "'/>";
}
if ((mapAttr.MyDataType == 2 && mapAttr.LGType != 1)) {//AppInt
var enableAttr = '';
if (mapAttr.UIIsEnable == 1) {
} else {
enableAttr = "disabled='disabled'";
}
eleHtml += "<input style='text-align:right;' maxlength=" + mapAttr.MaxLen / 2 + " type='text'" + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "'/>";
}
//AppMoney AppRate
if (mapAttr.MyDataType == 8) {
var enableAttr = '';
if (mapAttr.UIIsEnable == 1) {
} else {
enableAttr = "disabled='disabled'";
}
//获取DefVal,根据默认的小数点位数来限制能输入的最多小数位数
var defVal = mapAttr.DefVal;
var bit;
if (defVal != null && defVal !== "" && defVal.indexOf(".") >= 0)
bit = defVal.substring(defVal.indexOf(".") + 1).length;
eleHtml += "<input value='" + defValue + "' style='text-align:right;' class='form-control' maxlength=" + mapAttr.MaxLen / 2 + " type='text' name='TB_" + mapAttr.KeyOfEn + "' value='0.00' placeholder='" + (mapAttr.Tip || '') + "'/>";
}
}
}
if (!islabelIsInEle) {
eleHtml +=
mapAttr.UIIsInput == 1 ? '<span style="color:red" class="mustInput" data-keyofen="' + mapAttr.KeyOfEn + '"></span>' : "";
}
} else {
var value = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn, mapAttr.MyDataType);
if (value == undefined) {
value = '';
} else {
}
eleHtml += "<input type='hidden' id='TB_" + mapAttr.KeyOfEn + "' name='TB_" + mapAttr.KeyOfEn + "'></input>";
}
eleHtml = $(eleHtml);
if ((mapAttr.MyDataType == "1" && mapAttr.UIContralType == "2"
|| (mapAttr.MyDataType == "2" && mapAttr.UIContralType == "3")) && mapAttr.LGType == 1) {
defValue = "," + defValue + ",";
$.each(eleHtml, function () {
if ($(this).nodeName == "INPUT") {
if (defValue.indexOf("," + $(this).val() + ",") != -1)
$(this).attr("checked", true);
else
$(this).attr("checked", false);
}
});
} else {
if (mapAttr.MyDataType != "4" && mapAttr.UIContralType != "2") {
if (mapAttr.MyDataType != 6 && mapAttr.MyDataType != 7)
eleHtml.css('width', mapAttr.UIWidth);
}
else
eleHtml.css('width', "auto");
eleHtml.val(defValue);
}
if (mapAttr.UIIsEnable == "0") {
if (eleHtml.find('[name^=CB_]').length == 1) { //CHECKBOX 处理
eleHtml.find('[name^=CB_]').attr('disabled', true);
} else {
eleHtml.attr('disabled', true);
}
}
return eleHtml;
}
</script>
<style type="text/css">
</style>
</head>
<body>
<form>
<input type="hidden" id="formExt" />
<div id="Msg" style="text-align: center;display:none;"><img src="../Scripts/bootstrap/fonts/loading.gif" /></div>
<div id="ContentDtlDiv" style="border: solid 1px #D0D0D0;">
<div id="" class="portlet portlet-sortable light bg-inverse" style="padding: 0px; margin: 0px;">
<div class="portlet-body " id="">
<div class="tab-content">
<div class="tab-pane active portlet_tab flowLists" style="overflow-x: auto; overflow-y: hidden;" id="mainDtlDiv">
<div>
<h5>主版本数据</h5>
<table class="table wupop" data-data="true" id="dtlTable" border="0" cellspacing="0" cellpadding="0">
<thead></thead>
<tbody></tbody>
</table>
</div>
<div class="loadDate" style="text-align: center;">
<img src="../Scripts/bootstrap/fonts/loading.gif" />加载中...
</div>
</div>
<div class="tab-pane active portlet_tab flowLists" style="overflow-x: auto; overflow-y: hidden;" id="compareDtlDiv">
<div>
<h5>比对版本版本数据</h5>
<table class="table wupop" data-data="true" id="dtlTable" border="0" cellspacing="0" cellpadding="0">
<thead></thead>
<tbody></tbody>
</table>
</div>
<div class="loadDate" style="text-align: center;">
<img src="../Scripts/bootstrap/fonts/loading.gif" />加载中...
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<script type="text/javascript">
function bindStatistics(dtlDiv) {
$.each(getUseHeadTh(dtlDiv), function (i, th) {
var matchesColumn = $.grep(window.columnExp, function (val) { // 根据表头的colname与待统计列的KeyOfEn对比
return val.KeyOfEn == $(th).data().colname;
});
if (matchesColumn.length == 1) { // 如果是统计列
var o = $(th);
var template = figure_MapAttr_Template(o.data()); // 根据该列表头的数据(data)获取到与当前列类型一致的表单元素
var name = template.attr("name");
var statisticsElement = $("#" + name + "_Statistics");
$(":input[name=" + name + "]").each(function (i, e) { // 根据遍历该列所有元素
$(e).unbind("change");
$(e).bind("change", function (o) { // 为该列所有元素增加onchange事件
doStatistics(matchesColumn[0].exp, name, statisticsElement);
});
if (i == 0) {
$(e).trigger("change"); // 页面初始化后进行合计计算(仅触发合计列第一个元素即可)
}
});
}
});
}
var statisticsFlag = false;
// 生成统计行
function addStatisticsRow(dtlDiv) {
statisticsFlag = true;
// 统计行
var statisticsRow = $("<tr></tr>");
statisticsRow.data().customRowType = "statistics";
// 遍历表头
$.each(getUseHeadTh(dtlDiv), function (i, th) {
var coltype = $(th).data().coltype;
if (typeof coltype != "undefined" && coltype == "SN") { // 统计行行号列
//statisticsRow.append("<td>" + ($("#dtlDiv div table tbody tr").length + 1) + "</td>");
statisticsRow.append("<td>&nbsp;</td>");
} else { // 其它列
var matchesColumn = $.grep(window.columnExp, function (val) { // 根据表头的colname与待统计列的KeyOfEn对比
return val.KeyOfEn == $(th).data().colname;
});
if (matchesColumn.length == 1) { // 如果是统计列
var o = $(th);
var template = figure_MapAttr_Template(o.data()); // 根据该列表头的数据(data)获取到与当前列类型一致的表单元素
var name = template.attr("name");
template.attr("id", name + "_Statistics");
template.attr("name", name + "_Statistics");
template.attr('disabled', true);
var td = $("<td></td>");
td.append(template);
statisticsRow.append(td);
} else { // 非统计列直接赋空<td></td>
statisticsRow.append("<td></td>");
}
}
});
// 新增统计行
$("#" + dtlDiv +" div table tbody").append(statisticsRow);
}
function parentStatistics(extArr, dtlDiv) {
if ($.isArray(extArr)) {
$.each(extArr, function (i, extObj) {
var columnsName = getColumnElementsName(extObj.DtlColumn,dtlDiv);
if ($(":input[name=" + columnsName + "]").length == 0)
doStatistics(extObj.exp, columnsName, $("#TB_" + extObj.AttrOfOper, parent.document), $("#TB_" + extObj.DaXieAttrOfOper, parent.document));
$(":input[name=" + columnsName + "]").each(function (i, e) {
$(e).bind("change", function (o) {
doStatistics(extObj.exp, columnsName, $("#TB_" + extObj.AttrOfOper, parent.document), $("#TB_" + extObj.DaXieAttrOfOper, parent.document));
//是否使用合计计算其他值
if (extObj.Tag == "1")
DBAccess.RunFunctionReturnStr(extObj.Tag1);
});
if (i == 0) {
$(e).trigger("change");
}
});
});
}
}
/**
* @param exp 表达式
* @param name 待统计列元素name
* @param template 统计单元格jquery对象
*/
function doStatistics(exp, name, template, DXTemplate) {
var expVal = 0;
if (exp == "Sum") { // 和
var sum = 0;
//判断值是否含有小数
var flag = false;
$(":input[name=" + name + "]").each(function (i, e) {
var val = $(e).val();
val = val.replace(/,/g, "");
val = val.replace(/¥/g, "");
sum += parseFloat(val);
if ($(e).val().indexOf('.') >= 0)
flag = true;
});
if (flag) {
if (!/\./.test(sum))
sum += '.00';
//防止出现相加小数位数不正确的情况
parseFloat(sum).toFixed(2);
}
expVal = sum;
//sum = formatNumber(sum, 2, ',');
template.val(sum);
} else if (exp == "Avg") { // 平均数
var sum = 0;
var count = 0;
$(":input[name=" + name + "]").each(function (i, e) {
var val = $(e).val();
val = val.replace(/,/g, "");
val = val.replace(/¥/g, "");
sum += parseFloat(val);
count++;
});
if (count > 0) {
expVal = sum / count;
var avg = formatNumber(sum / count, 2, ',');
template.val(avg);
}
} else if (exp == "Max") { // 最大
var max = null;
$(":input[name=" + name + "]").each(function (i, e) {
var val = $(e).val();
val = val.replace(/,/g, "");
val = val.replace(/¥/g, "");
var value = parseFloat(val);
if (max == null) {
max = value;
} else if (value > max) {
max = value;
}
});
expVal = max;
max = formatNumber(max, 0, ',');
template.val(max);
} else if (exp == "Min") { // 最小
var min = null;
$(":input[name=" + name + "]").each(function (i, e) {
var val = $(e).val();
val = val.replace(/,/g, "");
val = val.replace(/¥/g, "");
var value = parseFloat(val);
if (min == null) {
min = value;
} else if (value < min) {
min = value;
}
});
expVal = min;
min = formatNumber(min, 0, ',');
template.val(min);
}
if (DXTemplate.length == 1)
DXTemplate.val(Rmb2DaXie(expVal));
}
function getColumnElementsName(KeyOfEn, dtlDiv) {
var name = undefined;
if (KeyOfEn) {
$.each(getUseHeadTh(dtlDiv), function (i, th) {
var data = $(th).data();
if (data.colname === KeyOfEn) {
var template = figure_MapAttr_Template(data);
name = template.attr("name");
return false;
}
});
}
return name;
}
//获取多表头字段
function getMutliField(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 getUseHeadTh(dtlDiv) {
var headTrs = $('#' + dtlDiv +' div table thead tr');
var threadTh = $('#' + dtlDiv +' div table thead tr th');
//如果是多表头需要整合整个th信息
if (isMulti == true) {
threadTh = [];
var firstHeadTh = $(headTrs[0]).find("th");
var secondHeadTh = $(headTrs[1]).find("th");
for (var i = 0; i < firstHeadTh.length; i++) {
var dataInfo = $(firstHeadTh[i]).attr("data-info");
if (dataInfo != null && dataInfo != undefined && dataInfo.indexOf("Multi,") != -1) {
$.each(secondHeadTh, function (idx, item) {
if (dataInfo.indexOf($(item).attr("data-info") + ",") != -1)
threadTh.push(item);
});
} else {
threadTh.push(firstHeadTh[i]);
}
}
}
return threadTh;
}
//初始化下拉列表框的OPERATION
function InitDDLOperation(workNodeData, mapAttr, defVal) {
return operations = '';
}
//填充默认数据
function ConvertDefVal(workNodeData, defVal, keyOfEn, myDataType) {
var result = defVal;
return result = unescape(result);
}
var workNodeData = {};
//全屏显示
function WindowOpenDtl() {
var url = window.location.href;
//获取屏幕的长宽
var W = window.parent.document.body.clientWidth-40;
var H = window.parent.document.body.clientHeight-40;
window.parent.OpenLayuiDialog(url + "&IsShowFull=1", '编辑', W, 80, 'auto', true);
return;
var self = window.open(url);
var loop = setInterval(function () {
if (self.closed) {
clearInterval(loop);
SetHref(url);
}
}, 1);
}
function OpenLink(index) {
//获取当前行的数据
var en = $(index).parent().parent().data().data;
var linkUrl = sys_MapDtl.LinkUrl;
if (linkUrl.indexOf("?") == -1)
linkUrl = linkUrl + "?1=2";
linkUrl = DealJsonExp(en, linkUrl);
linkUrl = linkUrl.replace("@WorkID", GetQueryString("RefPKVal"));
linkUrl = linkUrl.replace("@FK_Node", GetQueryString("FK_Node"));
linkUrl = linkUrl.replace("@FK_Flow", GetQueryString("FK_Flow"));
if (linkUrl.indexOf('&OID=') == -1)
linkUrl += '&OID=' + en.OID;
if (linkUrl.indexOf('&WorkID=') == -1 && GetQueryString("WorkID") != null)
linkUrl += '&WorkID=' + GetQueryString("WorkID");
if (linkUrl.indexOf('&FK_Node=') == -1 && GetQueryString("FK_Node") != null)
linkUrl += '&FK_Node=' + GetQueryString("FK_Node");
if (linkUrl.indexOf('&FK_Flow=') == -1 && GetQueryString("FK_Flow") != null)
linkUrl += '&FK_Flow=' + GetQueryString("FK_Flow");
if (linkUrl.indexOf('&EnsName=') == -1 && GetQueryString("EnsName") != null)
linkUrl += '&EnsName=' + GetQueryString("EnsName");
if (linkUrl.indexOf('&RefPKVal=') == -1 && GetQueryString("RefPKVal") != null)
linkUrl += '&RefPKVal=' + GetQueryString("RefPKVal");
if (linkUrl.indexOf('&FK_MapData=') == -1 && GetQueryString("FK_MapData") != null)
linkUrl += '&FK_MapData=' + GetQueryString("FK_MapData");
if (sys_MapDtl.LinkTarget == "_self") {
SetHref( linkUrl;
return;
}
if (sys_MapDtl.LinkTarget == "_blank") {
window.open(linkUrl);
return;
}
parent.OpenEasyUiDialogExt(linkUrl, sys_MapDtl.LinkLabel, 800, 500, false);
}
//打开附件.
function OpenDtlAth(index) {
var dtlOID = $(index).parent().parent().data().data.OID;
var workID = $(index).parent().parent().data().data.RefPK;
var IsCloseDialog = false;
var dtlName = GetQueryString("EnsName");
var fk_node = GetQueryString("FK_Node");
var fk_flow = GetQueryString("FK_Flow");
var FFK_MapData = GetQueryString("FK_MapData");
var IsReadonly = GetQueryString("IsReadonly");
var parentUrl = parent.location.href;
var url = "CCForm/Ath.js?IsBTitle=1&PKVal=" + dtlOID + "&Ath=AthMDtl&FK_MapData=" + GetQueryString("EnsName") + "&FK_FrmAttachment=" + dtlName + "_AthMDtl&WorkID=" + workID + "&FK_Node=" + fk_node + "&FK_Flow=" + fk_flow + "&FFK_MapData=" + FFK_MapData + "&IsReadonly=" + IsReadonly;
var AthNum = 0;
var content = parent.document.getElementById("Dtl_" + dtlName).contentWindow;
if (parentUrl.indexOf("CCForm") != -1) {
url = "Ath.htm?IsBTitle=1&PKVal=" + dtlOID + "&Ath=AthMDtl&FK_MapData=" + GetQueryString("EnsName") + "&FK_FrmAttachment=" + dtlName + "_AthMDtl&WorkID=" + workID + "&FK_Node=" + fk_node + "&FK_Flow=" + fk_flow + "&FFK_MapData=" + FFK_MapData + "&IsReadonly=" + IsReadonly;
WinOpen(url);
} else {
if (typeof parent.OpenBootStrapModalByContent!="undefined")
parent.OpenBootStrapModalByContent(url, "AthTable_Init('" + dtlName + "_AthMDtl','Div_" + dtlName + "_AthMDtl'," + dtlOID + ")", 'Div_' + dtlName + '_AthMDtl', "从表多附件", 800, 500, "icon-property", null, null, null, function () {
//关闭窗口事件
AthNum = $("#athModel_" + dtlName + "_AthMDtl").find("a").length;
var rowCurrentIndex = parseInt($($(index).parent().parent().children()[0]).text()) - 1;
content.$("#Ath_" + rowCurrentIndex).html(AthNum);
content.$("#TB_AthNum_" + rowCurrentIndex).val(AthNum);
});
if (typeof parent.OpenOtherLayuiDialog != "undefined") {
var W = parent.window.innerWidth / 2;
parent.OpenOtherLayuiDialog("AthTable_Init('" + dtlName + "_AthMDtl','Div_" + dtlName + "_AthMDtl'," + dtlOID + ")", "从表多附件", W, 70, 'Div_' + dtlName + '_AthMDtl', false, false, false, null, function () {
//关闭窗口事件
AthNum = $("#athModel_" + dtlName + "_AthMDtl").find("a").length;
var rowCurrentIndex = parseInt($($(index).parent().parent().children()[0]).text()) - 1;
$("#Ath_" + rowCurrentIndex).html(AthNum);
$("#TB_AthNum_" + rowCurrentIndex).val(AthNum);
}, null, "black", true);
}
}
}
function setIframeHeight() {
var h = $("body").height();
if ($("body").height() < 260) {
h = 260;
}
if (window.frameElement != null)
$("#" + window.frameElement.getAttribute("id"), parent.document).height(h + 40);
}
</script>
</body>
</html>