var frmData; var bindDataString = ""; function GenerFrm() { var href = GetHrefUrl(); var urlParam = href.substring(href.indexOf('?') + 1, href.length); urlParam = urlParam.replace('&DoType=', '&DoTypeDel=xx'); var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile_CCForm"); handler.AddUrlData(urlParam); var data = handler.DoMethodReturnString("FrmGener_Init"); if (data.indexOf('err@') == 0) { alert(data); console.log(data); return; } try { frmData = JSON.parse(data); } catch (err) { alert("GenerFrm转换JSON失败:" + data); console.log(data); return; } //设置标题. document.title = frmData.Sys_MapData[0].Name; document.getElementById("title").innerHTML = document.title; //获取没有解析的外部数据源 var uiBindKeys = frmData["UIBindKey"]; if (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; } } } //分组信息. var Sys_GroupFields = frmData.Sys_GroupField; var Fk_MapData = frmData.Sys_MapData[0].No; var node = frmData.WF_Node && frmData.WF_Node.length > 0 ? frmData.WF_Node[0]:null; //遍历循环生成 li var mapAttrsHtml = ""; //加入隐藏字段 var html = ""; $.grep(frmData.Sys_MapAttr, function (item) { return item.UIVisible == 0; }).forEach(function (attr) { var defval = ConvertDefVal(frmData, attr.DefVal, attr.KeyOfEn); html += ""; }); $('#CCForm').append(html); var isZDMobile = $.grep(Sys_GroupFields, function (gf) { return gf.IsZDMobile == 1; }).length > 0 ? true : false; if (isZDMobile == true) mapAttrsHtml += ' "; //展显 $(mapAttrsHtml).appendTo('#CCForm'); if (isZDMobile == true) { $(".mui-table-view:last-child").css("margin-bottom", "0px"); $(".mui-table-view:first-child").css("margin-top", "0px"); } //为 DISABLED 的 TEXTAREA 加TITLE var disabledTextAreas = $('#divCCForm textarea:disabled'); $.each(disabledTextAreas, function (i, obj) { $(obj).attr('title', $(obj).val()); }) mui(".mui-switch").switch(); //监听开关事件 var SW = $('.mui-switch'); $.each(SW, function (i, obj) { var KeyOfEn = $(obj).attr("id"); document.getElementById(KeyOfEn).addEventListener("toggle", function (event) { KeyOfEn = KeyOfEn.substring(3); if (event.detail.isActive) { $("#TB_" + KeyOfEn).val("1"); } else { $("#TB_" + KeyOfEn).val("0"); } }) }) //根据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 enName = frmData.Sys_MapData[0].No; try { var src = "../../DataUser/JSLibData/" + enName + "_Self.js"; loadScript(src); src = "../../DataUser/JSLibData/" + enName + ".js"; loadScript(src); if (frmData.Sys_FrmAttachment.length > 0) { src = "../js/mui/js/feedback-page.js"; loadScript(src); } if (frmData.Sys_FrmImgAth.length > 0) { src = "../js/mui/js/feedback-page.js"; loadScript(src); } } catch (err) { } //根据下拉框、单选按钮的选择设置显示不显示、默认值 //ShowNoticeInputInfo(); //显示tb 提示信息. // ShowTbNoticeInfo(); //初始化复选下拉框 var selectPicker = $('.selectpicker'); $.each(selectPicker, function (i, selectObj) { var defVal = $(selectObj).attr('data-val'); var defValArr = defVal.split(','); $(selectObj).selectpicker('val', defValArr); }); LoadFrmDataAndChangeEleStyle(frmData); //处理下拉框级联等扩展信息 AfterBindEn_DealMapExt(frmData); if (pageData.IsReadonly != 1) { var pickdates = $(".ccformdate"); pickdates.each(function (i, pickdate) { var id = this.getAttribute('id'); if ($("#" + id).html() == '') { $("#" + id).html("

请选择时间

"); } var funcionPK = ""; if ($('#TB_' + id.substr(4)).length != 0) { funcionPK = $('#TB_' + id.substr(4)).attr("data-funcionPK"); } if (bindDataString.indexOf(id.replace('LAB_', '')) == -1) { pickdate.addEventListener('tap', function () { var _self = this; var optionsJson = this.getAttribute('data-options') || '{}'; var options = JSON.parse(optionsJson); if (options.type == 0) { options.type = "date";//yyyy-MM-dd } else if (options.type == 1) { options.type = "date-time";//yyyy-MM-dd HH:mm } else if (options.type == 2) { options.type = "datetime";//yyyy-MM-dd HH:mm:ss } else if (options.type == 3) { options.type = "month";//yyyy-MM } else if (options.type == 4) { options.type = "time-min";//HH:mm } else if (options.type == 5) { options.type = "time";//HH:mm:ss } else if (options.type == 6) { options.type = "month-day";//MM-dd } else if (options.type == 7) { options.type = "year";//yyyy } var id = this.getAttribute('id'); /* * 首次显示时实例化组件 * 示例为了简洁,将 options 放在了按钮的 dom 上 * 也可以直接通过代码声明 optinos 用于实例化 DtPicker */ _self.picker = new mui.DtPicker(options); _self.picker.show(function (rs) { /* * rs.value 拼合后的 value * rs.text 拼合后的 text * rs.y 年,可以通过 rs.y.vaue 和 rs.y.text 获取值和文本 * rs.m 月,用法同年 * rs.d 日,用法同年 * rs.h 时,用法同年 * rs.i 分(minutes 的第二个字母),用法同年 */ /* * 返回 false 可以阻止选择框的关闭 * return false; */ /* * 释放组件资源,释放后将将不能再操作组件 * 通常情况下,不需要示放组件,new DtPicker(options) 后,可以一直使用。 * 当前示例,因为内容较多,如不进行资原释放,在某些设备上会较慢。 * 所以每次用完便立即调用 dispose 进行释放,下次用时再创建新实例。 */ $("#" + id).html(rs.text); $("#TB_" + id.substr(4)).val(rs.text); _self.picker.dispose(); _self.picker = null; if (funcionPK != null && funcionPK != "") { var bindFunctionExt = new Entity("BP.Sys.MapExt", funcionPK); doc = bindFunctionExt.Doc; if (doc != null && doc != "") { DBAccess.RunFunctionReturnStr(doc); } } }); }, false); } }); } $.each($(".mui-attr-btn"), function (idx, item) { $(this).on("tap", function () { var keyOfEn = item.id.substring(4); var mapAttr = $.grep(frmData.Sys_MapAttr, function (attr) { return attr.KeyOfEn == keyOfEn; })[0]; var tag = mapAttr.Tag||""; if (tag != "") tag = DealExp(tag); if (mapAttr.UIIsEnable == 1) { //执行js DBAccess.RunUrlReturnString(tag); } if (mapAttr.UIIsEnable == 2) DBAccess.RunFunctionReturnStr(tag); if (mapAttr.UIIsEnable != 0 && pageData.IsReadonly!=1) FullIt("", mapAttr.MyPK + "_FullData", "Btn_" + mapAttr.KeyOfEn, 0); }) }) } function Change() { var btn = document.getElementById('Btn_Save'); if (btn != null) { if (btn.value.valueOf('*') == -1) btn.value = btn.value + '*'; } } //以下是软通写的 //初始化网页URL参数 function initPageParam() { //新建独有 pageData.UserNo = GetQueryString("UserNo"); pageData.DoWhat = GetQueryString("DoWhat"); pageData.IsMobile = GetQueryString("IsMobile"); pageData.FK_Flow = GetQueryString("FK_Flow"); pageData.FK_Node = GetQueryString("FK_Node"); pageData.FID = GetQueryString("FID") == null ? 0 : GetQueryString("FID"); pageData.WorkID = GetQueryString("WorkID"); pageData.IsRead = GetQueryString("IsRead"); pageData.T = GetQueryString("T"); pageData.Paras = GetQueryString("Paras"); pageData.IsReadonly = GetQueryString("IsReadOnly"); //如果是IsReadOnly,就表示是查看页面,不是处理页面 pageData.IsStartFlow = GetQueryString("IsStartFlow"); //是否是启动流程页面 即发起流程 pageData.DoType1 = GetQueryString("DoType")//View } //将获取过来的URL参数转成URL中的参数形式 & function pageParamToUrl() { var paramUrlStr = ''; for (var param in pageData) { paramUrlStr += '&' + (param.indexOf('@') == 0 ? param.substring(1) : param) + '=' + pageData[param]; } return paramUrlStr; } //设置附件为只读 function setAttachDisabled() { //附件设置 var attachs = $('iframe[src*="AttachmentUpload.htm"]'); $.each(attachs, function (i, attach) { if (attach.src.indexOf('IsReadOnly') == -1) { $(attach).attr('src', $(attach).attr('src') + "&IsReadOnly=1"); } }) } //设置表单元素不可用 function setFormEleDisabled() { //文本框等设置为不可用 $('#divCCForm textarea').attr('disabled', 'disabled'); $('#divCCForm select').attr('disabled', 'disabled'); $('#divCCForm input[type!=button]').attr('disabled', 'disabled'); } //初始化附件内容. function InitAth(workNodeData, gf) { var athDBs = workNodeData.Sys_FrmAttachmentDB; if (athDBs.length == 0) return "无"; var html = ""; return html; } //明细表 function InitDtl(frmData, gf, isZDMobile) { var dtlHtml = ""; if (isZDMobile == false) { } //mapAttrsHtml += "
" + gf.Lab + "
"; else { dtlHtml += "
  • " + gf.Lab + ""; dtlHtml += "
    "; } if (frmData.Sys_MapDtl) { $.each(frmData.Sys_MapDtl, function (i, dtl) { loadScript("../DataUser/JSLibData/" + dtl.No + "_Self.js"); if (gf.CtrlID == dtl.No) { if (dtl.ListShowModel == "2") { if (dtl.UrlDtl == null || dtl.UrlDtl == undefined || dtl.UrlDtl == "") { dtlHtml += "
    "; dtlHtml += "从表" + dtl.Name + "没有设置URL,请在" + dtl.FK_MapData + "_Self.js中解析"; dtlHtml += "
    "; return dtlHtml; } var func = "TurnTo_Dtl(\"" + dtl.No + "\",\"" + dtl.UrlDtl + "\",\"" + dtl.FK_MapData + "\")"; dtlHtml += ""; return; } if (dtl.MobileShowModel == undefined || dtl.MobileShowModel == 0) { var func = "Dtl_ShowPage(\"" + dtl.No + "\",\"" + dtl.Name + "\")"; dtlHtml += ""; return; } //列表模式展示 if (dtl.MobileShowModel == 1) { dtlHtml = GetDtlList(dtl.No); } } }); } return dtlHtml; } window.onresize = function () { if (pageData.Col == 8) { if (jsonStr != undefined && jsonStr != '') { var workNodeData = JSON.parse(jsonStr); //设置CCFORM的表格宽度 if (document.body.clientWidth > 992) {//处于中屏时设置宽度最小值 $('#CCForm').css('min-width', workNodeData.Sys_MapData[0].TableWidth); } else { $('#CCForm').css('min-width', 0); } } } } //逻辑类型、数据类型、控件类型 var FieldTypeS = { Normal: 0, Enum: 1, FK: 2, WinOpen: 3 }, FormDataType = { AppString: 1, AppInt: 2, AppFloat: 3, AppBoolean: 4, AppDouble: 5, AppDate: 6, AppDateTime: 7, AppMoney: 8, AppRate: 9 }, UIContralType = { TB: 0, DDL: 1, CheckBok: 2, RadioBtn: 3, MapPin: 4, MicHot: 5 }; //逻辑类型、数据类型、控件类型 var FieldTypeS = { Normal: 0, Enum: 1, FK: 2, WinOpen: 3 }, FormDataType = { AppString: 1, AppInt: 2, AppFloat: 3, AppBoolean: 4, AppDouble: 5, AppDate: 6, AppDateTime: 7, AppMoney: 8, AppRate: 9 }, UIContralType = { TB: 0, DDL: 1, CheckBok: 2, RadioBtn: 3, MapPin: 4, MicHot: 5 }; //解析表单字段 MapAttr function InitMapAttr(Sys_MapAttr, groupID) { var _html = ""; $.grep(Sys_MapAttr, function (item) { return ((item.IsEnableInAPP != 0 && item.UIVisible != 0)) && item.GroupID == groupID; }).forEach(function (attr) { //图片签名 if (attr.IsSigan == "1") { _html += "
    "; _html += FormUtils.CreateSignPicture(attr); _html += "
    "; return; } if (attr.UIContralType == 16 && attr.UIIsEnable == "1") return; //加载其他数据控件 switch (attr.LGType) { case FieldTypeS.Normal: //输出普通类型字段 if (attr.UIContralType == UIContralType.DDL) { //判断外部数据或WS类型. _html += "
    "; _html += FormUtils.CreateDDLPK(attr); break; } switch (attr.MyDataType) { case FormDataType.AppString: _html += FormUtils.CreateTBString(attr); break; case FormDataType.AppInt: _html += "
    "; _html += FormUtils.CreateTBInt(attr); break; case FormDataType.AppFloat: case FormDataType.AppDouble: case FormDataType.AppMoney: _html += "
    "; _html += FormUtils.CreateTBFloat(attr); break; case FormDataType.AppDate: //日期\boolen型的不允许获取焦点,所以只能禁用 _html += "
    "; _html += FormUtils.CreateTBDate(attr); break; case FormDataType.AppDateTime: //日期\boolen型的不允许获取焦点,所以只能禁用 _html += "
    "; _html += FormUtils.CreateTBDateTime(attr); break; case FormDataType.AppBoolean: //日期\boolen型的不允许获取焦点,所以只能禁用 _html += "
    "; _html += FormUtils.CreateCBBoolean(attr); break; } break; case FieldTypeS.Enum: //枚举值下拉框 if (attr.Name.length >= 10) { var ctrl_ID = "DDL_" + attr.KeyOfEn; _html += "
    "; var mustInput = attr.UIIsInput == 1 ? '*' : ""; _html += ""; _html += ""; } else { _html += "
    "; _html += FormUtils.CreateDDLEnum(attr); } break; case FieldTypeS.FK: //外键表下拉框 if (attr.Name.length >= 10) { _html += FormUtils.CreateDDLPK(attr); } else { _html += "
    "; _html += FormUtils.CreateDDLPK(attr); } break; case FieldTypeS.WinOpen: //打开系统页面 _html += "
    "; switch (item.UIContralType) { case UIContralType.MapPin: //地图定位 _html += FormUtils.CreateMapPin(attr); break; case UIContralType.MicHot: //语音控件 _html += FormUtils.CreateMicHot(attr); break; } break; } _html += "
    "; }); return _html; } var FormUtils = { CreateSignPicture: function (attr) { //图片签名+oitw "kyrw \[i6514 var val = ConvertDefVal(frmData, attr.DefVal, attr.KeyOfEn); var html_Sign = ""; html_Sign += "
    "; if (webUser.CCBPMRunModel == 2) html_Sign += ""; else html_Sign += ""; html_Sign += "
    "; return html_Sign; }, CreateTBString: function (attr) { var html_string = ""; if (attr.Tip == "") attr.Tip = "请输入"; if (attr.UIIsEnable == "0") strPlaceholder = ""; var mustInput = attr.UIIsInput == 1 ? '*' : ""; //启用二维码 if (attr.IsEnableQrCode && attr.IsEnableQrCode == "1") { html_string += "
    "; strPlaceholder = "通过扫一扫添加"; Form_Ext_Function += "$('#Btn_" + attr.KeyOfEn + "').on('tap', function () { QrCodeToInput('TB_" + attr.KeyOfEn + "'); });" html_string += ""; html_string += "
    "; html_string += "
    "; html_string += " "; html_string += "
    "; html_string += "
    "; html_string += "
    "; html_string += " "; html_string += "
    "; html_string += "
    "; html_string += "
    "; return html_string; } //大文本备注信息解析 if (attr.UIContralType == 60) { html_string += "
    "; var filename = basePath + "/DataUser/CCForm/BigNoteHtmlText/" + attr.FK_MapData + ".htm"; var htmlobj = $.ajax({ url: filename, async: false }); var str = htmlobj.responseText; if (htmlobj.status == 404) str = ""; html_string += str; html_string += "
    "; return html_string; } if (attr.UIContralType == 16 && attr.UIIsEnable == "0") { loadScript("http://res.wx.qq.com/open/js/jweixin-1.2.0.js?Version=" + Math.random()); html_string += "
    "; html_string += ""; html_string += "
    "; return html_string; } if (attr.UIContralType == 18) { //按钮操作 html_string += "
    "; html_string += ""; html_string += "
    "; return html_string; } //多行文本 if (attr.UIHeight > 30 && attr.ColSpan > 1) { html_string += "
    "; html_string += ""; if (attr.UIIsEnable == "0") html_string += "
    "; else html_string += ""; return html_string; } //单行文本 if (attr.UIIsInput == 1 && attr.UIIsEnable == 1 && attr.UIContralType != 12) { html_string += "
    "; html_string += ""; } else if (attr.UIIsEnable == 1 && attr.UIContralType != 12) { html_string += "
    "; html_string += ""; } else if (attr.UIIsEnable == "0" && attr.UIContralType != 12) { html_string += "
    "; html_string += ""; } //身份证件解析增加一个 if (attr.UIContralType == 13 && attr.KeyOfEn == "IDCardName") { html_string += "
    "; } else if (attr.UIContralType == 12) { html_string += "
    " + attr.Name + "
    "; html_string += InitEleAth(frmData, attr.Name, attr.FK_MapData, attr.KeyOfEn); } else if (attr.UIIsEnable == "0") { html_string += ""; } else { html_string += ""; } return html_string; }, CreateTBInt: function (attr) { var mustInput = attr.UIIsInput == 1 ? '*' : ""; var inputHtml = ""; inputHtml += ""; else inputHtml += " name=\"TB_" + attr.KeyOfEn + "\" id=\"TB_" + attr.KeyOfEn + "\" placeholder='0' />"; return inputHtml; }, CreateTBFloat: function (attr) { var attrdefVal = attr.DefVal; var bit; if (attrdefVal != null && attrdefVal !== "" && attrdefVal.indexOf(".") >= 0) bit = attrdefVal.substring(attrdefVal.indexOf(".") + 1).length; else bit = 2; var event = ""; if (attr.UIIsEnable == "1" && pageData.IsReadonly != 1) { if (attr.MyDataType == 8) event = " onkeyup=\"valitationAfter(this, 'money');limitLength(this," + bit + "); FormatMoney(this, " + bit + ", ',')\""; else event = " onkeyup=\"valitationAfter(this, 'float');if(isNaN(value)) execCommand('undo');limitLength(this," + bit + ");\"" + " onafterpaste=\"valitationAfter(this, 'float');if(isNaN(value))execCommand('undo');\""; } var mustInput = attr.UIIsInput == 1 ? '*' : ""; var inputHtml = ""; if (attr.UIIsEnable == "1" && pageData.IsReadonly != 1) { var step = GetPara(attr.AtPara, "NumStepLength"); step = step == null || step == undefined ? 0.1 : parseFloat(step); var minNum = GetPara(attr.AtPara, "NumMin") || ""; var maxNum = GetPara(attr.AtPara, "NumMax") || ""; var dataInfo = ""; if (minNum != "") dataInfo = " data-numbox-min='" + minNum + "'"; if (maxNum != "") dataInfo += " data-numbox-max='" + maxNum + "'"; inputHtml += "
    "; inputHtml += ""; } if (attr.DefValType == 0) inputHtml += ""; else inputHtml += ""; if (attr.UIIsEnable == "1" && pageData.IsReadonly != 1) { inputHtml += ""; inputHtml += "
    "; } return inputHtml; }, CreateTBDate: function (attr) { var mustInput = attr.UIIsInput == 1 ? '*' : ""; var inputHtml = ""; if (attr.UIIsEnable == "0") { inputHtml += ""; } else { inputHtml += ""; inputHtml += " "; inputHtml += ""; inputHtml += ""; } return inputHtml; }, CreateTBDateTime: function (attr) { var mustInput = attr.UIIsInput == 1 ? '*' : ""; var inputHtml = ""; if (attr.UIIsEnable == "0") { inputHtml += ""; } else { inputHtml += ""; inputHtml += " "; inputHtml += ""; inputHtml += ""; } return inputHtml; }, CreateCBBoolean: function (attr) { var checkBoxVal = ""; var keyOfEn = attr.KeyOfEn; var CB_Html = ""; CB_Html += " "; CB_Html += " "; if (attr.UIIsEnable == "0") CB_Html += "
    "; else CB_Html += "
    "; CB_Html += "
    "; CB_Html += "
    "; //CB_Html += " "; return CB_Html; }, CreateDDLEnum: function (attr) { //下拉框和单选都使用下拉框实现 var mustInput = attr.UIIsInput == 1 ? '*' : ""; var ctrl_ID = "DDL_" + attr.KeyOfEn; var html_Select = ""; html_Select += ""; return html_Select; }, CreateDDLPK: function (attr) { var mustInput = attr.UIIsInput == 1 ? '*' : ""; var html_Select = ""; html_Select += "  "; return html_Select; }, CreateMapPin: function (attr) { loadScript("http://api.map.baidu.com/api?v=2.0&ak=rgwS2tQzfT9dX21CvZkyTE2eQ1D0vDWh&Version=" + Math.random()); loadScript("http://developer.baidu.com/map/jsdemo/demo/convertor.js?Version=" + Math.random()); var html_MapPin = ""; //展示内容 html_MapPin += "
    "; if (this.Enable == false) { html_MapPin += ""; } else { html_MapPin += ""; } html_MapPin += ""; html_MapPin += "
    "; //数据控件 html_MapPin += ""; //地图定位 return html_MapPin; }, CreateMicHot: function (attr) { var html_MicHot = ""; var bDelete = this.Enable; //展示内容 html_MicHot += "
    "; if (this.Enable == false) { html_MicHot += ""; } else { html_MicHot += ""; } html_MicHot += ""; html_MicHot += "
    "; html_MicHot += "


    "; html_MicHot += "
    "; //获取历史语音 var args = new RequestArgs(); var keyOfEn = attr.KeyOfEn; html_MicHot += "
    "; //语音 return html_MicHot; } }; function InitMapAttrOfCtrl(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) { //多选下拉框 var isMultiSele = ""; var isMultiSeleClass = ""; // if (mapAttr.UIIsMultiple != undefined && mapAttr.UIIsMultiple == 1) { // isMultiSele = ' multiple data-live-search="false" '; // isMultiSeleClass = " selectpicker show-tick form-control "; // } eleHtml += ""; } else { //添加文本框 ,日期控件等 //AppString if (mapAttr.MyDataType == "1" && mapAttr.LGType != "2") {//不是外键 if (mapAttr.UIContralType == "1") {//DDL 下拉列表框 //多选下拉框 var isMultiSele = ""; var isMultiSeleClass = ""; // if (mapAttr.UIIsMultiple != undefined && mapAttr.UIIsMultiple == 1) { // isMultiSele = ' multiple data-live-search="false" '; // isMultiSeleClass = " selectpicker show-tick form-control "; // } eleHtml += ""; } else { //文本区域 if (mapAttr.UIHeight <= 23 || 1 == 1) { eleHtml += "" ; } } } //AppDate else if (mapAttr.MyDataType == 6) {//AppDate var enableAttr = ''; if (mapAttr.UIIsEnable == 0) { enableAttr = "disabled='disabled'"; } var inputHtml = ""; //inputHtml += ""; eleHtml += inputHtml; } else if (mapAttr.MyDataType == 7) {// AppDateTime = 7 var enableAttr = ''; if (mapAttr.UIIsEnable == 1) { // enableAttr = 'onfocus="WdatePicker({dateFmt:' + "'yyyy-MM-dd HH:mm'})" + '";'; enableAttr = ''; } else { enableAttr = "disabled='disabled'"; } eleHtml += ""; } else if (mapAttr.MyDataType == 4) { // AppBoolean = 7 var CB_Html = ""; eleHtml += CB_Html; } if (mapAttr.MyDataType == 2 && mapAttr.LGType == 1) { //AppInt Enum if (mapAttr.UIContralType == 1) { //DDL eleHtml += ""; } } // AppDouble AppFloat if (mapAttr.MyDataType == 5 || mapAttr.MyDataType == 3) { var enableAttr = ''; if (mapAttr.UIIsEnable == 1) { } else { enableAttr = "disabled='disabled'"; } eleHtml += ""; } if ((mapAttr.MyDataType == 2 && mapAttr.LGType != 1)) {//AppInt var enableAttr = ''; if (mapAttr.UIIsEnable == 1) { } else { enableAttr = "disabled='disabled'"; } eleHtml += ""; } //AppMoney AppRate if (mapAttr.MyDataType == 8) { var enableAttr = ''; if (mapAttr.UIIsEnable == 1) { } else { enableAttr = "disabled='disabled'"; } eleHtml += ""; } } } else { //展示附件信息 FREE 不需要 return; // var atParamObj = AtParaToJson(mapAttr.AtPara); // if (atParamObj.AthRefObj != undefined) {//扩展设置为附件展示 // eleHtml += "" + ""; // defValue = defValue != undefined && defValue != '' ? defValue : ' '; // if (defValue.indexOf('@AthCount=') == 0) { // defValue = "附件" + "" + defValue.substring('@AthCount='.length, defValue.length) + "个"; // } else { // defValue = defValue; // } // eleHtml += "
    " + defValue + "
    "; // } } if (islabelIsInEle == false) { //eleHtml = '
    " + //(mapAttr.UIIsInput == 1 ? '*' : "") //+ "
    " + eleHtml; //先把 必填项的 * 写到元素后面 可能写到标签后面更合适 //eleHtml += mapAttr.UIIsInput == 1 ? '*' : ""; } } else { var value = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn); if (value == undefined) { value = ''; } else { //value = value.toString().replace(/:/g, ':').replace(/【/g, '[').replace(/】/g, ']').replace(/(/g, '(').replace(/)/g, ')').replace(/{/g, '{').replace(/}/g, '}'); } //hiddenHtml += ""; } //eleHtml = "
    " + eleHtml + "
    "; return eleHtml; // alert(eleHtml); eleHtml = $('
    ' + eleHtml + '
    '); eleHtml.children(0).css('width', mapAttr.UIWidth).css('height', mapAttr.UIHeight); //eleHtml.css('position', 'absolute').css('top', mapAttr.Y - 10).css('left', mapAttr.X); if (mapAttr.UIIsEnable == "0") { enableAttr = eleHtml.find('[name=TB_' + mapAttr.KeyOfEn + ']').attr('disabled', true); enableAttr = eleHtml.find('[name=DDL_' + mapAttr.KeyOfEn + ']').attr('disabled', true); } return eleHtml; } //初始化下拉列表框的OPERATION function InitDDLOperation(frmData, mapAttr, defVal) { var operations = ''; var data = frmData[mapAttr.KeyOfEn]; if (data == undefined) data = frmData[mapAttr.UIBindKey]; if (data == undefined) { //枚举类型的. if (mapAttr.LGType == 1) { var enums = frmData.Sys_Enum; enums = $.grep(enums, function (value) { return value.EnumKey == mapAttr.UIBindKey; }); if (mapAttr.DefVal == -1) operations += ""; $.each(enums, function (i, obj) { operations += ""; }); } return operations; } if (data == undefined) { return operations; } $.each(data, function (i, obj) { operations += ""; }); return operations; } //填充默认数据 function ConvertDefVal(workNodeData, defVal, keyOfEn) { var pageParams = getQueryString(); var pageParamObj = {}; $.each(pageParams, function (i, pageParam) { if (pageParam.indexOf('@') == 0) { var pageParamArr = pageParam.split('='); pageParamObj[pageParamArr[0].substring(1, pageParamArr[0].length)] = pageParamArr[1]; } }); var result = defVal; //通过MAINTABLE返回的参数 for (var ele in workNodeData.MainTable[0]) { if (keyOfEn == ele && workNodeData.MainTable[0] != '') { result = workNodeData.MainTable[0][ele]; break; } } var result = unescape(result); if (result == "null") result = ""; return result; } var workNodeData = {}; //将#FF000000 转换成 #FF0000 function TranColorToHtmlColor(color) { if (color != undefined && color.indexOf('#') == 0 && color.length == 9) { color = color.substring(0, 7); } return color; } function analysisFontStyle(ele, fontStyle, isBold, isItalic) { if (fontStyle != undefined && fontStyle.indexOf(':') > 0) { var fontStyleArr = fontStyle.split(';'); $.each(fontStyleArr, function (i, fontStyleObj) { ele.css(fontStyleObj.split(':')[0], TranColorToHtmlColor(fontStyleObj.split(':')[1])); }); } else { if (isBold == 1) { ele.css('font-weight', 'bold'); } if (isItalic == 1) { ele.css('font-style', 'italic') } } } function ImgAth(url, athMyPK) { var v = window.showModalDialog(url, 'ddf', 'dialogHeight: 650px; dialogWidth: 950px;center: yes; help: no'); if (v == null) return; document.getElementById('Img' + athMyPK).setAttribute('src', v); } //初始化 IMAGE附件 function figure_Template_ImageAth(frmImageAth) { var isEdit = frmImageAth.IsEdit; var eleHtml = $("
    "); var img = $(""); var imgSrc = "/WF/Data/Img/LogH.PNG"; //获取数据 if (workNodeData.Sys_FrmImgAthDB) { $.each(workNodeData.Sys_FrmImgAthDB, function (i, obj) { if (obj.FK_FrmImgAth == frmImageAth.MyPK) { imgSrc = obj.FileFullName; } }); } //设计属性 img.attr('id', 'Img' + frmImageAth.MyPK).attr('name', 'Img' + frmImageAth.MyPK); img.attr("src", imgSrc).attr('onerror', "this.src='/WF/Data/Img/LogH.PNG'"); img.css('width', frmImageAth.W).css('height', frmImageAth.H).css('padding', "0px").css('margin', "0px").css('border-width', "0px"); //不可编辑 if (isEdit == "1") { var fieldSet = $("
    "); var length = $(""); var a = $(""); var url = "/WF/CCForm/ImgAth.aspx?W=" + frmImageAth.W + "&H=" + frmImageAth.H + "&FK_MapData=ND" + pageData.FK_Node + "&MyPK=" + pageData.WorkID + "&ImgAth=" + frmImageAth.MyPK; a.attr('href', "javascript:ImgAth('" + url + "','" + frmImageAth.MyPK + "');").html("编辑"); length.css('font-style', 'inherit').css('font-weight', 'bold').css('font-size', '12px'); fieldSet.append(length); length.append(a); fieldSet.append(img); eleHtml.append(fieldSet); } else { eleHtml.append(img); } eleHtml.css('position', 'absolute').css('top', frmImageAth.Y).css('left', frmImageAth.X); return eleHtml; } //初始化 附件. function figure_Template_Attachment(frmAttachment) { var eleHtml = ''; var ath = frmAttachment; if (ath.UploadType == 0) {//单附件上传 L4204 return $(''); } var src = ""; if (pageData.IsReadonly) src = "./CCForm/AttachmentUpload.htm?PKVal=" + pageData.WorkID + "&Ath=" + ath.NoOfObj + "&FK_MapData=" + ath.FK_MapData + "&FK_FrmAttachment=" + ath.MyPK + "&IsReadonly=1"; else src = "./CCForm/AttachmentUpload.htm?PKVal=" + pageData.WorkID + "&Ath=" + ath.NoOfObj + "&FK_MapData=" + ath.FK_MapData + "&FK_FrmAttachment=" + ath.MyPK; eleHtml += '
    ' + "" + '
    '; eleHtml = $(eleHtml); eleHtml.css('position', 'absolute').css('top', ath.Y).css('left', ath.X).css('width', ath.W).css('height', ath.H); return eleHtml; } function addLoadFunction(id, eventName, method) { var js = ""; js = ""; return $(js); } var appPath = "../../"; var DtlsCount = " + dtlsCount + "; //应该加载的明细表数量 //初始化从表 function figure_Template_Dtl(frmDtl) { var eleHtml = $("
    "); var paras = this.pageData; var strs = ""; for (var str in paras) { if (str == "EnsName" || str == "RefPKVal" || str == "IsReadonly") continue else strs += "&" + str + "=" + paras[str]; } var src = ""; var href = GetHrefUrl(); var urlParam = href.substring(href.indexOf('?') + 1, href.length); urlParam = urlParam.replace('&DoType=', '&DoTypeDel=xx'); if (frmDtl.DtlShowModel == "0") { if (pageData.IsReadonly) { src = "./CCForm/Dtl.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=1&" + urlParam + "&Version=" + load.Version; } else { src = "./CCForm/Dtl.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=0&" + urlParam + "&Version=" + load.Version; } } else if (frmDtl.DtlShowModel == "1") { if (pageData.IsReadonly) src = appPath + "WF/CCForm/DtlCard.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=1" + strs; else src = appPath + "WF/CCForm/DtlCard.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=0" + strs; } var eleIframe = ''; eleIframe = $(""); if (pageData.IsReadonly) { } else { if (frmDtl.DtlSaveModel == 0) { eleHtml.append(addLoadFunction(frmDtl.No, "blur", "SaveDtl")); eleIframe.attr('onload', frmDtl.No + "load()"); } } eleHtml.append(eleIframe); //added by liuxc,2017-1-10,此处前台JS中增加变量DtlsLoadedCount记录明细表的数量,用于加载完全部明细表的判断 var js = ""; if (!pageData.IsReadonly) { js = ""; eleHtml.append($(js)); } return eleHtml; } //初始化轨迹图 function figure_Template_FigureFlowChart(wf_node) { //轨迹图 var sta = wf_node.FrmTrackSta; var x = wf_node.FrmTrack_X; var y = wf_node.FrmTrack_Y; var h = wf_node.FrmTrack_H; var w = wf_node.FrmTrack_W; if (sta == 0) { return $(''); } if (sta == undefined) { return; } var src = "./WorkOpt/OneWork/OneWork.htm?CurrTab=Track"; src += '&FK_Flow=' + pageData.FK_Flow; src += '&FK_Node=' + pageData.FK_Node; src += '&WorkID=' + pageData.WorkID; src += '&FID=' + pageData.FID; var eleHtml = '
    ' + "" + '
    '; eleHtml = $(eleHtml); eleHtml.css('position', 'absolute').css('top', y).css('left', x).css('width', w).css('height', h); return eleHtml; } //审核组件 function figure_Template_FigureFrmCheck(wf_node) { var sta = wf_node.FWCSta; if (sta == 0) return $(''); var src = "./WorkOpt/WorkCheck.htm?s=2"; var fwcOnload = ""; var paras = ''; paras += "&FID=" + pageData["FID"]; paras += "&OID=" + pageData["WorkID"]; paras += '&FK_Flow=' + pageData.FK_Flow; paras += '&FK_Node=' + pageData.FK_Node; paras += '&WorkID=' + pageData.WorkID; if (sta == 2)//只读 { src += "&DoType=View"; } else { fwcOnload = "onload= 'WC" + wf_node.NodeID + "load();'"; $('body').append(addLoadFunction("WC" + wf_node.NodeID, "blur", "SaveDtl")); } src += "&r=q" + paras; var eleHtml = '
    ' + "" + '
    '; eleHtml = $(eleHtml); return eleHtml; } //子流程 function figure_Template_FigureSubFlowDtl(wf_node) { var sta = wf_node.SFSta; var h = wf_node.SF_H; if (sta == 0) return $(''); var src = "./WorkOpt/SubFlow.htm?s=2"; var fwcOnload = ""; var paras = ''; paras += "&FID=" + pageData["FID"]; paras += "&OID=" + pageData["WorkID"]; paras += '&FK_Flow=' + pageData.FK_Flow; paras += '&FK_Node=' + pageData.FK_Node; paras += '&WorkID=' + pageData.WorkID; if (sta == 2)//只读 { src += "&DoType=View"; } else { fwcOnload = "onload= 'WC" + wf_node.NodeID + "load();'"; $('body').append(addLoadFunction("WC" + wf_node.NodeID, "blur", "SaveDtl")); } src += "&r=q" + paras; var eleHtml = '
    ' + "" + '
    '; eleHtml = $(eleHtml); return eleHtml; } //初始化框架 function figure_Template_IFrame(fram) { var eleHtml = ''; var src = dealWithUrl(fram.src) + "IsReadOnly=0"; eleHtml = $('
    ' + '
    '); var iframe = $(""); eleHtml.append(iframe); return eleHtml; } var colVisibleJsonStr = '' var jsonStr = ''; $(function () { initPageParam(); //初始化参数 GenerFrm(); //表单数据.ajax }); function BackToHome() { SetHref('../CCMobilePortal/Home.htm?UserNo=' + GetQueryString('UserNo') + "&Token=" + GetQueryString("Token")); } function BackToTodolist() { SetHref('../CCMobilePortal/Todolist.htm?UserNo=' + GetQueryString('UserNo') + "&Token=" + GetQueryString("Token")); } function BackToStart() { SetHref('../CCMobilePortal/Start.htm?UserNo=' + GetQueryString('UserNo') + "&Token=" + GetQueryString("Token")); }