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.

1617 lines
75 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>ccform正在加载请稍候...</title>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<!--<link href="../../Admin/CSS/FoolFrmBody.css" rel="stylesheet" />-->
<script type="text/javascript" src="../../Scripts/jquery-1.11.0.min.js"></script>
<link href="../fonts/font-icons.min.css" rel="Stylesheet" />
<link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
<!-- 位置必须放在 jquery 之后. -->
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../Gener.js" type="text/javascript"></script>
<script src="../JScript.js" type="text/javascript"></script>
<script src="../../Admin/CCFlowEnum.js" type="text/javascript"></script>
<script src="../../CCForm/FrmEnd.js" type="text/javascript"></script>
<link href="../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
<!--<link href="../../Scripts/layui/style/admin.css" rel="stylesheet" />-->
<script src="../../Scripts/layui/layui/layui.js" type="text/javascript"></script>
<script src="../../Scripts/layui/LayuiDialog.js" type="text/javascript"></script>
<script src="EnOnly.js" type="text/javascript"></script>
<script src="../../../DataUser/JSLibData/SearchAndEn.js"></script>
<style type="text/css">
.layui-form-label {
min-width: 80px;
width: auto;
text-align: right
}
.layui-form-label {
float: right !important;
}
.input-icon {
position: absolute;
left: calc(100% - 40px);
top: 1px;
width: 38px;
line-height: 36px;
text-align: center;
color: #d2d2d2;
}
.ccdate {
padding-right: 40px;
}
input[type=text], input[type=password], select {
border-radius: 5px;
border: thin solid #CCCCCC;
margin: 1px 1px;
height: 38px;
}
.layui-input-suffix {
width: 60px;
padding: 10px 15px 11px 15px;
line-height: 38px;
line-height: 20px;
border-width: 1px;
border-style: solid;
border-radius: 0 2px 2px 0px;
text-align: center;
background-color: none;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
box-sizing: border-box;
border-color: #eee;
display: inline;
border-left-color: none;
border-left: none;
}
.layui-input-prefix {
width: 60px;
padding: 10px 15px 11px 15px;
line-height: 38px;
line-height: 20px;
border-width: 1px;
border-style: solid;
border-radius: 0 2px 2px 0px;
text-align: center;
background-color: none;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
box-sizing: border-box;
border-color: #eee;
display: inline;
border-right-color: none;
border-right: none;
}
</style>
<!--杨玉慧 -->
<script type="text/javascript">
var frmData;
var mapData;
var mainData;
var dtM; //方法集合.
var dtl;//从表集合
var isReadonly = GetQueryString("isReadonly");
var pkVal = "";
var webUser = new WebUser();
var isSameEnName = true;//EnOnly页面和En的EnName是否相同
var cfg = null;
var drillFields = "";
$(function () {
pkVal = GetPKVal();
var enName = GetQueryString("EnName");
//新增时En.htm页面隐藏
if (window.parent) {
var url = window.parent.location.href;
var pEnName = getQueryStringByNameFromUrl(url, "EnName");
if (pEnName != enName)
isSameEnName = false;
}
cfg = new Entity("BP.Sys.EnCfg");
cfg.No = enName + "s";
cfg.RetrieveFromDBSources();
drillFields = cfg.Drill || "";
drillFields = drillFields.replace(/@/g, ",");
drillFields += ",";
if (isSameEnName == true && window.parent && window.parent.vm != undefined && pkVal == null) {
window.parent.vm.sideBarOpen = false;
$(".ocside", window.parent.document).remove();
}
var httpHandler = new HttpHandler("BP.WF.HttpHandler.WF_CommEntity");
httpHandler.AddUrlData();
if (pkVal != null) {
httpHandler.AddPara("PKVal", pkVal);
}
var data = httpHandler.DoMethodReturnString("EntityOnly_Init");
if (data.indexOf('err@') == 0) {
$("#CCFormTabs").html(data);
return;
}
//解析json.
frmData = JSON.parse(data);
mapData = frmData["Sys_MapData"][0];
mapData = new Entity("BP.Sys.MapData", mapData); //把他转化成entity.
mainData = frmData["MainTable"][0];
dtM = frmData["dtM"];
dtl = frmData["Dtl"] || [];
document.title = mapData.Name;
//获取没有解析的外部数据源
var uiBindKeys = frmData["UIBindKey"];
if (uiBindKeys != null && uiBindKeys.length != 0) {
//获取外部数据源 handler/JavaScript
var operdata;
for (var i = 0; i < uiBindKeys.length; i++) {
var sfTable = new Entity("BP.Sys.SFTable", uiBindKeys[i].No);
var srcType = sfTable.SrcType;
if (srcType != null && srcType != "") {
//Handler 获取外部数据源
if (srcType == 5) {
var selectStatement = sfTable.SelectStatement;
if (plant == 'CCFlow')
selectStatement = basePath + "/DataUser/SFTableHandler.ashx" + selectStatement;
else
selectStatement = basePath + "/DataUser/SFTableHandler/" + selectStatement;
operdata = DBAccess.RunDBSrc(selectStatement, 1);
}
//JavaScript获取外部数据源
if (srcType == 6) {
operdata = DBAccess.RunDBSrc(sfTable.FK_Val, 2);
}
frmData[uiBindKeys[i].No] = operdata;
}
}
}
InitToolbar(); //初始工具栏.
//生成傻瓜表单.
GenerFoolFrm(mapData, frmData);
//解析富文本
if ($(".rich").length > 0) {
var images_upload_url = "";
var handlerUrl = "";
if (plant == "CCFlow")
handlerUrl = basePath + "/WF/Comm/Handler.ashx";
else
handlerUrl = basePath + "/WF/Comm/Sys/ProcessRequest.do";
images_upload_url = handlerUrl + '?DoType=HttpHandler&DoMethod=RichUploadFile';
images_upload_url += '&HttpHandlerName=BP.WF.HttpHandler.WF_Comm_Sys&FrmID=' + GetQueryString("EnName") + "&PKVal=" + GetQueryString("PKVal");
layui.extend({
tinymce: '../../Scripts/layui/ext/tinymce/tinymce'
}).use('tinymce', function () {
var tinymce = layui.tinymce;
$(".rich").each(function (i, item) {
var id = item.id;
var h = item.style.height.replace("px", "");
if (h < 400) h = 400;
tinymce.render({
elem: "#" + id
, height: h
, images_upload_url: images_upload_url
, paste_data_images: true
//取消默认提示
, plugins: ['advlist', 'saveBtn', 'lists', 'image', 'charmap', 'searchreplace', 'visualblocks',
'table', 'wordcount',
],
});
})
});
}
if ($("ul.layui-tab-title li").length > 1) {
var li = $("<div style='float:right !important;z-index:999; top:0px' class='cs-btn-group'></div>");
li.append($("#Btns").children());
$("ul.layui-tab-title").append(li);
//$("#Btns").parent().remove();
$("#Btns").remove();
} else {
if (isHiddenBtn == true)
$("#Btns").css("display", "none");
}
})
///设置.
function Setting() {
var width = window.innerWidth * 4 / 5;
var url = GetLocalWFPreHref() + "/WF/Comm/RefFunc/Setting.htm?EnName=" + GetQueryString("EnName") + "&PKVal=" + GetQueryString("PKVal");
OpenLayuiDialog(url, "设置", width, 90, "auto", true);
}
//设置按钮
var isHiddenBtn = true;
function InitToolbar() {
var isTree = GetQueryString("isTree");
var isReadonly = GetQueryString("isReadonly");
if (isTree == "1") {
if (isReadonly != "1") {
isHiddenBtn = false;
$("#Btn_Save").show();
}
} else {
if (isReadonly != "1") {
//权限控制.
if (mapData.GetPara("IsInsert") == 1 && pkVal != null) {
isHiddenBtn = false;
$("#Btn_New").show();
}
if (mapData.GetPara("IsUpdate") == 1) {
isHiddenBtn = false;
$("#Btn_Save").show();
}
if (mapData.GetPara("IsDelete") == 1 && pkVal != null) {
if (pkVal != null) {
isHiddenBtn = false;
$("#Btn_Delete").show();
}
}
}
}
if (webUser.No == 'admin') {
isHiddenBtn = false;
$("#Btn_Setting").show();
}
var _html = "";
var btnLab1 = cfg.EnBtnLab1;
if (btnLab1 != null && btnLab1 != undefined && btnLab1 != "")
_html += "<button type='button' class='layui-btn layui-btn-primary layui-border-green layui-btn-sm' id='BtnLab1' onclick='executeFunction(1)'>" + btnLab1 + "</button>";
var btnLab2 = cfg.EnBtnLab2;
if (btnLab2 != null && btnLab2 != undefined && btnLab2 != "")
_html += "<button type='button' class='layui-btn layui-btn-primary layui-border-green layui-btn-sm' id='BtnLab2' onclick='executeFunction(2)'>" + btnLab2 + "</button>";
if (_html != "") {
$("#Btns").append(_html);
}
}
function GenerFoolFrm(mapData, frmData) {
frmData = frmData;
var Sys_GroupFields = frmData.Sys_GroupField;
var mapAtrrs = frmData.Sys_MapAttr;
var webUser = new WebUser();
//用户设置
var mypk = webUser.No + "_Fields_HS_" + GetQueryString("EnName");
var userRegedit = new Entity("BP.Sys.UserRegedit");
userRegedit.SetPKVal(mypk);
var count = userRegedit.RetrieveFromDBSources();
var tabIndex = GetQueryString("tabIndex");
tabIndex = tabIndex == null || tabIndex == undefined ? 0 : tabIndex;
var tableWidth = 800;
var html = "";
html += "<ul class='layui-tab-title'>";
for (var i = 0; i < Sys_GroupFields.length; i++) {
var gf = Sys_GroupFields[i];
if (count != 0 && userRegedit.MVals.indexOf("," + gf.OID + ",") != -1 && gf.OID != "基础信息")//去除基本信息
continue;
var lab = gf.Lab;
if (lab.indexOf(',') != -1) {
lab = lab.substring(0, lab.indexOf(','));
}
if (Sys_GroupFields.length == 1) {
html += "<li class='layui-this' id='" + gf.OID + "'>" + lab + "</li>";
} else {
if (tabIndex == i) {
html += "<li class='layui-this' id='" + gf.OID + "'>" + lab + "</li>";
}
else {
html += "<li id='" + gf.OID + "'>" + lab + "</li>";
}
}
}
html += "</ul>";
html += "<div class='layui-tab-content'style='width:95%'>";
for (var i = 0; i < Sys_GroupFields.length; i++) {
var gf = Sys_GroupFields[i];
if (count != 0 && userRegedit.MVals.indexOf("," + gf.OID + ",") != -1 && gf.OID != "基础信息")//去除基本信息
continue;
if (Sys_GroupFields.length == 1) {
html += "<div class='layui-tab-item layui-show'>";
} else {
if (tabIndex != null && tabIndex != undefined && tabIndex == i) {
html += "<div class='layui-tab-item layui-show'>";
}
else {
html += "<div class='layui-tab-item'>";
}
}
html += InitMapAttr(frmData.Sys_MapAttr, gf.OID, userRegedit);
html += "</div>";
}
html += "</div>";
//加入隐藏控件.
for (var i = 0; i < mapAtrrs.length; i++) {
var attr = mapAtrrs[i];
if (attr.UIVisible == 0) {
var defval = ConvertDefVal(attr);
html += "<input type='hidden' id='TB_" + attr.KeyOfEn + "' name='TB_" + attr.KeyOfEn + "' value='" + defval + "' />";
}
}
$('#CCFormTabs').html("").append(html);
layui.form.render();
$(".layui-form-label").css("width", "");
if (Sys_GroupFields.length == 1)
$(".layui-tab-title").css("display", "none");
//原有的。
//为 DISABLED 的 TEXTAREA 加TITLE
var disabledTextAreas = $('#divCCForm textarea:disabled');
$.each(disabledTextAreas, function (i, obj) {
$(obj).attr('title', $(obj).val());
})
//根据NAME 设置ID的值
var inputs = $('[name]');
$.each(inputs, function (i, obj) {
if ($(obj).attr("id") == undefined || $(obj).attr("id") == '') {
$(obj).attr("id", $(obj).attr("name"));
}
})
//设置默认值
var mainDataStr = JSON.stringify(frmData.MainTable[0]);
for (var j = 0; j < frmData.Sys_MapAttr.length; j++) {
var mapAttr = frmData.Sys_MapAttr[j];
if (mapAttr.UIIsEnable == "0" || isReadonly == "1") {
$('#TB_' + mapAttr.KeyOfEn).attr('disabled', true);
$('#DDL_' + mapAttr.KeyOfEn).attr('disabled', true);
$('#CB_' + mapAttr.KeyOfEn).attr('disabled', true);
}
//添加 label
//如果是整行的需要添加 style='clear:both'.
var defValue = ConvertDefVal(mapAttr);
//if (frmData.MainTable[0].DefValType == 0 && defValue == "10002")
// defValue = "";
if ($('#TB_' + mapAttr.KeyOfEn).length == 1) {
if (defValue == null || defValue == "null")
continue;
$('#TB_' + mapAttr.KeyOfEn).val(defValue);
if (mapAttr.KeyOfEn.toLowerCase() == "icon") {
$("#menuIconIcon").attr("class", defValue);
}
if (drillFields.indexOf(mapAttr.KeyOfEn + ",") != -1 && typeof Drill == "function") {
$('#TB_' + mapAttr.KeyOfEn).hide();
var _html = cceval("Drill('" + mapAttr.KeyOfEn + "','" + defValue + "','" + mainDataStr + "')");
_html = "<div class='layui-input'style='padding:10px 10px;border:none'>" + _html + "</div>";
$('#TB_' + mapAttr.KeyOfEn).after(_html);
}
}
if ($('#DDL_' + mapAttr.KeyOfEn).length == 1) {
var uiBindKey = mapAttr.UIBindKey;
if (uiBindKey.toLowerCase().indexOf("select") == -1 && uiBindKey.indexOf("Dept") != -1 && uiBindKey.indexOf(".") != -1) {
var pushData;
if (mapAttr.UIIsEnable == "1") {
var webUser = new WebUser();
var ens = new Entities(uiBindKey);
ens.RetrieveAll();
if (webUser.No == "admin")
pushData = findChildren(ens, "0");
else
pushData = findChildren(ens, webUser.FK_Dept);
} else {
pushData = [];
var selectText = frmData.MainTable[0][mapAttr.KeyOfEn + "Text"];
if (defValue == null)
defValue = "";
if (selectText == null || selectText == "") {
selectText = defValue;
}
pushData.push({ "id": defValue, "text": selectText, "children": [] });
if ($("option[value='" + defValue + "']", '#DDL_' + mapAttr.KeyOfEn).length == 0 && defValue != "")
$('#DDL_' + mapAttr.KeyOfEn).append("<option value='" + defValue + "'>" + selectText + "</option>");
}
if (drillFields.indexOf(mapAttr.KeyOfEn + ",") != -1 && typeof Drill == "function") {
$('#DDL_' + mapAttr.KeyOfEn).hide();
var _html = cceval("Drill('" + mapAttr.KeyOfEn + "','" + defValue + "','" + mainDataStr + "')");
_html = "<div class='layui-input'style='padding:10px 10px;border:none'>" + _html + "</div>";
$('#DDL_' + mapAttr.KeyOfEn).after(_html);
}
} else {
// 判断下拉框是否有对应option, 若没有则追加
if ($("option[value='" + defValue + "']", '#DDL_' + mapAttr.KeyOfEn).length == 0) {
var mainTable = frmData.MainTable[0];
var selectText = mainTable[mapAttr.KeyOfEn + "Text"];
if (selectText == null || selectText == "")
selectText = defValue;
if (defValue == null || defValue == "") {
} else {
$('#DDL_' + mapAttr.KeyOfEn).append("<option value='" + defValue + "'>" + selectText + "</option>");
}
} else {
//设置选择的值
$('#DDL_' + mapAttr.KeyOfEn).val(defValue);
}
if (drillFields.indexOf(mapAttr.KeyOfEn + ",") != -1 && typeof Drill == "function") {
$('#DDL_' + mapAttr.KeyOfEn).hide();
var _html = cceval("Drill('" + mapAttr.KeyOfEn + "','" + defValue + "','" + mainDataStr + "')");
_html = "<div class='layui-input'style='padding:10px 10px;border:none'>" + _html + "</div>";
$('#DDL_' + mapAttr.KeyOfEn).after(_html);
}
}
if (mapAttr.LGType == "0" && mapAttr.MyDataType == "1" && mapAttr.UIContralType == "1") {
if ($("#TB_" + mapAttr.KeyOfEn + "Text").length == 1) {
if (defValue == "")
$("#TB_" + mapAttr.KeyOfEn + "Text").val($('#DDL_' + mapAttr.KeyOfEn + " option:first").text());
else
$("#TB_" + mapAttr.KeyOfEn + "Text").val($('#DDL_' + mapAttr.KeyOfEn).find("option:selected").text());
}
}
$('#DDL_' + mapAttr.KeyOfEn).val(defValue);
}
if ($('#CB_' + mapAttr.KeyOfEn).length == 1) {
if (defValue == "1")
$('#CB_' + mapAttr.KeyOfEn).attr("checked", true);
else
$('#CB_' + mapAttr.KeyOfEn).attr("checked", false);
if (drillFields.indexOf(mapAttr.KeyOfEn + ",") != -1 && typeof Drill == "function") {
$('#CB_' + mapAttr.KeyOfEn).hide();
var _html = cceval("Drill('" + mapAttr.KeyOfEn + "','" + defValue + "','" + mainDataStr + "')");
_html = "<div class='layui-input'style='padding:10px 10px;border:none'>" + _html + "</div>";
$('#CB_' + mapAttr.KeyOfEn).after(_html);
}
}
}
if (pkVal != null && pkVal != 0) {
//获取当前主键字段是否可以编辑?
$("#TB_No").attr("disabled", true);
$("#TB_MyPK").attr("disabled", 'disabled');
$("#TB_NodeID").attr("disabled", 'disabled');
$("#TB_WorkID").attr("disabled", 'disabled');
$("#TB_OID").attr("disabled", 'disabled');
}
//获取
var refKey = GetQueryString("RefKey");
var refValue = GetQueryString("RefVal");
if (refKey && refValue) {
$("#TB_" + refKey).val(refValue);
$("#DDL_" + refKey).val(refValue);
}
var html = "-";
var fileName = $("#TB_MyFileName").val();
if (fileName != null && fileName != "" && fileName != undefined && fileName != "null") {
html = "<a href='#' onclick='downLoadFile()' target='_self'>" + $("#TB_MyFileName").val() + "." + $("#TB_MyFileExt").val() + "</a>";
}
$("#FileInfo").html(html);
layui.form.render();
//设置扩展
AfterBindEn_DealMapExt(frmData);
$.each($(".ccdate"), function (i, item) {
var format = $(item).attr("data-info");
var type = $(item).attr("data-type");
if (format.indexOf("HH") != -1) {
layui.laydate.render({
elem: '#' + item.id,
format: $(item).attr("data-info"), //可任意组合
type: type,
trigger: 'click',
ready: function (date) {
var now = new Date();
var mm = "";
if (now.getMinutes() < 10)
mm = "0" + now.getMinutes();
else
mm = now.getMinutes();
var ss = "";
if (now.getSeconds() < 10)
ss = "0" + now.getSeconds();
else
ss = now.getSeconds();
this.dateTime.hours = now.getHours();
this.dateTime.minutes = mm;
this.dateTime.seconds = ss;
},
change: function (value, date, endDate) {
$('.laydate-btns-confirm').click();
},
done: function (value, date, endDate) {
var data = $(this.elem).data();
$(this.elem).val(value);
if (data && data.ReqDay != null && data.ReqDay != undefined)
ReqDays(data.ReqDay);
}
});
} else {
layui.laydate.render({
elem: '#' + item.id,
format: $(item).attr("data-info"), //可任意组合
type: type,
done: function (value, date, endDate) {
var data = $(this.elem).data();
$(this.elem).val(value);
if (data && data.ReqDay != null && data.ReqDay != undefined)
ReqDays(data.ReqDay);
}
});
}
})
}
function downLoadFile() {
if (plant == "CCFlow")
SetHref(basePath + '/WF/Comm/ProcessRequest?DoType=HttpHandler&HttpHandlerName=BP.WF.HttpHandler.WF_CommEntity&DoMethod=EntityFile_Load&DelPKVal=' + pkVal + '&EnsName=' + GetQueryString("EnName") + "s");
else {
var currentPath = GetHrefUrl();
var path = currentPath.substring(0, currentPath.indexOf('/WF') + 1);
Url = path + '/WF/Ath/EntityFileLoad.do?DelPKVal=' + pkVal + '&EnsName=' + GetQueryString("EnName") + "s";
SetHref(url);
}
}
var isHaveAddAth = false;
//解析表单字段 MapAttr.
function InitMapAttr(Sys_MapAttr, groupID, userRegedit) {
var html = "<div class='layui-row FoolFrmGroupBar' id='Group_" + groupID + "'>";
var isDropTR = true;
var isExitMyNum = false;
var fileDesc = "";
for (var i = 0; i < Sys_MapAttr.length; i++) {
var attr = Sys_MapAttr[i];
if (userRegedit != null && userRegedit != undefined && userRegedit.Vals.indexOf("," + attr.KeyOfEn) != -1)
continue;
if (attr.KeyOfEn == "MyFileNum") {
isExitMyNum = true;
continue;
}
if (attr.KeyOfEn == "MyFileName") {
fileDesc = attr.Name;
continue;
}
if (GetPara(attr.AtPara, "GroupName") != groupID || attr.UIVisible == 0)
continue;
var enable = attr.UIIsEnable == "1" ? "" : " ui-state-disabled";
var rm = null; //当前的方法.
for (var iRm = 0; iRm < dtM.length; iRm++) {
if (dtM[iRm].RefAttrKey == attr.KeyOfEn) {
rm = dtM[iRm];
}
}
//输出帮助连接.
var name = null;
var helpUrl = GetPara(attr.AtPara, "HelpUrl");
if (helpUrl == null || helpUrl == "" || helpUrl == "null") {
name = attr.Name;
}
else {
if (attr.MyDataType == 4) {
if (helpUrl.indexOf('javascr') == 0)
name = "<a href=\"" + helpUrl + "\" ><img src='../../Img/Help.png' style='text-align:right' /><i class='iconfont icon-iconfonticon4'></i></a>";
else
name = "<a href=\"" + helpUrl + "\" target=_blank ><img src='../../Img/Help.png' style='text-align:right' /><i class='iconfont icon-iconfonticon4'></i></a>";
} else {
if (helpUrl.indexOf('javascr') == 0)
name = "<a href=\"" + helpUrl + "\" >" + attr.Name + "<i class='iconfont icon-iconfonticon4'></i></a>";
else
//弹窗打开帮助页面
name = "<a onClick = openHelpModal(\"" + helpUrl +"\") >" + attr.Name + "<i class='iconfont icon-iconfonticon4'></i></a>";
//name = "<a href=\"" + helpUrl + "\" target=_blank >" + attr.Name + "<i class='iconfont icon-iconfonticon4'></i></a>";
}
}
var lab = "";
if (attr.UIContralType == 0)
lab = "<label for='TB_" + attr.KeyOfEn + "' class='layui-form-label " + (attr.UIIsInput == 1 ? "mustInput" : "") + "'>" + name + "</label>";
if (attr.MyDataType == 4)
lab = "<label for='CB_" + attr.KeyOfEn + "' class='layui-form-label " + (attr.UIIsInput == 1 ? "mustInput" : "") + "'>" + name + "</label>";
if (attr.UIContralType == 1)
lab = "<label for='DDL_" + attr.KeyOfEn + "' class='layui-form-label " + (attr.UIIsInput == 1 ? "mustInput" : "") + "'>" + name + "</label>";
if (attr.UIIsInput == 1 && attr.UIIsEnable == 1) {
lab += " <span style='color:red' class='mustInput' data-keyofen='" + attr.KeyOfEn + "'>*</span>";
}
//大文本
if (attr.UIHeight >= 10) {
if (attr.TextModel == 3 || attr.ColSpan == 4) {
if (isDropTR == false) {
html += "</div>";
}
isDropTR = true;
html += "<div class='layui-row FoolFrmFieldRow'style=''>";
html += "<div class='layui-col-md12 layui-col-xs12 FoolFrmFieldLabel'style='width: 16.66666667%;'>" + lab + "</div>";
html += "</div>";
html += "<div class='layui-row FoolFrmFieldRow'>";
html += "<div class='layui-col-md12 layui-col-xs12 FoolFrmFieldInput' style='padding-left:calc(16.6% - 10px)'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
html += "</div>";
continue;
}
}
//线性展示并且colspan=3
if ((attr.ColSpan == 3 || attr.ColSpan == 4) && attr.UIHeight <= 40) {
if (isDropTR == false) {
html += "</div>";
}
isDropTR = true;
html += "<div class='layui-row FoolFrmFieldRow'>";
if (attr.UIContralType == 2) {
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'><label class='layui-form-label'></label></div>";
html += "<div class='layui-col-md10 layui-col-xs10 FoolFrmFieldInput'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
} else {
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'>" + lab + "</div>";
html += "<div class='layui-col-md10 layui-col-xs10 FoolFrmFieldInput'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
}
html += "</div>";
if (rm != null) {
html += "<div class='layui-row FoolFrmFieldRow'>";
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'><label class='layui-form-label'></label></div>";
html += "<div class='layui-col-md10 layui-col-xs10 FoolFrmFieldInput'>";
html += GenerRM(rm);
html += "</div>";
html += "</div>";
isDropTR = true;
}
continue;
}
//线性展示并且colspan=4
if ((attr.ColSpan == 4 || attr.ColSpan == 3) && attr.UIHeight > 40) {
if (isDropTR == false) {
html += "</div>";
}
isDropTR = true;
html += "<div class='layui-row FoolFrmFieldRow' style='width: 16.66666667%;'>";
html += "<div class='layui-col-md12 layui-col-xs12 FoolFrmFieldLabel'>" + lab + "</div>";
html += "</div>";
html += "<div class='layui-row FoolFrmFieldRow'>";
html += "<div class='layui-col-md12 layui-col-xs12 FoolFrmFieldInput' style='padding-left:calc(16.6% - 10px)'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
html += "</div>";
if (rm != null) {
html += "<div class='layui-row FoolFrmFieldRow'>";
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'><label class='layui-form-label'></label></div>";
html += "<div class='layui-col-md10 layui-col-xs10 FoolFrmFieldInput'>";
html += GenerRM(rm);
html += "</div>";
html += "</div>";
isDropTR = true;
}
continue;
}
if (isDropTR == true) {
html += "<div class='layui-row FoolFrmFieldRow'>";
if (attr.UIContralType == 2) {
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'><label class='layui-form-label'></label></div>";
html += "<div class='layui-col-md4 layui-col-xs4 FoolFrmFieldInput'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
} else {
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'>" + lab + "</div>";
html += "<div class='layui-col-md4 layui-col-xs4 FoolFrmFieldInput'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
}
isDropTR = !isDropTR;
if (rm != null) {
html += "<div class='layui-col-md6 layui-col-xs6 FoolFrmFieldLabel'>";
html += GenerRM(rm);
html += "</div>";
html += "</div>";
isDropTR = true;
}
continue;
}
if (isDropTR == false) {
if (attr.UIContralType == 2) {
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'><label class='layui-form-label'></label></div>";
html += "<div class='layui-col-md4 layui-col-xs4 FoolFrmFieldInput'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
} else {
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'>" + lab + "</div>";
html += "<div class='layui-col-md4 layui-col-xs4 FoolFrmFieldInput'>";
html += InitMapAttrOfCtrl(attr);
html += "</div>";
}
//html += "</tr>";
//isDropTR = !isDropTR;
if (rm != null) {
html += "<div class='layui-col-md6 layui-col-xs6 FoolFrmFieldLabel'>";
html += GenerRM(rm);
html += "</div>";
html += "</div>";
//html += "<div class='layui-row FoolFrmFieldRow'>";
isDropTR = true;;
} else {
html += "</div>";
isDropTR = !isDropTR;
}
continue;
}
}
if (isDropTR == false)
html += "</div>";
//如果MapData中具有文件上传的权限解析设置 0 无 1 单附件上传 2 多附件上传
var entityAthType = mapData.GetPara("BPEntityAthType");
//单附件上传
if (entityAthType == 1 && isHaveAddAth == false) {
isHaveAddAth = true;
html += "<div class='layui-row FoolFrmFieldRow'>";
if (fileDesc == "")
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'>附件上传</div>";
else
html += "<div class='layui-col-md2 layui-col-xs2 FoolFrmFieldLabel'>" + fileDesc + "</div>";
html += "<div class='layui-col-md10 layui-col-xs10 FoolFrmFieldInput'>";
html += "<input type='file' id='File_Upload' name='File_Upload' style='background-color:white;' onchange='changeFile(1)' />";
html += "已上传的文件:<span id='FileInfo'></span>";
html += "</div>";
html += "</div>";
}
//多附件上传
if (entityAthType == 2 && isHaveAddAth == false) {
isHaveAddAth = true;
//多附件的信息
var AttrFiles = frmData.AttrFiles;
var FileManagers = frmData.Sys_FileManager;
html += ShowMultiFile(AttrFiles, FileManagers, isExitMyNum);
if (isExitMyNum == true)
html += "<div style='display:none'><input type='file' id='File_Upload' name='File_Upload' style='background-color:white;dispaly:none' onchange='MultiUploadFile()' /></div>";
}
html += "</div>";
dtl.forEach(item => {
if (item.GroupName == groupID) {
//增加从表的信息
html += "<div class='layui-col-xs12' style='margin-left: 24px;'>";
html += "<div style='line-height: 40px;font-size: 16px;'>"+item.Title+"</div>";
html += "<iframe style='width:100%;height:350px' name='Dtl' ID='Frame_" + item.No + "' src='" + item.Url + "' frameborder=0 leftMargin='0' topMargin='0' scrolling=none></iframe>"
html += "</div>";
return;
}
})
return html;
}
function GenerRM(rm) {
var icon = rm.Icon;
if (rm.Icon == "" || rm.Icon == null) {
icon = "../../Img/dot.png";
} else if (rm.Icon.indexOf('http') != 0) {
icon = "../" + rm.Icon;
}
var img = "";
if (icon.toLowerCase().indexOf(".png") != -1 || icon.toLowerCase().indexOf(".jpg") != -1) {
img = "<img src='" + icon + "' border=0 style='width:16px;height:16px;' />";
}
else
img = "<i class='" + icon + "'></i>";
var html = "";
var W = document.body.clientWidth - 80;
var H = document.body.clientHeight - 140;
if (W > rm.W)
W = rm.W;
var event = "if(pkVal== null){ layer.alert(\"请保存后再执行操作\");return;}"
if (parseInt(rm.RefMethodType) == RefMethodType.LinkeWinOpen) {
html = "<a href='javascript:void(0)' onclick='" + event + " WinOpenFull(\"" + rm.Url + "\",\"" + rm.Title + "\")'>" + img + rm.Title + "</a>";
}
if (parseInt(rm.RefMethodType) == RefMethodType.Func) {
html = "<a href='javascript:void(0)' onclick='" + event + " OPenFun(\"" + rm.Url + "\",\"" + rm.Warning + "\",\"" + rm.Title + "\")'>" + img + rm.Title + "</a>";
}
if (parseInt(rm.RefMethodType) == RefMethodType.LinkModel) {
html = "<a href='javascript:void(0)' onclick='" + event + " OpenLayuiDialog(\"" + rm.Url + "\",\"" + rm.Title + "\",\"" + W + "\",80,\"auto\",true)'>" + img + rm.Title + "</a>";
}
if (parseInt(rm.RefMethodType) == RefMethodType.RightFrameOpen) {
// alert('没有实现@代国强, 需要根据窗口大小,弹出模态窗口..');
//var html = "<img src='" + icon + "' border=0 style='width:16px;height:16px;' /><a href='javascript:OpenIt(\"" + rm.Url + "\",\"" + rm.Title + "\",\"" + rm.W + "\",\"" + rm.H + "\")'>" + rm.Title + "</a>";
html = "<a href='javascript:" + event + " OpenUrlInRightFrame(this,\"" + rm.Url + "\")'>" + img + rm.Title + "</a>";
}
return html;
}
function OPenFun(url, warning, title) {
warning = warning.replace(/,\s+/g, ",");
warning = warning.replace(/\s+/g, "\r\n");
layer.confirm(warning, function (index) {
layer.close(index);
OpenLayuiDialog(url, title, 400, 80, "auto", false);
});
}
//在右侧框架中显示指定url的页面
function OpenUrlInRightFrame(ele, url) {
if (ele != null && ele != undefined) {
currShow = $(ele).parents('li').text(); //有回车符
$.each($(ele).parents('ul').children('li'), function (i, e) {
$(e).children('div').css('font-weight', $(e).text() == currShow ? 'bold' : 'normal');
});
if (url.indexOf('?') == -1)
url += '?1=1';
$('#rightFrame').empty();
$('#rightFrame').append('<iframe scrolling="auto" frameborder="0" src="' + url + '&s=' + Math.random() + '" style="width:100%;height:100%;"></iframe>');
}
}
function InitMapAttrOfCtrl(mapAttr) {
var ccsCtrl = mapAttr.CSSCtrl;
ccsCtrl = ccsCtrl == null || ccsCtrl == undefined || ccsCtrl == "0" ? "" : ccsCtrl;
//下拉框 外键和外部数据源
if ((mapAttr.LGType == "0" && (mapAttr.MyDataType == "1" || mapAttr.MyDataType == "2") && mapAttr.UIContralType == 1)
|| (mapAttr.LGType == "2" && mapAttr.MyDataType == "1")) {
var css = "";
if (mapAttr.LGType == "0")
css = "class='ddl-ext'";
return "<div id='DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group'><select id = 'DDL_" + mapAttr.KeyOfEn + "' name = 'DDL_" + mapAttr.KeyOfEn + "' " + css + " lay-filter='" + mapAttr.KeyOfEn + "' > " + InitDDLOperation(frmData, mapAttr, "") + "</select></div>";
}
//枚举 单选枚举和下拉框枚举
if (mapAttr.LGType == 1) {
var ses = frmData[mapAttr.KeyOfEn];
if (ses == undefined)
ses = frmData[mapAttr.UIBindKey];
if (ses == undefined) {
//枚举类型的.
if (mapAttr.LGType == 1) {
ses = frmData.Sys_Enum;
ses = $.grep(ses, function (value) {
return value.EnumKey == mapAttr.UIBindKey;
});
}
}
if (mapAttr.UIContralType == 1) {//下拉框显示
var operations = "";
$.each(ses, function (i, obj) {
operations += "<option value='" + obj.IntKey + "'>" + obj.Lab + "</option>";
});
return "<div id='DIV_" + mapAttr.KeyOfEn + "'><select " + ccsCtrl + " name='DDL_" + mapAttr.KeyOfEn + "' id='DDL_" + mapAttr.KeyOfEn + "' " + (mapAttr.UIIsEnable == 1 ? '' : 'disabled="disabled"') + " lay-filter='" + mapAttr.KeyOfEn + "' >" + operations + "</select></div>";
}
if (mapAttr.UIContralType == 2) {//复选框
var rbHtmls = "";
//显示方式,默认为 0=横向展示 3=横向..
var RBShowModel = 0;
if (mapAttr.AtPara.indexOf('@RBShowModel=3') >= 0)
RBShowModel = 3;
for (var i = 0; i < ses.length; i++) {
var se = ses[i];
var br = "";
if (RBShowModel == 0)
br = "<br>";
var checked = "";
//if (se.IntKey == mapAttr.DefVal)
// checked = " checked=true ";
rbHtmls += "<input " + ccsCtrl + " type=checkbox name='CB_" + mapAttr.KeyOfEn + "' id='CB_" + mapAttr.KeyOfEn + "_" + se.IntKey + "' value='" + se.IntKey + "' " + checked + " lay-filter='" + mapAttr.KeyOfEn + "' class='mcheckbox' value='" + se.IntKey + "' title='" + se.Lab + "'/>";
}
return "<div id='DIV_" + mapAttr.KeyOfEn + "'>" + rbHtmls + "</div>";
}
if (mapAttr.UIContralType == 3) {//单选按钮显示
var rbHtmls = "";
//显示方式,默认为 0=横向展示 3=横向..
var RBShowModel = 0;
if (mapAttr.AtPara.indexOf('@RBShowModel=3') >= 0)
RBShowModel = 3;
for (var i = 0; i < ses.length; i++) {
var se = ses[i];
var br = "";
if (RBShowModel == 0)
br = "<br>";
var checked = "";
if (se.IntKey == mapAttr.DefVal)
checked = " checked=true ";
rbHtmls += "<input " + ccsCtrl + " type=radio name='RB_" + mapAttr.KeyOfEn + "' id='RB_" + mapAttr.KeyOfEn + "_" + se.IntKey + "' value='" + se.IntKey + "' " + checked + " lay-filter='" + mapAttr.KeyOfEn + "' title='" + se.Lab + "'/>" + br;
}
return "<div id='DIV_" + mapAttr.KeyOfEn + "'>" + rbHtmls + "</div>";
}
}
if (mapAttr.LGType == 0) {
switch (parseInt(mapAttr.MyDataType)) {
case 1://普通文本
//富文本编辑器
if (mapAttr.TextModel == 3) {
if (mapAttr.UIIsEnable == "0" || isReadonly == true) {
//使用div展示
var defValue = ConvertDefVal(mapAttr);
defValue = defValue.replace(/white-space: nowrap;/g, "");
return "<div style='margin-bottom:5px;border: 1px solid #cacaca!important;min-height: 50px;padding: 5px;background-color: #f2f2f2;word-wrap: break-word;'>" + defValue + "</div>";
}
return "<textarea maxlength=" + mapAttr.MaxLen + " style='height:" + mapAttr.UIHeight + "px;width:100%;' id='TB_" + mapAttr.KeyOfEn + "' name='TB_" + mapAttr.KeyOfEn + "' class='rich'/>";
}
//判断是不是大块文本
if (mapAttr.IsSupperText == 1 || mapAttr.UIHeight > 40) {
return "<textarea class='layui-textarea' id='TB_" + mapAttr.KeyOfEn + "' name='TB_" + mapAttr.KeyOfEn + "' type='text' " + (mapAttr.UIIsEnable == 1 ? '' : ' disabled="disabled"') + "></textarea>"
}
var baseUrl = "../";
var currentURL = "";
if (currentURL.indexOf("AdminFrm.htm") != -1)
baseUrl = "../../../";
if (currentURL.indexOf("CCBill") != -1 || currentURL.indexOf("CCForm") != -1)
baseUrl = "../../";
if (mapAttr.IsSigan == "1" && mapAttr.UIIsEnable == 1 && isReadonly != 0) {
var html = "<input maxlength=" + mapAttr.MaxLen + " id='TB_" + mapAttr.KeyOfEn + "' name='TB_" + mapAttr.KeyOfEn + "' value='" + defValue + "' type=hidden />";
//是否签过
var sealData = new Entities("BP.Tools.WFSealDatas");
sealData.Retrieve("OID", pageData.OID, "FK_Node", GetQueryString("FK_Node"), "SealData", GetQueryString("UserNo"));
if (sealData.length > 0) {
eleHtml += "<img src='" + baseUrl + "DataUser/Siganture/" + defValue + ".jpg' alt='" + defValue + "' style='border:0px;width:100px;height:30px;' id='Img" + mapAttr.KeyOfEn + "' />" + html;
isSigantureChecked = true;
}
else {
eleHtml += "<img src='" + baseUrl + "DataUser/Siganture/siganture.jpg' ondblclick='figure_Template_Siganture(\"" + mapAttr.KeyOfEn + "\",\"" + defValue + "\")' style='border:0px;width:100px;height:30px;' id='Img" + mapAttr.KeyOfEn + "' />" + html;
}
return eleHtml;
}
//如果不可编辑,并且是图片名称
if (mapAttr.IsSigan == "1") {
var val = ConvertDefVal(frmData, mapAttr.DefVal, mapAttr.KeyOfEn);
var html = "<input maxlength=" + mapAttr.MaxLen + " id='TB_" + mapAttr.KeyOfEn + "' name='TB_" + mapAttr.KeyOfEn + "' value='" + val + "' type=hidden />";
eleHtml += "<img src='" + baseUrl + "DataUser/Siganture/" + val + ".jpg' alt='" + val + "' style='border:0px;width:100px;height:30px;' id='Img" + mapAttr.KeyOfEn + "' />" + html;
return eleHtml;
}
if (mapAttr.KeyOfEn.toLowerCase() == "icon") {
var _html = "<div id='DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group'>";
_html += "<span class='layui-input-prefix'><i id='menuIconIcon' class='icon-settings'></i></span>"
_html += "<input class='" + ccsCtrl + " layui-input' style='text-align:left;width:calc(100% - 120px)!important;display:inline' type='text' maxlength=" + mapAttr.MaxLen + " value='" + mapAttr.DefVal + "' name='TB_" + mapAttr.KeyOfEn + "' id='TB_" + mapAttr.KeyOfEn + "'placeholder='" + (mapAttr.Tip || '') + "' " + (mapAttr.UIIsEnable == 1 ? '' : ' disabled="disabled"') + "/>";
if (mapAttr.UIIsEnable == 1 && isReadonly != "1")
_html += "<span class='layui-input-suffix'><a id='menuIconButton' href='javascript:void(0)' class='' onclick='openIconWindow(\"" + mapAttr.KeyOfEn + "\")'><i class='layui-icon'>&#xe615;</i></a></span>";
_html += "</div>";
return _html;
}
return "<div id='DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group'> <input class='" + ccsCtrl + " layui-input' maxlength=" + mapAttr.MaxLen + " value='" + mapAttr.DefVal + "' name='TB_" + mapAttr.KeyOfEn + "' id='TB_" + mapAttr.KeyOfEn + "'placeholder='" + (mapAttr.Tip || '') + "' type='text' " + (mapAttr.UIIsEnable == 1 ? '' : ' disabled="disabled"') + " /></div>";
case 2://整数
var _html = "<div id = 'DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group' >";
_html += "<input class='" + ccsCtrl + " layui-input' value='0' style='text-align:right;padding-right:10px;' onkeyup=" + '"' + "valitationAfter(this, 'int');if(isNaN(value) || (value%1 !== 0))execCommand('undo')" + '"' + " onafterpaste=" + '"' + "valitationAfter(this, 'int');if(isNaN(value) || (value%1 !== 0))execCommand('undo')" + '"' + " maxlength=" + mapAttr.MaxLen / 2 + " type='text'" + enableAttr + " id='TB_" + mapAttr.KeyOfEn + "'placeholder='" + (mapAttr.Tip || '') + "'/>";
_html += "</div>";
return _html;
case 4: //复选框
var helpUrl = GetPara(mapAttr.AtPara, "HelpUrl");
if (helpUrl == null || helpUrl == "" || helpUrl == "null")
helpUrl = ""
if(helpUrl!="")
if (helpUrl.indexOf('javascr') == 0)
helpUrl = "<a href=\"" + helpUrl + "\" ><i class='iconfont icon-iconfonticon4'></i></a>";
else
helpUrl = "<a href=\"" + helpUrl + "\" target=_blank ><i class='iconfont icon-iconfonticon4'></i></a>";
if (mapAttr.UIIsEnable == 0) {
enableAttr = "disabled='disabled'";
} else {
enableAttr = "";
}
return "<div style='line-height:38px;margin-top:10px;' id='DIV_" + mapAttr.KeyOfEn + "'><label for='CB_" + mapAttr.KeyOfEn + "' ></label><input type='checkbox' name='CB_" + mapAttr.KeyOfEn + "' id='CB_" + mapAttr.KeyOfEn + "'" + (mapAttr.DefVal == 1 ? "checked = 'checked'" : "") + enableAttr + " lay-filter='" + mapAttr.KeyOfEn + "' lay-skin='primary' value='1' title='" + mapAttr.Name + "'>" + helpUrl+"</div>";
case 3://浮点
case 5://双精度
var _html = "<div id = 'DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group' >";
var attrdefVal = mapAttr.DefVal;
var bit;
if (attrdefVal != null && attrdefVal !== "" && attrdefVal.indexOf(".") >= 0)
bit = attrdefVal.substring(attrdefVal.indexOf(".") + 1).length;
else
bit = 2;
_html += "<input class='" + ccsCtrl + " layui-input' style='text-align:right;padding-right:10px;' value='0.00' onkeyup=" + '"' + "valitationAfter(this, 'float');if(isNaN(value)) execCommand('undo');limitLength(this," + bit + ");" + '"' + " onafterpaste=" + '"' + " valitationAfter(this, 'float');if(isNaN(value))execCommand('undo')" + '"' + " maxlength=" + mapAttr.MaxLen / 2 + " type='text' id='TB_" + mapAttr.KeyOfEn + "' placeholder='" + (mapAttr.Tip || '') + "'/>";
_html += "</div>";
return _html;
case 6://日期类型
case 7://时间类型
//生成中间的部分.
var enableAttr = '';
var frmDate = 0; //获取日期格式
if (mapAttr.MyDataType == 7)
frmDate = 1;
var dateFmt = '';
var dateType = "";
if (frmDate == 0) {
dateFmt = "yyyy-MM-dd";
dateType = "date"
} else if (frmDate == 1) {
dateFmt = "yyyy-MM-dd HH:mm";
dateType = "datetime";
} else if (frmDate == 2) {
dateFmt = "yyyy-MM-dd HH:mm:ss";
dateType = "datetime";
} else if (frmDate == 3) {
dateFmt = "yyyy-MM";
dateType = "month";
} else if (frmDate == 4) {
dateFmt = "HH:mm";
dateType = "time";
} else if (frmDate == 5) {
dateFmt = "HH:mm:ss";
dateType = "time";
} else if (frmDate == 6) {
dateFmt = "MM-dd";
dateType = "date";
}
else if (frmDate == 7) {
dateFmt = "yyyy";
dateType = "year";
}
if (mapAttr.UIIsEnable == 0)
enableAttr = "disabled='disabled' ";
return "<div id='DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group'><i class='input-icon layui-icon layui-icon-date'></i> <input class='" + ccsCtrl + " ccdate layui-input' data-info='" + dateFmt + "' data-type='" + dateType + "' maxlength=" + mapAttr.MaxLen + " value='" + mapAttr.DefVal + "' type='text' " + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "' id='TB_" + mapAttr.KeyOfEn + "'/></div>";
case 8://金额
//获取DefVal,根据默认的小数点位数来限制能输入的最多小数位数
var _html = "<div id = 'DIV_" + mapAttr.KeyOfEn + "' class='ccbpm-input-group' >";
var attrdefVal = mapAttr.DefVal;
var bit;
if (attrdefVal != null && attrdefVal !== "" && attrdefVal.indexOf(".") >= 0)
bit = attrdefVal.substring(attrdefVal.indexOf(".") + 1).length;
else
bit = 2;
_html += "<input class='" + ccsCtrl + " layui-input' style='text-align:right;padding-right:10px;' onkeyup=" + '"' + "valitationAfter(this, 'money');limitLength(this," + bit + "); FormatMoney(this, " + bit + ", ',',0)" + '"' + " onafterpaste=" + '"' + "valitationAfter(this, 'money');if(isNaN(value))execCommand('undo');" + '"' + " onblur=" + '"' + "FormatMoney(this, " + bit + ", ',',1)" + '"' + " maxlength=" + mapAttr.MaxLen / 2 + " type='text' id='TB_" + mapAttr.KeyOfEn + "' value='0.00' placeholder='" + (mapAttr.Tip || '') + "'/>";
_html += "</div>";
return _html;
default:
layer.alert(mapAttr.Name + "的类型没有判断.");
break;
}
}
}
//填充默认数据
function ConvertDefVal(attr) {
var result = '';
//通过MAINTABLE返回的参数
for (var ele in frmData.MainTable[0]) {
if (attr.KeyOfEn == ele && frmData.MainTable[0] != '') {
result = frmData.MainTable[0][ele];
break;
}
}
//获取参数中的值
var pageParams = getQueryString();
$.each(pageParams, function (i, pageParam) {
if (pageParam.indexOf(attr.KeyOfEn) == 0) {
var pageParamArr = pageParam.split('=');
result = pageParamArr[1];
return false;
}
});
return result = unescape(result);
}
//初始化下拉列表框的OPERATION
function InitDDLOperation(flowData, mapAttr, defVal) {
var operations = "";
var data = flowData[mapAttr.KeyOfEn];
if (data == undefined)
data = flowData[mapAttr.UIBindKey];
if (data == undefined) {
//枚举类型的.
if (mapAttr.LGType == 1) {
var enums = flowData.Sys_Enum;
enums = $.grep(enums, function (value) {
return value.EnumKey == mapAttr.UIBindKey;
});
$.each(enums, function (i, obj) {
operations += "<option " + (obj.IntKey == mapAttr.DefVal ? " selected='selected' " : "") + " value='" + obj.IntKey + "'>" + obj.Lab + "</option>";
});
}
return operations;
}
$.each(data, function (i, obj) {
operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
});
return operations;
}
function ChangeKeyOfEnText(obj, KeyOfEn) {
if ($("#TB_" + KeyOfEn + "Text").length == 1)
$("#TB_" + KeyOfEn + "Text").val($(obj).find("option:selected").text());
}
//新建.
function New() {
var enName = GetQueryString("EnName");
var fromName = GetQueryString("FromName");
//获取选中的tab选项卡
var index = 0;
if ($('#tabDiv').length == 1) {
var tab = $('#tabDiv').tabs('getSelected');
index = $('#tabDiv').tabs('getTabIndex', tab);
}
url = GetHrefUrl();
url = url.replace("#", "");
url = replaceParamVal(url, "tabIndex", index);
url = replaceParamVal(url, "PKVal", "");
//新增时En.htm页面隐藏
if (window.parent && window.parent.$ && window.parent.$(".layui-side").length == 1 && isSameEnName == true) {
parent.window.location.href = filterXSS(url).replace("EnOnly", "En"); //刷新.
return;
}
window.location.href = filterXSS(url);
}
function Save() {
$("#Btn_Save").html('正在保存');
this.Update(true);
$("#Btn_Save").html('保存');
}
//更新.
function Update(isRefresh) {
var url = GetHrefUrl();
var enName = GetQueryString("EnName");
var en = new Entity(enName);
//获取选中的tab选项卡
var index = 0;
if ($('#tabDiv').length == 1) {
var tab = $('#tabDiv').tabs('getSelected');
index = $('#tabDiv').tabs('getTabIndex', tab);
}
if (pkVal == null || pkVal == "") {
en.CopyForm();
if ($(".rich").length > 0) {
$(".rich").each(function (i, item) {
var edit = layui.tinymce.get('#' + item.id)
var val = edit.getContent();
var key = item.id.replace("TB_", "");
en[key] = val;
})
}
//有编号列.
if (en.No != undefined) {
//获取当前主键字段是否可以编辑?
var val = $("#TB_No").prop("disabled");
//主键是可以别用户自定义的 zhangsan.
if (val == false) {
if (en.IsExits() == true) {
alert('编号为[' + en.No + ']的数据已经存在.');
return false;
}
}
}
//获取树形结构的表单值
//var combotrees = $(".easyui-combotree");
//$.each(combotrees, function (i, combotree) {
// var name = $(combotree).attr('id');
// var tree = $('#' + name).combotree('tree');
// //获取当前选中的节点
// var data = tree.tree('getSelected');
// if (data != null) {
// en[name] = data.id;
// }
//});
var refPK = GetQueryString("RefPK");
if (refPK && refPK != "") {
en[refPK] = GetQueryString("RefPKVal");
}
var info = en.Insert();
if (info.toString().indexOf("err@") != -1) {
return false;
}
//保存实体后文件上传
var entityAthType = mapData.GetPara("BPEntityAthType");
var fileObj = $("#File_Upload").length == 0 ? [] : $("#File_Upload")[0].files;
if (fileObj.length != 0) {
if (entityAthType == 1)
uploadFile(en.GetPKVal());
if (entityAthType == 2) {
pkVal = en.GetPKVal();
MultiUploadFile();
}
}
url = url.replace("#", "");
url = replaceParamVal(url, "PKVal", en.GetPKVal());
url = replaceParamVal(url, "tabIndex", index);
if (url.indexOf("&tabIndex") == -1)
url += "&tabIndex=" + index;
if (url.indexOf('&PKVal=') == -1)
url += "&PKVal=" + en.GetPKVal();
//新增保存后显示En
if (window.parent && window.parent.$ && window.parent.$(".layui-side").length == 1 && isSameEnName == true && isRefresh == true) {
url = url.replace("EnOnly", "En");
parent.window.location.href = filterXSS(url); //刷新.
return;
}
if (isRefresh == true) {
SetHref(url); //刷新.
return;
}
if (pkVal == null) {
pkVal = mainData.OID;
if (pkVal == undefined || pkVal == "")
pkVal = mainData.No;
if (pkVal == undefined || pkVal == "")
pkVal = mainData.WorkID;
if (pkVal == undefined || pkVal == "")
pkVal = mainData.NodeID;
if (pkVal == undefined || pkVal == "")
pkVal = mainData.MyPK;
if (pkVal == "null" || pkVal == "" || pkVal == undefined)
pkVal = null;
InitToolbar();
}
return true;
}
en.pkval = pkVal;
en.SetPKVal(pkVal);
en.RetrieveFromDBSources();
//en.SetPKVal(pkVal);
en.CopyForm();
if ($(".rich").length > 0) {
$(".rich").each(function (i, item) {
var edit = layui.tinymce.get('#' + item.id)
var val = edit.getContent();
var key = item.id.replace("TB_", "");
en[key] = val;
})
}
var refPK = GetQueryString("RefPK");
if (refPK && refPK != "") {
en[refPK] = GetQueryString("RefPKVal");
}
var info = en.Update();
if (info == 0) {
alert('更新错误:' + info);
return false;
}
//保存实体后文件上传
var entityAthType = mapData.GetPara("BPEntityAthType")
var fileObj = $("#File_Upload").length == 0 ? [] : $("#File_Upload")[0].files;
if (fileObj.length != 0) {
if (entityAthType == 1)
uploadFile(pkVal);
}
url = url.replace("#", "");
url = replaceParamVal(url, "tabIndex", index);
url = replaceParamVal(url, "PKVal", en.GetPKVal());
if (url.indexOf("&tabIndex") == -1)
url += "&tabIndex=" + index;
if (window.parent && typeof window.parent.$ != "undefined" && window.parent.$(".layui-side").length == 1 && isSameEnName == true && isRefresh == true) {
url = url.replace("EnOnly", "En");
parent.window.location.href = filterXSS(url);
return;
}
if (isRefresh == true)
window.location.href = filterXSS(url); //刷新.
return true;
}
function changeFile() {
var pkval = GetPKVal();
if (pkval == null || pkval == "") {
return;
}
uploadFile(pkval);
}
//单文件上传
function uploadFile(pkval) {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CommEntity");
handler.AddFileData();
handler.AddPara("EnName", GetQueryString("EnName"));
handler.AddPara("PKVal", pkval);
var data = handler.DoMethodReturnString("EntityAth_Upload");
if (data.indexOf("err@") != -1) {
alert(data);
return;
}
alert("上传成功");
}
function Delete() {
if (window.confirm('您确定要删除吗?') == false)
return;
var enName = GetQueryString("EnName");
var en = new Entity(enName, GetPKVal());
//删除相关的设置
var mapExts = new Entities("BP.Sys.MapExts");
mapExts.Retrieve("FK_MapData", en.FK_MapData, "AttrOfOper", en.KeyOfEn);
if (mapExts) {
for (var index = 0; index < mapExts.length; index++) {
var mapExt = new Entity("BP.Sys.MapExt", mapExts[index].MyPK);
mapExt.Delete();
}
}
en = new Entity(enName, GetPKVal());
var rs = en.Delete();
if (rs != null && rs != undefined && rs != '' && rs.indexOf("err@") == -1) {
$("#Btns").html("");
$("#Left").html("");
$("#CCFormTabs").html("删除成功..");
alert("删除成功.");
}
window.close();
CloseIt();
}
function CloseIt() {
if (window.parent && window.parent.$ && window.parent.$(".layui-side").length == 1) {
if (isSameEnName == true) {
//En页面的基础信息删除时关闭页面
try {
window.parent.parent.layer.close(window.parent.parent.layer.index);
return;
}
catch (e) {
return;
}
}
return;
}
//打开的时EnOnly页面
try {
window.parent.layer.close(window.parent.layer.index);
return;
} catch (e) {
return;
}
if (parent.parent != undefined && parent.parent.$("#eudlg").length == 1)
parent.parent.$("#eudlg").dialog('close');
}
$(function () {
var Accordion = function (el, multiple) {
this.el = el || {};
this.multiple = multiple || false;
var links = this.el.find('.link');
links.on('click', { el: this.el, multiple: this.multiple }, this.dropdown)
}
Accordion.prototype.dropdown = function (e) {
var $el = e.data.el;
$this = $(this),
$next = $this.next();
$next.slideToggle();
$this.parent().toggleClass('open');
if (!e.data.multiple) {
$el.find('.submenu').not($next).slideUp().parent().removeClass('open');
};
}
var accordion = new Accordion($('#accordion'), false);
});
var IconKeyOfEn = "";
function openIconWindow(keyOfEn) {
IconKeyOfEn = keyOfEn;
var width = $(document).width() - 120;
OpenLayuiDialog("IconSelect.htm", "选择图标", width, 80, "auto", false);
}
function changeICon(icon) {
//获取ICon的值
var oldICon = $("#TB_" + IconKeyOfEn).val();
$("#menuIconIcon").attr("class", icon);
$("#TB_" + IconKeyOfEn).val(icon);
layer.close(layer.index);
}
function executeFunction(type) {
//执行方法前先保存
var flag = Update(false);
if (flag == false)
return;
var label = "";
var funcStr = "";
if (type == 1) {
label = cfg.EnBtnLab1;
funcStr = cfg.EnBtnJS1;
}
if (type == 2) {
label = cfg.EnBtnLab2;
funcStr = cfg.EnBtnJS2;
}
funcStr = funcStr.replace(/~/g, "'");
if (funcStr.indexOf("/") != -1) {
var W = document.body.clientWidth - 40;
OpenLayuiDialog(funcStr, label, W, 100, "r", false);
} else {
if (funcStr.indexOf('(') == -1)
cceval(funcStr + "()");
else
cceval(funcStr);
}
}
//打开帮助弹窗
function openHelpModal(url) {
var bschitchat = window.open(url, "帮助", 'toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
bschitchat.moveTo(0, 0);
bschitchat.resizeTo(screen.availWidth, screen.availHeight);
bschitchat.outerWidth = screen.availWidth;
bschitchat.outerHeight = screen.availHeight;
//OpenLayuiDialog(url, '帮助', 1000, 100, "auto", true, false, true);
}
</script>
</head>
<body>
<form class="layui-form" enctype="multipart/form-data" method="post" autocomplete=off>
<div id="Btns" style="text-align:right;margin-right:15px">
<button id="Btn_New" type="button" class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" onclick="New()" style="display:none">
<i class="iconfont icon-xinjian"></i> 新建
</button>
<button id="Btn_Save" type="button" class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" onclick="Save()" style="display:none">
<i class="iconfont icon-Save"></i> 保存
</button>
<button id="Btn_Delete" type="button" class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" onclick="Delete()" style="display:none">
<i class="iconfont icon-shanchu1"></i> 删除
</button>
<button id="Btn_Setting" type="button" class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" onclick="Setting()" style="display:none">
<i class="iconfont icon-jurassic_setup-batch"></i> 设置
</button>
</div>
<div class="layui-tab layui-tab-brief" id="CCFormTabs">
</div>
</form>
<script>
$(function () {
if (CustomerNo != "" && CustomerNo != null) {
$("#Btns").find("button").css("border-color", '#184ad4');
$("#Btns").find("button").css("color", '#184ad4');
$("#Btns").find("button").removeClass("layui-border-green");
return;
}
var theme = filterXSS(localStorage.getItem("themeColorInfo"));
if (theme == null || theme == undefined || theme == "")
return;
var data = JSON.parse(theme);
$("#Btns").find("button").css("border-color", data.selectedMenu).css("color", data.selectedMenu);
$("#Btns").find("button").removeClass("layui-border-green");
})
</script>
</body>
</html>