//将v1版本表单元素转换为v2 杨玉慧 silverlight 自由表单转化为H5表单 function GenerFrm() { var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner"); handler.AddUrlData(); var data = handler.DoMethodReturnString("FrmView_Init"); //执行保存方法. if (data.indexOf('err@') == 0) { mui.alert(data); return; } jsonStr = data; var gengerWorkNode = {}; var flow_Data; try { flow_Data = JSON.parse(data); frmData = flow_Data; } catch (err) { mui.alert("GenerFrm转换JSON失败:" + jsonStr); return; } //获取没有解析的外部数据源 var uiBindKeys = flow_Data["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; } } } //定义常用的变量. //设置标题. document.getElementById("title").innerHTML = "表单预览"; BindFrm(frmData); } //绑定表单. function BindFrm(frmData) { //分组信息. var Sys_GroupFields = frmData.Sys_GroupField; var Fk_MapData = frmData.Sys_MapData[0].No; //var node = frmData.WF_Node[0]; //加入隐藏字段 var mapAttrsHtml = ""; $.grep(frmData.Sys_MapAttr, function (item) { return item.IsEnableInAPP == "0"; }).forEach(function (attr) { var defval = ConvertDefVal(frmData.MainTable[0], attr.DefVal, attr.KeyOfEn); mapAttrsHtml += ""; }); $('#CCForm').append(mapAttrsHtml); //遍历循环生成 li var node = new Entity("BP.WF.Node"); var fk_node = GetQueryString("FK_Node"); if (fk_node != null && fk_node != undefined && fk_node != "0" && fk_node != "null") { node.SetPKVal(fk_node); node.Retrieve(); } for (var i = 0; i < Sys_GroupFields.length; i++) { var gf = Sys_GroupFields[i]; if (gf.CtrlType == 'FWC' && node.FWCSta == 0) { continue; } if (gf.CtrlType != 'Ath') mapAttrsHtml += "
" + gf.Lab + "
"; //附件类的控件. if (gf.CtrlType == 'Ath') { mapAttrsHtml += InitAth(frmData, gf); continue; } //明细表的控件. if (gf.CtrlType == 'Dtl') { mapAttrsHtml += InitDtl(frmData, gf); continue; } //字段类的控件. if (gf.CtrlType == '' || gf.CtrlType == null) { mapAttrsHtml += InitMapAttr(frmData.Sys_MapAttr, gf.OID); continue; } } //展显 $(mapAttrsHtml).appendTo('#CCForm'); //日期控件 mui(".mui-input-row").on("tap", ".ccformdate", function () { var dDate = new Date(); var optionsJson = this.getAttribute('data-options') || '{}'; var ctrID = this.getAttribute('id'); var options = JSON.parse(optionsJson); var picker = new mui.DtPicker(options); picker.show(function (rs) { var timestr = rs.text; $("#" + ctrID).html(timestr); picker.dispose(); }); }); //为 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")); } }); //mui(".mui-switch").switch();//注掉:开关按钮不可编辑 var enName = frmData.Sys_MapData[0].No; try { ////加载JS文件 var s = document.createElement('script'); s.type = 'text/javascript'; s.src = basePath+"/DataUser/JSLibData/" + enName + "_Self.js"; var tmp = document.getElementsByTagName('script')[0]; tmp.parentNode.insertBefore(s, tmp); } catch (err) { } if (frmData.Sys_FrmAttachment.length > 0) { try { var s = document.createElement('script'); s.type = 'text/javascript'; s.src = "./js/mui/js/feedback-page.js"; var tmp = document.getElementsByTagName('script')[0]; tmp.parentNode.insertBefore(s, tmp); } catch (err) { } } //设置默认值 for (var j = 0; j < frmData.Sys_MapAttr.length; j++) { var mapAttr = frmData.Sys_MapAttr[j]; //添加 label //如果是整行的需要添加 style='clear:both'. var defValue = ConvertDefVal(frmData.MainTable[0], mapAttr.DefVal, mapAttr.KeyOfEn); if ($('#TB_' + mapAttr.KeyOfEn).length == 1) { if (defValue == "1") { //判断是否存在mui-active这个类 if ($("#SW_" + mapAttr.KeyOfEn).hasClass("mui-active") == false) $("#SW_" + mapAttr.KeyOfEn).addClass("mui-active"); } else { //判断是否存在mui-active这个类 if ($("#SW_" + mapAttr.KeyOfEn).hasClass("mui-active") == true) $("#SW_" + mapAttr.KeyOfEn).removeClass("mui-active"); } $('#TB_' + mapAttr.KeyOfEn).val(defValue); $('#TB_' + mapAttr.KeyOfEn).html(defValue);//只读大文本放到div里 } if ($('#DDL_' + mapAttr.KeyOfEn).length == 1) { $('#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 (pageData.IsReadonly != "1") { // AfterBindEn_DealMapExt(frmData); } //设置为只读模式 setFormEleDisabled(); } function Change() { var btn = document.getElementById('Btn_Save'); if (btn != null) { if (btn.value.valueOf('*') == -1) btn.value = btn.value + '*'; } } function To(url) { //window.location.href = filterXSS(url); window.name = "dialogPage"; window.open(url, "dialogPage") } //公共方法 function AjaxService(param, callback, scope, levPath) { $.ajax({ type: "GET", //使用GET或POST方法访问后台 dataType: "text", //返回json格式的数据 contentType: "application/json; charset=utf-8", url: MyFlow, //要访问的后台地址 data: param, //要发送的数据 async: true, cache: false, complete: function () { }, //AJAX请求完成时隐藏loading提示 error: function (XMLHttpRequest, errorThrown) { callback(XMLHttpRequest); }, success: function (msg) {//msg为返回的数据,在这里做数据绑定 var data = msg; callback(data, scope); } }); } function Do(warning, url) { if (window.confirm(warning) == false) return; SetHref(url); } //以下是软通写的 //初始化网页URL参数 function initPageParam() { pageData.FK_Flow = GetQueryString("FK_Flow"); pageData.FK_Node = GetQueryString("FK_Node"); pageData.FID = GetQueryString("FID") == null ? 0 : GetQueryString("FID"); pageData.WorkID = GetQueryString("WorkID") == null ? GetQueryString("OID") : GetQueryString("WorkID"); pageData.IsRead = GetQueryString("IsRead"); pageData.T = GetQueryString("T"); pageData.Paras = GetQueryString("Paras"); pageData.IsReadOnly = "1"; //如果是IsReadOnly,就表示是查看页面,不是处理页面 pageData.IsStartFlow = GetQueryString("IsStartFlow"); //是否是启动流程页面 即发起流程 pageData.DoType1 = GetQueryString("DoType")//View pageData.IsReadonly = 1 } //设置表单元素不可用 function setFormEleDisabled() { //文本框等设置为不可用 $('#divCCForm textarea').attr('disabled', 'disabled'); $('#divCCForm select').attr('disabled', 'disabled'); /*$('#divCCForm input[type!=button]').attr('disabled', 'disabled');*/ } //移交 //子线程 //子流程 //{"IsSuccess":true,"Msg":null,"ErrMsg":null,"List":null,"Data":2} function getData(data, url, dataParam) { var jsonStr = '{"IsSuccess":true,"Msg":null,"ErrMsg":null,"List":null,"Data":2}'; var data = JSON.parse(jsonStr); if (data.IsSuccess != true) { alert('返回参数失败,ErrMsg:' + data.ErrMsg + ";Msg:" + data.Msg + ";url:" + url); } return data; } var pageData = {}; var globalVarList = {}; window.onresize = function () { if (pageData.Col == 8) { if (jsonStr != undefined && jsonStr != '') { var frmData = JSON.parse(jsonStr); //设置CCFORM的表格宽度 if (document.body.clientWidth > 992) {//处于中屏时设置宽度最小值 $('#CCForm').css('min-width', frmData.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 }; //解析表单字段 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; } // _html += "
"; //加载其他数据控件 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 = "RB_" + attr.KeyOfEn; // if (attr.UIContralType == UIContralType.DDL) { var ctrl_ID = "DDL_" + attr.KeyOfEn; // } _html += ""; _html += "
"; _html += ""; } else { _html += "
"; _html += FormUtils.CreateDDLEnum(attr); } break; case FieldTypeS.FK: //外键表下拉框 _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.MainTable[0], attr.DefVal, attr.KeyOfEn); var html_Sign = ""; html_Sign += "
"; html_Sign += ""; // html_Sign += defValue; html_Sign += "
"; return html_Sign; }, CreateTBString: function (attr) { var html_string = ""; var strPlaceholder = "请输入"; //启用二维码 if (attr.IsEnableQrCode && attr.IsEnableQrCode == "1") { 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.UIHeight > 30) { html_string += "
"; html_string += ""; if (attr.AtPara && attr.AtPara.indexOf("@IsRichText=1") >= 0) { //如果富文本有数据,就用 div 展示html html_string += ""; } else { //非富文本或者 如果没有数据 就用textarea if (attr.UIIsEnable == "0") html_string += "
"; else html_string += ""; } return html_string; } //单行文本 if (attr.UIIsInput == 1 && attr.UIIsEnable == 1) { html_string += "
"; html_string += ""; } else { html_string += "
"; html_string += ""; } if (attr.UIIsEnable == "0") html_string += ""; else html_string += ""; return html_string; }, CreateTBInt: function (attr) { var inputHtml = ""; if (attr.UIIsEnable == "0") { inputHtml += ""; } else { inputHtml += ""; } return inputHtml; }, CreateTBFloat: function (attr) { var inputHtml = "" if (attr.UIIsEnable == "0") { inputHtml += "\";" } else { inputHtml += "\";" } return inputHtml; }, CreateTBDate: function (attr) { var inputHtml = ""; if (attr.UIIsEnable == "0") { inputHtml += ""; } else { inputHtml += ""; } return inputHtml; }, CreateTBDateTime: function (attr) { //Form_Ext_Function += "$('#TB_" + attr.KeyOfEn + "').datetimepicker({lang:'ch'});"; var inputHtml = ""; if (attr.UIIsEnable == "0") { inputHtml += ""; } else { inputHtml += " "; } return inputHtml; }, CreateCBBoolean: function (attr) { var checkBoxVal = ""; var keyOfEn = attr.KeyOfEn; var CB_Html = ""; CB_Html += " "; CB_Html += " "; CB_Html += "
"; CB_Html += "
"; CB_Html += "
"; //CB_Html += " "; //CB_Html += " "; //CB_Html += "
"; //CB_Html += "
"; //CB_Html += "
"; //CB_Html += " "; return CB_Html; }, CreateDDLEnum: function (attr) { //下拉框和单选都使用下拉框实现 // var ctrl_ID = "RB_" + attr.KeyOfEn; // if (attr.UIContralType == UIContralType.DDL) { var ctrl_ID = "DDL_" + attr.KeyOfEn; // } var html_Select = ""; html_Select += ""; return html_Select; }, CreateDDLPK: function (attr) { var html_Select = ""; html_Select += "  "; return html_Select; }, CreateMapPin: function (attr) { 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; } }; //初始化下拉列表框的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; }); $.each(enums, function (i, obj) { operations += ""; }); } return operations; } if (data == undefined) { return operations; } $.each(data, function (i, obj) { operations += ""; }); return operations; } //明细表 function InitDtl(frmData, gf) { var dtlHtml = ""; if (frmData.Sys_MapDtl) { $.each(frmData.Sys_MapDtl, function (i, dtl) { if (gf.CtrlID == dtl.No) { 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; } var dtlExt = {}; //获取从表列表 function GetDtlList(dtlNo) { //获得mapdtl实体的基本信息. var hand = new HttpHandler("BP.WF.HttpHandler.WF_CCForm"); hand.AddPara("EnsName", dtlNo); hand.AddPara("RefPKVal", pageData.WorkID); hand.AddPara("FK_Node", pageData.FK_Node); hand.AddPara("IsReadonly", pageData.IsReadonly); mainData = hand.DoMethodReturnJSON("Dtl_Init"); //主表数据,用于变量替换. var mainTable = mainData["MainTable"]; //主表数据. //从表信息. sys_MapDtl = mainData["Sys_MapDtl"][0]; //从表描述. sys_mapAttr = JSON.stringify(mainData["Sys_MapAttr"]); //从表字段. var sys_mapExtDtl = mainData["Sys_MapExt"]; //扩展信息. var dbDtl = mainData["DBDtl"]; //从表数据. if (!$.isArray(dtlExt[dtlNo])) { dtlExt[dtlNo] = []; } dtlExt[dtlNo].push(mainData); //存储消息 var _Html = '
'; _Html += ''; _Html += '
'; return _Html; } //删除从表数据 function DeleteDtl(dtlNo, oid, obj) { var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm"); handler.AddPara("FK_MapDtl", dtlNo); handler.AddPara("OID", oid); handler.DoMethodReturnString("Dtl_DeleteRow"); //删除成功后,移除数据 $(obj).parent().parent().remove(); } //打开明细表 function Dtl_ShowPage(dtlNo, dtlName) { $("#frmDtlTitle").html(dtlName); $("#HD_CurDtl_No").val(dtlNo) Load_DtlInit(); viewApi.go("#frmDtl"); } //填充默认数据 function ConvertDefVal(mainTable, defVal, keyOfEn) { //计算URL传过来的表单参数@TXB_Title=事件测试 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 mainTable) { if (keyOfEn == ele) { result = mainTable[ele]; if (result == null) { result = ""; } break; } } if (result != undefined && typeof (result) == 'string') { //result = result.replace(/{/g, "{").replace(/}/g, "}").replace(/:/g, ":").replace(/,/g, ",").replace(/【/g, "[").replace(/】/g, "]").replace(/;/g, ";").replace(/~/g, "'").replace(/‘/g, "'").replace(/‘/g, "'"); } //console.info(defVal+"=="+keyOfEn+"=="+result); var result = unescape(result); if (result == "null") result = ""; return result; } //将#FF000000 转换成 #FF0000 function TranColorToHtmlColor(color) { if (color != undefined && color.indexOf('#') == 0 && color.length == 9) { color = color.substring(0, 7); } return color; } //FontStyle, FontWeight, IsBold, IsItalic //fontStyle font-size:19;font-family:"Portable User Interface";font-weight:bolder;color:#FF0051; 为H5设计的,不用解析后面3个 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 = basePath + "/WF/Data/Img/LogH.PNG"; //获取数据 if (frmData.Sys_FrmImgAthDB) { $.each(frmData.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='../../../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 = basePath + "/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) { //审核组键FWCSta Sta,FWC_X X,FWC_Y Y,FWC_H H, FWC_W W from WF_Node var sta = wf_node.FWCSta; var x = wf_node.FWC_X; var y = wf_node.FWC_Y; // var h = wf_node.FWC_H; // var w = wf_node.FWC_W; 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; paras += '&IsReadonly=1'; paras += '&csc=1' + Math.random(); src += "&DoType=View"; src += "&IsMobile=1"; src += "&r1=" + Math.random() + paras; //暂时修改高度为500px. 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); eleHtml.css('position', 'absolute').css('top', y).css('left', x).css('width', w).css('height', h); return eleHtml; } //初始化框架 function figure_Template_IFrame(fram) { var eleHtml = ''; var src = dealWithUrl(fram.src) + "IsReadOnly=0"; eleHtml = $('
' + '
'); var iframe = $(+""); eleHtml.css('position', 'absolute').css('top', fram.Y).css('left', fram.X).css('width', fram.W).css('height', fram.H); return frameHtml; } //处理URL,MainTable URL 参数 替换问题 function dealWithUrl(src) { var src = fram.URL.replace(new RegExp(/(:)/g), ':'); var params = '&FID=' + pageData.FID; params += '&WorkID=' + pageData.WorkID; if (src.indexOf("?") > 0) { var params = getQueryStringFromUrl(src); if (params != null && params.length > 0) { $.each(params, function (i, param) { if (param.indexOf('@') == 0) {//是需要替换的参数 paramArr = param.split('='); if (paramArr.length == 2 && paramArr[1].indexOf('@') == 0) { if (paramArr[1].indexOf('@WebUser.') == 0) { params[i] = paramArr[0].substring(1) + "=" + frmData.MainTable[0][paramArr[1].substr('@WebUser.'.length)]; } if (frmData.MainTable[0][paramArr[1].substr(1)] != undefined) { params[i] = paramArr[0].substring(1) + "=" + frmData.MainTable[0][paramArr[1].substr(1)]; } //使用URL中的参数 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 = ""; //通过MAINTABLE返回的参数 for (var ele in frmData.MainTable[0]) { if (paramArr[0].substring(1) == ele) { result = frmData.MainTable[0][ele]; break; } } //通过URL参数传过来的参数 for (var pageParam in pageParamObj) { if (pageParam == paramArr[0].substring(1)) { result = pageParamObj[pageParam]; break; } } if (result != '') { params[i] = paramArr[0].substring(1) + "=" + unescape(result); } } } }); src = src.substr(0, src.indexOf('?')) + "?" + params.join('&'); } } else { src += "?q=1"; } return src; } var colVisibleJsonStr = '' var jsonStr = ''; var frmData = {}; //从MyFlowFree2017.htm 中拿过过的. $(function () { initPageParam(); //初始化参数 GenerFrm(); //表单数据.ajax });