";
if (this.control.UIIsEnable == "0" || Form_ReadOnly == false)
html_string += "
";
},
CreateTBInt: function (Ctrl_Val) {
var Ctrl_Id = "TB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
this.Ctrl_Class = " class='mui-numbox-input'";
var disabledStr = "";
if (this.control.UIIsEnable == "0" || Form_ReadOnly == true)
disabledStr = " disabled=disabled";
var event = 'onblur="valitationAfter(this, \'int\')" onkeydown="valitationBefore(this, \'int\')" onkeyup="valitationAfter(this, \'int\'); if(isNaN(value) || (value%1 !== 0))execCommand(\'undo\')" onafterpaste="valitationAfter(this, \'int\'); if(isNaN(value) || (value%1 !== 0))execCommand(\'undo\')"';
var minNum = GetPara(this.control.AtPara, "NumMin")||"";
var maxNum = GetPara(this.control.AtPara, "NumMax") || "";
var dataInfo = "";
if (minNum!="")
dataInfo = " data-numbox-min='" + minNum + "'";
if (maxNum != "")
dataInfo += " data-numbox-max='" + maxNum + "'";
var inputHtml = "";
if (Form_ReadOnly == false && this.control.UIIsEnable == 1) {
var step = GetPara(this.control.AtPara, "NumStepLength");
step = step == null || step == undefined ? 1 : parseInt(step) == 0 ? 1 : parseInt(step);
inputHtml += "
";
}
return inputHtml;
},
CreateTBFloat: function (Ctrl_Val) {
var dataInfo = "";
var minNum = GetPara(this.control.AtPara, "NumMin") || "";
var maxNum = GetPara(this.control.AtPara, "NumMax") || "";
var dataInfo = "";
if (minNum != "")
dataInfo = " data-numbox-min='" + minNum + "'";
if (maxNum != "")
dataInfo += " data-numbox-max='" + maxNum + "'";
var bit;
var defVal = this.control.DefValType;
if (defVal != null && defVal !== "" && defVal.toString().indexOf(".") >= 0)
bit = attrdefVal.substring(defVal.indexOf(".") + 1).length;
else
bit = 2;
var Ctrl_Id = "TB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var inputHtml = "";
if (Form_ReadOnly == false && this.control.UIIsEnable == 1) {
var step = GetPara(this.control.AtPara, "NumStepLength");
step = step == null || step == undefined ? 0.1 : parseFloat(step);
inputHtml += "
";
}
return inputHtml;
},
CreateTBDate: function (Ctrl_Val) {
var Ctrl_Id = "TB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var LAB_Id = "LAB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var Ctrl_Text = Ctrl_Val;
if (this.Enable == false) {
return "
";
}
var inputHtml = "";
if (Ctrl_Val == "") {
Ctrl_Text = "
";
return inputHtml;
},
CreateTBDateTime: function (Ctrl_Val) {
var isSupperText = this.control.IsSupperText;
var optionType = "datetime";
if (isSupperText == 0) {
optionType = "date";//yyyy-MM-dd
} else if (isSupperText == 1 || isSupperText == 5) {
optionType = "date-time";//yyyy-MM-dd HH:mm
} else if (isSupperText == 2) {
optionType = "datetime";//yyyy-MM-dd HH:mm:ss
} else if (isSupperText == 3) {
optionType = "month";//yyyy-MM
} else if (isSupperText == 4) {
optionType = "time-min";//HH:mm
} else if (isSupperText == 5) {
optionType = "time";//HH:mm:ss
} else if (isSupperText == 6) {
optionType = "month-day";//MM-dd
} else if (isSupperText == 7) {
options.type = "year";//MM-dd
}
var Ctrl_Id = "TB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var LAB_Id = "LAB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
//var Ctrl_Val = this.DataRow[this.control.KeyOfEn];
var Ctrl_Text = Ctrl_Val;
if (this.Enable == false) {
return "
";
}
var inputHtml = "";
if (Ctrl_Val == "") {
Ctrl_Text = "
";
return inputHtml;
},
CreateTBTime: function (Ctrl_Val) {
var Ctrl_Id = "TB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var LAB_Id = "LAB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
//var Ctrl_Val = this.DataRow[this.control.KeyOfEn];
var Ctrl_Text = Ctrl_Val;
if (this.Enable == false) {
return "
";
}
var inputHtml = "";
if (Ctrl_Val == "") {
Ctrl_Text = "
";
return inputHtml;
},
CreateCBBoolean: function (Ctrl_Val) {
var checkBoxVal = "";
var keyOfEn = this.control.KeyOfEn;
var Ctrl_Id = "CB_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var CB_Html = "";
CB_Html += "
";
var classVal = "";
if (Ctrl_Val == 1)
classVal = " mui-active";
if (this.Enable == false )
CB_Html += "
";
else
CB_Html += "
";
CB_Html += "
";
CB_Html += "
";
return CB_Html;
},
CreateDDLEnum: function (Ctrl_Val) {
//下拉框和单选都使用下拉框实现
var Ctrl_Id = "RB_" + this.control.KeyOfEn + "_" + this.DataRow.OID
if (this.control.UIContralType == UIContralType.DDL) {
Ctrl_Id = "DDL_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
}
//获取枚举数据
var enums = new Entities("BP.Sys.SysEnums");
enums.Retrieve("EnumKey", this.control.UIBindKey);
var html_Select = "";
html_Select += "
";
return html_Select;
},
CreateDDLPK: function (Ctrl_Val) {
var args = new RequestArgs();
// var Ctrl_Val = this.DataRow[this.control.KeyOfEn];
var Ctrl_Id = "DDL_" + this.control.KeyOfEn + "_" + this.DataRow.OID;
var dtl_OID = this.DataRow.OID;
var isEnable = this.Enable == true ? 1 : 0;
var WorkID = args.WorkID;
var html_Select = "";
html_Select += "
";
return html_Select;
}
}
//必填项检查 名称最后是*号的必填 如果是选择框,值为'' 或者 显示值为 【*请选择】都算为未填 返回FALSE 检查必填项失败
function checkDtlBlanks() {
var checkBlankResult = true;
//获取所有的列名 找到带* 的LABEL mustInput
var lbs = $('.mustInputDtl');
$.each(lbs, function (i, obj) {
//if ($(obj).parent().css('display') != 'none') {
var ele = $(obj).parent().parent().siblings("input");
if (ele.length == 1) {
switch (ele[0].tagName.toUpperCase()) {
case "INPUT":
if (ele.attr('type') == "text") {
if (ele.val() == "") {
checkBlankResult = false;
ele.addClass('errorInput');
} else {
ele.removeClass('errorInput');
}
}
break;
case "SELECT":
if (ele.val() == "" || ele.children('option:checked').text() == "*请选择") {
checkBlankResult = false;
ele.addClass('errorInput');
} else {
ele.removeClass('errorInput');
}
break;
case "TEXTAREA":
if (ele.val() == "") {
checkBlankResult = false;
ele.addClass('errorInput');
} else {
ele.removeClass('errorInput');
}
break;
case "A":
break;
}
}
//}
});
return checkBlankResult;
}
//处理 MapExt 的扩展. 工作处理器,独立表单都要调用他.
function AfterBindDtl_DealMapExt(oid) {
var mapExts = dtlMapExt;
var mapAttrs = dtlmapAttrs;
// 主表扩展(统计从表)
var detailExt = {};
wxh: for (var i = 0; i < mapExts.length; i++) {
var mapExt1 = mapExts[i];
//一起转成entity.
var mapExt = new Entity("BP.Sys.MapExt", mapExt1);
mapExt.MyPK = mapExt1.MyPK;
if (mapExt.ExtType == "FullDataDtl")
continue;
var mapAttr1 = null;
for (var j = 0; j < mapAttrs.length; j++) {
if (mapAttrs[j].FK_MapData == mapExt.FK_MapData && mapAttrs[j].KeyOfEn == mapExt.AttrOfOper) {
if (mapAttrs[j].UIIsEnable == 0 && (mapExt.ExtType == 'PopBranchesAndLeaf' || mapExt.ExtType == 'PopBranches' || mapExt.ExtType == 'PopTableSearch' || mapExt.ExtType == 'PopGroupList'))
continue wxh;//如果控件只读,并且是pop弹出形式,就continue到外循环
mapAttr1 = mapAttrs[j];
break;
}
}
if (mapAttr1 == null) {
continue;
}
if (isLoadJs.isLoadPop == false) {
isLoadJs.isLoadPop = true;
Skip.addJs(urlPrefix + "JS/Pop.js?t=" + Math.random());
}
if (isLoadJs.isLoadMapExt == false) {
isLoadJs.isLoadMapExt = true;
Skip.addJs(urlPrefix + "MapExt2016.js?t=" + Math.random());
}
if (isLoadJs.isLoadmtags == false) {
isLoadJs.isLoadmtags = true;
$('head').append('
');
Skip.addJs(urlPrefix + "JS/mselector.js?t=" + Math.random());
Skip.addJs(urlPrefix + "JS/mtags.js?t=" + Math.random());
}
var mapAttr = new Entity("BP.Sys.MapAttr", mapAttr1);
mapAttr.MyPK = mapAttr1.MyPK;
//处理Pop弹出框
var PopModel = mapAttr.GetPara("PopModel");
if (PopModel != "" && mapAttr.GetPara("PopModel") == "None" && mapExt.ExtType.indexOf("Pop") >= 0)
continue;
if (PopModel != undefined && PopModel != "" && mapExt.ExtType == mapAttr.GetPara("PopModel")) {
PopMapDtlExt(mapAttr, mapExt, oid);
continue;
}
//处理文本自动填充
var TBModel = mapAttr.GetPara("TBFullCtrl");
if (TBModel != undefined && TBModel != "" && TBModel != "None" && (mapExt.ExtType == "FullData")) {
var tbAuto = $("#TB_" + mapExt.AttrOfOper + "_" + oid);
if (tbAuto.length == 0)
continue;
if (isLoadJs.isLoadTBFullCtrl == false) {
isLoadJs.isLoadTBFullCtrl = true;
loadScript(urlPrefix + "TBFullCtrl.js?t=" + Math.random());
}
TBFullCtrl(mapExt, mapAttr, "TB_" + mapExt.AttrOfOper + "_" + oid, 1);
continue
}
//下拉框填充其他控件
var DDLFull = mapAttr.GetPara("IsFullData");
if (DDLFull != undefined && DDLFull != "" && DDLFull == "1" && (mapExt.MyPK.indexOf("DDLFullCtrl") != -1)) {
/* //枚举类型
if (mapAttr.MyDataType == 2 && mapAttr.LGType == 1) {
var ddlOper = $('input:radio[name="RB_' + mapExt.AttrOfOper + "_" + oid + '"]');
if (ddlOper.length == 0)
continue;
ddlOper.attr("onchange", "DDLFullCtrl(this.value,\'" + "DDL_" + mapExt.AttrOfOper + "_" + oid + "\', \'" + mapExt.MyPK + "\')");
//初始化填充数据
var val = $('input:radio[name="RB_' + mapExt.AttrOfOper + "_" + oid + '"]:checked').val();
DDLFullCtrl(val, "DDL_" + mapExt.AttrOfOper + "_" + oid, mapExt.MyPK);
continue;
}*/
//外键类型
var ddlOper = $("#DDL_" + mapExt.AttrOfOper + "_" + oid);
if (ddlOper.length == 0)
continue;
ddlOper.attr("onchange", "DDLFullCtrl(this.value,\'" + "DDL_" + mapExt.AttrOfOper + "_" + oid + "\', \'" + mapExt.MyPK + "\',1)");
//初始化填充数据
var val = ddlOper.val();
if (val != "" && val != undefined)
DDLFullCtrl(val, "DDL_" + mapExt.AttrOfOper + "_" + oid, mapExt.MyPK, 1);
continue;
}
switch (mapExt.ExtType) {
case "MultipleChoiceSmall":
MultipleChoiceSmall(mapExt, mapAttr, oid); //调用 /CCForm/JS/MultipleChoiceSmall.js 的方法来完成.
break;
case "MultipleChoiceSearch":
MultipleChoiceSearch(mapExt, oid); //调用 /CCForm/JS/MultipleChoiceSmall.js 的方法来完成.
break;
case "BindFunction": //控件绑定函数.
if ($('#TB_' + mapExt.AttrOfOper + '_' + oid).length == 1) {
$('#TB_' + mapExt.AttrOfOper + '_' + oid).bind(DynamicBind(mapExt, "TB_", oid));
break;
}
if ($('#DDL_' + mapExt.AttrOfOper + '_' + oid).length == 1) {
$('#DDL_' + mapExt.AttrOfOper + '_' + oid).bind(DynamicBind(mapExt, "DDL_"));
break;
}
if ($('#CB_' + mapExt.AttrOfOper + '_' + oid).length == 1) {
$('#CB_' + mapExt.AttrOfOper + '_' + oid).bind(DynamicBind(mapExt, "CB_"));
break;
}
if ($('#RB_' + mapExt.AttrOfOper + '_' + oid).length == 1) {
$('#RB_' + mapExt.AttrOfOper + '_' + oid).bind(DynamicBind(mapExt, "RB_"));
break;
}
break;
case "RegularExpression": //正则表达式 统一在保存和提交时检查
var tb = $('#TB_' + mapExt.AttrOfOper + '_' + oid);
if (tb.attr('class') != undefined && tb.attr('class').indexOf('CheckRegInput') > 0) {
break;
} else {
tb.addClass("CheckRegInput");
tb.data(mapExt)
tb.attr(mapExt.Tag, "CheckRegInput('" + tb.attr('name') + "','','" + mapExt.Tag1 + "')");
}
break;
case "InputCheck": //输入检查
break;
case "ActiveDDL": /*自动初始化ddl的下拉框数据. 下拉框的级联操作 已经 OK*/
var ddlPerant = $("#DDL_" + mapExt.AttrOfOper + "_" + oid);
var ddlChild = $("#DDL_" + mapExt.AttrsOfActive + "_" + oid);
if (ddlPerant == null || ddlChild == null)
continue;
ddlPerant.attr("onchange", "DDLAnsc(this.value,\'" + "DDL_" + mapExt.AttrsOfActive + "_" + oid + "\', \'" + mapExt.MyPK + "\',\'" + ddlPerant.val() + "\')");
var valClient = ConvertDefVal(frmData, '', mapExt.AttrsOfActive); // ddlChild.SelectedItemStringVal;
//初始化页面时方法加载
DDLAnsc(ddlPerant.val(), "DDL_" + mapExt.AttrsOfActive + "_" + oid, mapExt.MyPK);
break;
case "AutoFullDLL": // 自动填充下拉框.
continue; //已经处理了。
case "AutoFull": //自动填充 //a+b=c DOC='@DanJia*@ShuLiang' 等待后续优化
//循环 KEYOFEN
//替换@变量
//处理 +-*%
if (mapExt.Doc == undefined || mapExt.Doc == '')
continue;
calculator(mapExt, oid);
break;
case "AutoFullDtlField": //主表扩展(统计从表)
var docs = mapExt.Doc.split("\.");
if (docs.length == 3) {
var ext = {
"DtlNo": docs[0],
"FK_MapData": mapExt.FK_MapData,
"AttrOfOper": mapExt.AttrOfOper,
"Doc": mapExt.Doc,
"DtlColumn": docs[1],
"exp": docs[2],
"Tag": mapExt.Tag,
"Tag1": mapExt.Tag1
};
if (!$.isArray(detailExt[ext.DtlNo])) {
detailExt[ext.DtlNo] = [];
}
detailExt[ext.DtlNo].push(ext);
var iframeDtl = $("#F" + ext.DtlNo);
iframeDtl.load(function () {
$(this).contents().find(":input[id=formExt]").val(JSON.stringify(detailExt[ext.DtlNo]));
if (this.contentWindow && typeof this.contentWindow.parentStatistics === "function") {
this.contentWindow.parentStatistics(detailExt[ext.DtlNo]);
}
});
$(":input[name=TB_" + ext.AttrOfOper + "]").attr("disabled", true);
}
break;
}
}
}
/**Pop弹出框的处理**/
function PopMapDtlExt(mapAttr, mapExt, oid) {
switch (mapAttr.GetPara("PopModel")) {
case "PopBranchesAndLeaf": //树干叶子模式.
if (isLoadJs.isLoadBranchesAndLeaf == false) {
isLoadJs.isLoadBranchesAndLeaf = true;
loadScript(urlPrefix + "BranchesAndLeaf.js?t=" + Math.random());
}
Dtl_PopBranchesAndLeaf(mapExt, mapAttr, oid, 1); //调用 /CCForm/JS/Pop.js 的方法来完成.
break;
case "PopBranches": //树干简单模式.
if (isLoadJs.isLoadBranches == false) {
isLoadJs.isLoadBranches = false;
loadScript(urlPrefix + "Branches.js?t=" + Math.random());
}
Dtl_PopBranches(mapExt, mapAttr, oid, 1); //调用 /CCForm/JS/Pop.js 的方法来完成.
break;
case "PopGroupList": //分组模式.
PopGroupList(mapExt, mapAttr, oid, 1); //调用 /CCForm/JS/Pop.js 的方法来完成.
break;
case "PopSelfUrl": //自定义url.
SelfUrl(mapExt, mapAttr, oid, 1); //调用 /CCForm/JS/MultipleChoiceSmall.js 的方法来完成.
break;
case "PopTableSearch": //表格查询.
Dtl_PopTableSearch(mapExt, mapAttr, oid, 1); //调用 /CCForm/JS/Pop.js 的方法来完成.
break;
default:
break;
}
}
/****************************************** 树干枝叶模式 **********************************/
function Dtl_PopBranchesAndLeaf(mapExt, mapAttr, OID) {
if (mapAttr.UIVisible == 0) {
return;
}
var attrOfOper = mapExt.AttrOfOper + "_" + OID;
var ctrlID = "TB_" + mapExt.AttrOfOper + "_" + OID;
var target = $("#" + ctrlID);
target.hide();
var parentTarget = target.parent();
if (mapAttr.UIIsEnable != 0 && mapAttr.UIVisible != 0) {
//增加a标签
var aLink = $('
');
aLink.on('tap', function () {
viewApi.go("#branchesAndLeaf");
initBranchesLPage(mapExt, OID, attrOfOper, 1);
});
aLink.append($('
请选择
'));
parentTarget.append(aLink);
}
//增加显示选择结果行
var width = target.width();
var height = target.height();
var container = $("
");
parentTarget.after(container);
container.attr("id", attrOfOper + "_mtags");
$("#" + attrOfOper + "_mtags").mtags({
"fit": true,
"onUnselect": function (record) {
DeleteFrmEleDB(attrOfOper, OID, record.No);
var mtags = $("#" + ctrlID + "_mtags i");
var len = mtags.length;
var RemoveFunc = mapExt.GetPara("RemoveFunc");
if (RemoveFunc) {
if (RemoveFunc.indexOf("(") == -1) {
RemoveFunc = RemoveFunc + "('" + record.No + "','" + len + "')";
} else {
var para = record.No + "','" + len;
RemoveFunc = replaceAll(RemoveFunc, "Key", para);
RemoveFunc = replaceAll(RemoveFunc, "~", "'");
}
//调用移除函数
DBAccess.RunDBSrc(RemoveFunc, mapExt.DBType);
}
console.log("unselect: " + JSON.stringify(record));
}
});
//初始加载
Refresh_Mtags(mapExt.FK_MapData, attrOfOper, OID, mapAttr);
return;
}
/****************************************** 树干模式 **********************************/
function Dtl_PopBranches(mapExt, mapAttr, OID) {
if (mapAttr.UIVisible == 0) {
return;
}
var attrOfOper = mapExt.AttrOfOper + "_" + OID;
var ctrlID = "TB_" + mapExt.AttrOfOper + "_" + OID;
var target = $("#" + ctrlID);
target.hide();
var parentTarget = target.parent();
var oid = GetPKVal();
if (mapAttr.UIIsEnable != 0 && mapAttr.UIVisible != 0) {
//增加a标签
var aLink = $('
');
aLink.on('tap', function () {
viewApi.go("#branches");
initBranchesPage(mapExt, OID, attrOfOper, 1);
});
aLink.append($('
请选择
'));
parentTarget.append(aLink);
}
//增加显示选择结果行
var width = target.width();
var height = target.height();
var container = $("
");
parentTarget.after(container);
container.attr("id", attrOfOper + "_mtags");
$("#" + attrOfOper + "_mtags").mtags({
"fit": true,
"onUnselect": function (record) {
console.log("unselect: " + JSON.stringify(record));
DeleteFrmEleDB(attrOfOper, OID, record.No);
var mtags = $("#" + attrOfOper + "_mtags i");
var len = mtags.length;
var RemoveFunc = mapExt.GetPara("RemoveFunc");
if (RemoveFunc) {
if (RemoveFunc.indexOf("(") == -1) {
RemoveFunc = RemoveFunc + "('" + record.No + "','" + len + "')";
} else {
var para = record.No + "','" + len;
RemoveFunc = replaceAll(RemoveFunc, "Key", para);
RemoveFunc = replaceAll(RemoveFunc, "~", "'");
}
//调用移除函数
DBAccess.RunDBSrc(RemoveFunc, mapExt.DBType);
}
}
});
//初始加载
Refresh_Mtags(mapExt.FK_MapData, attrOfOper, OID, mapAttr);
}
/****************************************** 表格查询 **********************************/
function Dtl_PopTableSearch(mapExt, mapAttr, OID) {
if (mapAttr.UIVisible == 0) {
return;
}
var attrOfOper = mapExt.AttrOfOper + "_" + OID;
var ctrlID = "TB_" + mapExt.AttrOfOper + "_" + OID;
var target = $("#" + ctrlID);
target.hide();
var parentTarget = target.parent();
var oid = OID;
if (mapAttr.UIIsEnable != 0 && mapAttr.UIVisible != 0) {
//增加a标签
var aLink = $('
');
aLink.on('tap', function () {
viewApi.go("#tableSearch");
initTableSPage(mapExt, oid, attrOfOper, 1);
});
aLink.append($('
请选择
'));
parentTarget.append(aLink);
}
//增加显示选择结果行
var width = target.width();
var height = target.height();
var container = $("
");
parentTarget.after(container);
container.attr("id", attrOfOper + "_mtags");
$("#" + attrOfOper + "_mtags").mtags({
"fit": true,
"onUnselect": function (record) {
DeleteFrmEleDB(attrOfOper, oid, record.No);
}
});
//初始加载
Refresh_Mtags(mapExt.FK_MapData, attrOfOper, oid, mapAttr);
}
function GetNumberMinMax(mapAttr) {
var isEnableNumEnterLimit = GetPara(mapAttr.AtPara, "IsEnableNumEnterLimit");
isEnableNumEnterLimit = isEnableNumEnterLimit == null || isEnableNumEnterLimit == "" || isEnableNumEnterLimit == undefined || isEnableNumEnterLimit == "0" ? false : true;
if (isEnableNumEnterLimit == false)
return [];
var min = 0, max = 0;
if (isEnableNumEnterLimit == true) {
min = GetPara(mapAttr.AtPara, "MinNum");
if (min == undefined || min == "")
min = 0;
max = GetPara(mapAttr.AtPara, "MaxNum");
if (max == undefined || max == "")
max = 100000;
return [min, max];
}
}