//. 保存嵌入式表单. add 2015-01-22 for GaoLing. function SaveSelfFrom() { // 不支持火狐浏览器。 var frm = document.getElementById('SelfForm'); if (frm == null) { alert('系统错误,没有找到SelfForm的ID.'); } //执行保存. return frm.contentWindow.Save(); } function SendSelfFrom() { if (SaveSelfFrom() == false) { alert('表单保存失败,不能发送。'); return false; } return true; } //停止流程. function DoStop(msg, flowNo, workid) { if (confirm('您确定要执行 [' + msg + '] ?') == false) return; var para = 'DoType=MyFlow_StopFlow&FK_Flow=' + flowNo + '&WorkID=' + workid; AjaxService(para, function (msg, scope) { alert(msg); if (msg.indexOf('err@') == 0) { return; } SetHref( 'Todolist.htm'); }); } //空方法,不能删除. function SysCheckFrm() { } function KindEditerSync() { return true; } function Change() { var btn = document.getElementById('Btn_Save'); if (btn != null) { if (btn.value.valueOf('*') == -1) btn.value = btn.value + '*'; } } // 获取附件文件名称,如果附件没有上传就返回null. function ReqAthFileName(athID) { var v = document.getElementById(athID); if (v == null) { return null; } var fileName = v.alt; return fileName; } //执行分支流程退回到分合流节点。 function DoSubFlowReturn(fid, workid, fk_node) { var url = 'ReturnWorkSubFlowToFHL.htm?FID=' + fid + '&WorkID=' + workid + '&FK_Node=' + fk_node; var v = WinShowModalDialog(url, 'df'); SetHref( window.history.url); } function To(url) { //window.location.href = filterXSS(url); window.name = "dialogPage"; window.open(filterXSS(url), "dialogPage") } function DoDelSubFlow(fk_flow, workid) { if (window.confirm('您确定要终止进程吗?') == false) return; var para = 'DoType=DelSubFlow&FK_Flow=' + fk_flow + '&WorkID=' + workid; AjaxService(para, function (msg, scope) { alert(msg); Reload(); }); } function Do(warning, url) { if (window.confirm(warning) == false) return; SetHref(url); } //关注 按钮. function FocusBtn(btn, workid) { if (btn.value == '关注') { btn.value = '取消关注'; } else { btn.value = '关注'; } var para = "DoType=Focus&WorkID=" + workid; AjaxService(para, function (msg, scope) { // alert(msg); }); } //确认 按钮. function ConfirmBtn(btn, workid) { if (btn.value == '确认') { btn.value = '取消确认'; } else { btn.value = '确认'; } var para = "DoType=Confirm&WorkID=" + workid; AjaxService(para, function (msg, scope) { // alert(msg); }); } //以下是软通写的 //初始化网页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.PWorkID = GetQueryString("PWorkID"); pageData.IsRead = GetQueryString("IsRead"); pageData.T = GetQueryString("T"); pageData.Paras = GetQueryString("Paras"); pageData.IsReadonly = 0; //如果是IsReadOnly,就表示是查看页面,不是处理页面 pageData.IsStartFlow = GetQueryString("IsStartFlow"); //是否是启动流程页面 即发起流程 pageData.DoType1 = GetQueryString("DoType"); } //将获取过来的URL参数转成URL中的参数形式 & function pageParamToUrl() { var paramUrlStr = ''; for (var param in pageData) { paramUrlStr += '&' + (param.indexOf('@') == 0 ? param.substring(1) : param) + '=' + pageData[param]; } return paramUrlStr; } function addBarContent(barcount, bottombar, popoverBar, barHtml) { if (barcount == 4) { bottombar.append('更多'); } else if (barcount > 4) { popoverBar.append(barHtml); } else { bottombar.append(barHtml); } } //结束流程. function DoStop(msg, flowNo, workid) { mui.confirm('您确定要执行 [' + msg + '] ?', function (e) { if (e.index == 1) { var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow"); handler.AddPara("FK_Flow", flowNo); handler.AddPara("WorkID", workid); var data = handler.DoMethodReturnString("MyFlow_StopFlow"); if (data.indexOf('err@') == 0) return; SetHref( "Todolist.htm?1=2"); } }) } //删除流程. function DeleteFlow() { mui.confirm('您确定要删除吗?', function (e) { if (e.index == 1) { var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile_MyFlow"); handler.AddPara("FK_Flow", GetQueryString("FK_Flow")); handler.AddPara("WorkID", GetQueryString('WorkID')); var data = handler.DoMethodReturnString("MyFlowGener_Delete"); if (data.indexOf("err@") != -1) { mui.alert(data); return; } SetHref("Todolist.htm?1=2"); } }) } //隐藏下方的功能按钮 function setToobarDisiable() { //隐藏下方的功能按钮 $('.Bar input').css('background', 'gray'); $('.Bar input').attr('disabled', 'disabled'); } function setToobarEnable() { //隐藏下方的功能按钮 $('.Bar input').css('background', '#2884fa'); $('.Bar input').removeAttr('disabled'); } //设置表单元素不可用 function setFormEleDisabled() { //文本框等设置为不可用 $('#divCCForm textarea').attr('disabled', 'disabled'); $('#divCCForm select').attr('disabled', 'disabled'); $('#divCCForm input[type!=button]').attr('disabled', 'disabled'); } //保存 function Save(flag) { var iframe = document.getElementById("tbTracks"); if (iframe) SaveWorkCheck(); //保存从表 frmData.Sys_MapDtl.forEach(function (dtl) { if (dtl.MobileShowModel == 2) { Dtl_SaveData(dtl.No, dtl.No +"form_Dtl"); } }) $("input").blur(); if ($(".compareClass").length > 0) return false; //必填项和正则表达式检查. if (checkBlanks() == false) { mui.alert("请输入必填项!"); return false; } if (checkReg() == false) { mui.alert("正则验证错误,请检查边框变红字段!"); return false; } var url = ""; var sys_MapData = frmData["Sys_MapData"][0]; var params = getFormData(true, true, "divCCForm", false); if (sys_MapData.No.indexOf('ND') == 0) { var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile_MyFlow"); //$.each(params.split("&"), function (i, o) { // var param = o.split("="); // if (param.length == 2 && validate(param[1])) { // handler.AddPara(param[0], param[1]); // } else { // handler.AddPara(param[0], ""); // } //}); handler.AddUrlData(); handler.AddJson(params); handler.AddPara("IsMobile", 1); var data = handler.DoMethodReturnString("Save"); } else { var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile_MyFlow"); handler.AddUrlData(); handler.AddJson(params); handler.AddPara("IsMobile", 1); handler.AddPara("FK_MapData", sys_MapData.No); handler.AddPara("OID", GetQueryString("WorkID")); var data = handler.DoMethodReturnString("FrmGener_Save"); } if (data.indexOf('err@') == 0) { mui.alert(data); return; } if (flag == 0) {//0:保存按钮保存;1:发送时的保存 mui.toast("保存成功!"); } } //获得表单数据. 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 = {}; //点击文件名称执行的下载. function Down2017(mypk) { //组织url. var url = Handler + "?DoType=AttachmentUpload_Down&MyPK=" + mypk + "&m=" + Math.random(); $.ajax({ type: 'post', async: true, url: url, dataType: 'html', success: function (data) { if (data.indexOf('err@') == 0) { alert(data); //如果是异常,就提提示. return; } if (data.indexOf('url@') == 0) { data = data.replace('url@', ''); //如果返回url,就直接转向. var i = data.indexOf('\DataUser'); var str = '/' + data.substring(i); str = str.replace('\\\\', '\\'); window.open(str, "_blank"); return; } alert(data); return; } }); } //刷新子流程 function refSubSubFlowIframe() { var iframe = $('iframe[src*="SubFlow.aspx"]'); iframe[0].contentWindow.location.href = filterXSS(iframe[0].src); } 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; } 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.UIContralType == UIContralType.CheckBok) { _html += "
"; _html += ""; _html += '
' _html += Initcheckbox(frmData, attr); break; } 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.UIContralType == 8) { var val = ConvertDefVal(frmData, attr.DefVal, attr.KeyOfEn); var imgSrc= "../DataUser/Siganture/UnName.jpg"; html_string += "
"; html_string += ""; var html = ""; html_string += "" + html; return html_string; } //富文本 if (attr.TextModel == 3) { html_string += "
"; html_string += ""; if (attr.UIIsEnable == "0") { var val = ConvertDefVal(frmData, attr.DefVal, attr.KeyOfEn); val = val.replace(/white-space: nowrap;/g, ""); return html_string + "
" + val + "
"; } html_string += ""; return html_string; } //多行文本 if ((attr.UIHeight > 30 && attr.ColSpan > 1) || attr.TextModel == 2) { 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 = ""; var event = 'onblur="valitationAfter(this, \'int\')" onkeydown="valitationBefore(this, \'int\')" onkeyup="valitationAfter(this, \'int\'); if(isNaN(value) || (value%1 !== 0))execCommand(\'undo\')" onafterpaste="valitationAfter(this, \'int\'); if(isNaN(value) || (value%1 !== 0))execCommand(\'undo\')"'; if (attr.UIIsEnable == "1" && pageData.IsReadonly != 1) { var step = GetPara(attr.AtPara, "NumStepLength"); step = step == null || step == undefined ? 1 : parseInt(step) == 0 ? 1 : parseInt(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 += ""; } inputHtml += ""; else inputHtml += " name=\"TB_" + attr.KeyOfEn + "\" id=\"TB_" + attr.KeyOfEn + "\" placeholder='0' />"; if (attr.UIIsEnable == "1" && pageData.IsReadonly != 1) { inputHtml += ""; inputHtml += "
"; } 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; } }; //AtPara @PopValSelectModel=0@PopValFormat=0@PopValWorkModel=0@PopValShowModel=0 function GepParaByName(name, atPara) { var params = atPara.split('@'); var result = $.grep(params, function (value) { return value != '' && value.split('=').length == 2 && value.split('=')[0] == value; }) return result; } //初始化下拉列表框的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(flowData, defVal, keyOfEn) { //防止传值为null的情况 if (defVal == null) { defVal = ""; } //计算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; var mainData = flowData.MainTable == undefined ? flowData : flowData.MainTable[0]; //通过MAINTABLE返回的参数 for (var ele in mainData) { if (keyOfEn == ele) { result = mainData[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, "'"); } return result = unescape(result); } //选择发送节点 function checkRadio(id) { $("#" + id).prop('checked', 'true'); } //发送 function SendIt(isHuiQian) { $("input").blur(); if ($(".compareClass").length > 0) return; $("#SendBtn").addClass("mui-disabled");//禁用发送按钮 GetWXFixed(function (isHuiQian) { SendForm(isHuiQian); }); } function SendForm(isHuiQian) { var toNodeNo = 0; //发送前事件 if (typeof beforeSend != 'undefined' && beforeSend instanceof Function) if (beforeSend() == false) { $("#SendBtn").removeClass("mui-disabled"); return false; } //执行一下保存 if (Save(1) == false) { $("#SendBtn").removeClass("mui-disabled"); return false; } //判断从表数量 var frmCheck = true; if (typeof dtls != 'undefined' && $("iframe[name=Dtl]").length > 0) { $.each($("iframe[name=Dtl]"), function (i, obj) { var dtlNo = obj.id; var item = dtls[dtlNo]; if (item == undefined) { $("#HD_CurDtl_No").val(dtlNo); Load_DtlInit("DtlContent", dtlNo); } item = dtls[dtlNo][0]; if (item.Count < item.NumOfDtl) { mui.alert("[" + item.Name + "]明细不能少于最小数量" + item.NumOfDtl); frmCheck = false; } }) if (frmCheck == false) return false; } //如果启用了流程流转自定义,必须设置选择的游离态节点 if ($('[name=TransferCustom]').length > 0) { var ens = new Entities("BP.WF.TransferCustoms"); ens.Retrieve("WorkID", pageData.WorkID, "IsEnable", 1); if (ens.length == 0) { mui.alert("该节点启用了流程流转自定义,但是没有设置流程流转的方向,请点击流转自定义按钮进行设置"); return false; } msg = ""; $.each(ens, function (i, en) { if (en.Worker == null || en.Worker == "") msg += "节点[" + en.NodeName + "],"; }) if (msg != "") { msg += "没有设置接收人。"; mui.alert(msg); return false; } } //根据workID 获取流程信息 var gwf = new Entity("BP.WF.GenerWorkFlow", pageData.WorkID); var toNodeDDL = $("
"); if (initData.ToNodes != undefined && initData.ToNodes.length > 1) { var isLastHuiQian = true; //待办人数 var todoEmps = gwf.TodoEmps; if (todoEmps != null && todoEmps != undefined) { var huiqianSta = gwf.GetPara("HuiQianTaskSta") == 1 ? true : false; if (wf_node.TodolistModel == 1 && huiqianSta == true && todoEmps.split(";").length > 1) isLastHuiQian = false; } /* if (gwf.GetPara("HuiQianTaskSta") == "1" && flowData.WF_GenerWorkFlow[0].HuiQianZhuChiRen != webUser.No) { execSend(toNodeNo); return false; }*/ $.each(initData.ToNodes, function (i, toNode) { var opt = ""; if (toNode.IsSelected == "1") { opt = $("

"); } else { opt = $("

"); } opt.data(toNode); toNodeDDL.append(opt); }); var btnArray = ['取消', '确定']; mui.prompt('', null, '请选择下一节点', btnArray, function (e) { if (e.index == 1) { $(".mui-popup-button-bold").css("color", "#CCCCCC"); this.disabled = true; toNodeNo = $("input[name='Radio_ToNode']:checked").val(); var selectToNode; if ($("#" + toNodeNo).length != 0) { selectToNode = $("#" + toNodeNo).parent(0).data(); } if (selectToNode.IsSelected == 2) isReturnNode = 1; if (selectToNode.IsSelectEmps == "1" && isLastHuiQian == true) { if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { initModal("sendAccepter", selectToNode); } return; } if (selectToNode.IsSelectEmps == "2") { if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { var url = selectToNode.DeliveryParas; if (url != null && url != undefined && url != "") { url = url + "?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&ToNode=" + toNodeNo + "&s=" + Math.random(); initModal("BySelfUrl", toNodeNo, url); return; } } } if (selectToNode.IsSelectEmps == "3") { if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { initModal("sendAccepterOfOrg", toNodeNo); } return; } if (selectToNode.IsSelectEmps == "4") { if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { initModal("AccepterOfDept", toNodeNo); } return; } if (isHuiQian == true) { initModal("HuiQian", toNodeNo); //$('#returnWorkModal').modal().show(); $("#SendBtn").removeClass("mui-disabled"); return; } else { execSend(toNodeNo); } } else { $("#SendBtn").removeClass("mui-disabled"); } }, 'div'); var tt = $('.mui-popup-input'); tt.empty(); tt.append(toNodeDDL); } else if (initData.ToNodes != undefined && initData.ToNodes.length == 1) { var selectToNode = initData.ToNodes[0]; toNodeNo = initData.ToNodes[0].No; if (selectToNode.IsSelectEmps == "1") { //跳到选择接收人窗口 $('[name=SaveBtn]').trigger("click"); isSaveOnly = false; if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { initModal("sendAccepter", selectToNode); } return false; } if (selectToNode.IsSelectEmps == "2") { //Save(1); //执行保存. if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { var url = selectToNode.DeliveryParas; if (url != null && url != undefined && url != "") { url = url + "?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&ToNode=" + toNodeID + "&s=" + Math.random(); initModal("BySelfUrl", toNodeNo, url); return false; } } } if (selectToNode.IsSelectEmps == "3") { //Save(1); //执行保存. if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { initModal("sendAccepterOfOrg", toNodeNo); } return false; } if (selectToNode.IsSelectEmps == "4") { if (isHuiQian == true) { initModal("HuiQian", toNodeNo); } else { initModal("AccepterOfDept", toNodeNo); } return false; } if (isHuiQian == true) { toNodeNo = initData.ToNodes[0].No; initModal("HuiQian", toNodeNo); $("#SendBtn").removeClass("mui-disabled"); return false; } else { execSend(toNodeNo); } return false; }else { if (isHuiQian == true) { toNodeNo = initData.ToNodes[0].No; initModal("HuiQian", toNodeNo); $("#SendBtn").removeClass("mui-disabled"); return false; } else { execSend(toNodeNo); } } } function execSend(toNode) { //先设置按钮等不可用 //setToobarDisiable(); //Save(1); //判断是否启用审核组件 var iframe = document.getElementById("tbTracks"); if (iframe) if (SaveWorkCheck() == false) return false; var params = getFormData(true, true, "divCCForm",false); var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile_MyFlow"); handler.AddPara("IsMobile", 1); handler.AddPara("ToNode", toNode); handler.AddUrlData(); handler.AddJson(params); var data = handler.DoMethodReturnString("Send"); //执行发送方法. if (data.indexOf('err@') == 0) { //发送时发生错误 mui.alert(data); //setToobarEnable(); $("#SendBtn").prop("disabled", false); $("#SendBtn").css("color", "#000"); return; } if (data.indexOf('TurnUrl@') == 0) { //发送成功时转到指定的URL var url = data; url = url.replace('TurnUrl@', ''); SetHref(url); return ; } if (data.indexOf('url@') >= 0) { //发送成功时转到指定的URL if (data.indexOf('Accepter') != 0 && data.indexOf('AccepterGener') == -1) { //求出url里面的的FK_Node var params = data.split("&"); var toNodeId = ''; for (var i = 0; i < params.length; i++) { if (params[i].indexOf("ToNode") == -1) continue; toNodeId = params[i].split("=")[1]; break; } var toNode = new Entity("BP.WF.Node", toNodeId); initModal("sendAccepter", toNode); $("#returnWorkModal").modal().show(); return; } var url = data; url = url.replace('url@', ''); SetHref(url); return; } if (data.indexOf('SelectNodeUrl@') >= 0) { //发送成功时转到指定的URL var url = data; url = url.replace('SelectNodeUrl@', ''); SetHref(url); return; } data = data.replace('@', '
@'); data = data.replace(/@/g, '
'); data = data.replace(/null/g, ''); OptSuc(data); return; } //发送 退回 移交等执行成功后转到 指定页面 function OptSuc(msg) { msg = msg.replace("@查看", '') msg = msg.replace(/@/g, '
').replace(/null/g, ''); msg = msg.replace('
', '').replace('
', ''); if (msg.indexOf("WorkOpt/AllotTask.htm") != -1) { var msgs = msg.split('
'); msg = $.grep(msgs, function (obj, i) { if (obj.indexOf("WorkOpt/AllotTask.htm") == -1) return obj; }); msg = msg.join('
'); } $("#CCForm").html(msg); $("#divCCForm").parent().css("transform", "translate3d(0px, 0px, 0px)"); $('#bottomToolBar').html("返回主页 返回待办 "); $("#Back_Home").on("tap", function () { tranfToUrl('Home.htm'); }); $("#CCForm").css("padding", "5px").css("line-height", "34px"); $("#Back_TodoList").on("tap", function () { tranfToUrl('Todolist.htm'); }); } function tranfToUrl(url) { location.href = url; } //移交 //初始化发送节点下拉框 function InitToNodeDDL(flowData) { if (flowData.ToNodes == undefined) return; if (flowData.ToNodes.length == 0) return; //如果没有发送按钮,就让其刷新,说明加载不同步. var btn = $('[name=Send]'); if (btn == null || btn == undefined) { Reload(); return; } //var flowData = JSON.parse(jsonStr); if (flowData.ToNodes != undefined && flowData.ToNodes.length > 0) { // $('[value=发送]'). var toNodeDDL = $(''); $.each(flowData.ToNodes, function (i, toNode) { var opt = ""; if (toNode.IsSelected == "1") { var opt = $(""); opt.data(toNode); } else { var opt = $(""); opt.data(toNode); } toNodeDDL.append(opt); }); $('[name=Send]').after(toNodeDDL); } } //根据下拉框选定的值,弹出提示信息 绑定那个元素显示,哪个元素不显示 function ShowNoticeInputInfo() { var flowData = JSON.parse(jsonStr); var rbs = flowData.Sys_FrmRB; data = rbs; $("input[type=radio],select").bind('change', function (obj) { var needShowDDLids = []; var methodVal = obj.target.value; for (var j = 0; j < data.length; j++) { var value = data[j].IntKey; var noticeInfo = data[j].Tip; var drdlColName = data[j].KeyOfEn; if (obj.target.tagName == "SELECT") { drdlColName = 'DDL_' + drdlColName; } else { drdlColName = 'RB_' + drdlColName; } //if (methodVal == value && obj.target.name.indexOf(drdlColName) == (obj.target.name.length - drdlColName.length)) { if (methodVal == value && (obj.target.name == drdlColName)) { //根据下拉列表的值选择弹出提示信息 if (noticeInfo == undefined || noticeInfo.trim() == '') { break; } noticeInfo = noticeInfo.replace(/\\n/g, '
') var selectText = ''; if (obj.target.tagName.toUpperCase() == 'INPUT' && obj.target.type.toUpperCase() == 'RADIO') {//radio button selectText = obj.target.nextSibling.textContent; } else {//select selectText = $(obj.target).find("option:selected").text(); } $($('#div_NoticeInputInfo .popover-title span')[0]).text(selectText); $('#div_NoticeInputInfo .popover-content').html(noticeInfo); var top = obj.target.offsetHeight; var left = obj.target.offsetLeft; var current = obj.target.offsetParent; while (current !== null) { left += current.offsetLeft; top += current.offsetTop; current = current.offsetParent; } if (obj.target.tagName.toUpperCase() == 'INPUT' && obj.target.type.toUpperCase() == 'RADIO') {//radio button left = left - 40; top = top + 10; } if (top - $('#div_NoticeInputInfo').height() - 30 < 0) { //让提示框在下方展示 $('#div_NoticeInputInfo').removeClass('top'); $('#div_NoticeInputInfo').addClass('bottom'); top = top; } else { $('#div_NoticeInputInfo').removeClass('bottom'); $('#div_NoticeInputInfo').addClass('top'); top = top - $('#div_NoticeInputInfo').height() - 30; } $('#div_NoticeInputInfo').css('top', top); $('#div_NoticeInputInfo').css('left', left); $('#div_NoticeInputInfo').css('display', 'block'); //$("#btnNoticeInfo").popover('show'); //$('#btnNoticeInfo').trigger('click'); break; } } $.each(needShowDDLids, function (i, ddlId) { $('#' + ddlId).change(); }); }); $('#span_CloseNoticeInfo').bind('click', function () { $('#div_NoticeInputInfo').css('display', 'none'); }) } //正则表达式检查 function checkReg() { var checkRegResult = true; var regInputs = $('.CheckRegInput'); $.each(regInputs, function (i, obj) { var name = obj.name; var mapExtData = $(obj).data(); if (mapExtData.Doc != undefined) { var regDoc = mapExtData.Doc.replace(/【/g, '[').replace(/】/g, ']').replace(/(/g, '(').replace(/)/g, ')').replace(/{/g, '{').replace(/}/g, '}').replace(/,/g, ','); var tag1 = mapExtData.Tag1; if ($(obj).val() != undefined && $(obj).val() != '') { var result = CheckRegInput(name, regDoc, tag1); if (!result) { $(obj).addClass('errorInput'); checkRegResult = false; } else { $(obj).removeClass('errorInput'); } } } }); return checkRegResult; } function SaveDtlAll() { return true; } //初始化多表单. function InitFrmNodes(myFrmData) { //给当前的变量赋值. frmData = myFrmData; //首先判断是否是多表单? var frmNodes = myFrmData["FrmNodes"]; if (frmNodes == undefined) { //不是多表单就绑定节点表单. BindFrm(); return; } var frmNode = frmNodes[0]; var paras = DearUrlParas(); var handler = new HttpHandler("BP.WF.FrmGener_Init"); handler.AddPara("FK_MapData", frmNode.FK_Frm); handler.AddPara("IsMobile", 1); handler.AddUrlData(paras); handler.AddJson(pageData); var data = handler.DoMethodReturnString("FrmGener_Init"); if (data.indexOf('err@') == 0) { alert(data); return; } frmData = JSON.parse(data); //绑定. BindFrm(); } //绑定表单. function BindFrm() { //分组信息. var Sys_GroupFields = frmData.Sys_GroupField; var Fk_MapData = frmData.Sys_MapData[0].No; var node = frmData.WF_Node[0]; //遍历循环生成 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 += ""; } continue; } //字段类的控件. if (gf.CtrlType == '' || gf.CtrlType == null) { mapAttrsHtml += InitMapAttr(frmData.Sys_MapAttr, gf.OID, frmData); if (isZDMobile == true) { mapAttrsHtml += "
"; mapAttrsHtml += ""; } continue; } } if (isZDMobile == true) mapAttrsHtml += ""; //展显 $(mapAttrsHtml).appendTo('#CCForm'); //增加列表展示的从表 frmData.Sys_MapDtl.forEach(function (dtl) { if (dtl.MobileShowModel == 2) { $("#HD_CurDtl_No").val(dtl.No); Load_DtlInit(dtl.No + "DtlContent", dtl.No); } }) 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()); }) var trs = $(".mui-table-view-divider"); var isHidden = false; $.each(trs, function (i, obj) { //获取所有跟随的同胞元素,其中有不隐藏的tr,就跳出循环 var sibles = $(obj).nextAll(); var isAllHidenField = false; if (sibles.length == 0) { $(obj).hide(); return true; } }); 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")); } }); ////加载JS文件 改变JS文件的加载方式 解决JS在资源中不显示的问题 if (frmData.Sys_MapData[0].IsEnableJs == 1) { var enName = frmData.Sys_MapData[0].No; try { var s = document.createElement('script'); s.type = 'text/javascript'; s.src = "../DataUser/JSLibData/" + enName + "_Self.js"; var tmp = document.getElementsByTagName('script')[0]; tmp.parentNode.insertBefore(s, tmp); } catch (err) { } } $.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); }) }) 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) { } } if (frmData.Sys_FrmImgAth.length > 0) { try { var s = document.createElement('script'); s.type = 'text/javascript'; s.src = "./js/mui/js/feedback-page-img.js"; var tmp = document.getElementsByTagName('script')[0]; tmp.parentNode.insertBefore(s, tmp); } 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); }); } var flowData = null; var bindDataString = ""; function GenerWorkNode() { 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_MyFlow"); handler.AddUrlData(urlParam); handler.AddPara("IsMobile", 1); handler.AddJson(pageData); var data = handler.DoMethodReturnString("GenerWorkNode"); if (data.indexOf('err@') == 0) { alert(data); return; } jsonStr = data; try { flowData = JSON.parse(data); frmData = flowData; } catch (err) { alert("GenerWorkNode转换JSON失败:" + jsonStr); return; } //获取没有解析的外部数据源 var uiBindKeys = flowData["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); } flowData[uiBindKeys[i].No] = operdata; } } } frmData = flowData; //设置标题. document.title = flowData.WF_Node[0].Name; document.getElementById("title").innerHTML = flowData.Sys_MapData[0].Name; //绑定表单. InitFrmNodes(flowData); //获得节点信息. var wf_node = flowData["WF_FrmNodeComponent"][0]; //现在只有一条信息提示.. var info = ""; var h = $("#main").height() - 150; for (var i in flowData.AlertMsg) { var title = flowData.AlertMsg[i].Title; var alertMsg = flowData.AlertMsg[i].Msg; mui.alert(title + "\n" + alertMsg); if (title == "催办信息") $(".mui-popup-text").css("font-weight", "bold"); if (title == "退回信息") $(".mui-popup-text").css("color", "red"); var alertH = $(".mui-popup-text").height(); if (alertH > h) $(".mui-popup-text").css("height", h).css("overflow-y", "auto"); break; } window.addEventListener('touchmove', function (e) { var target = e.target; // 阻止冒泡 target && (target.getAttribute('class') === 'mui-popup-text') && e.stopPropagation(); }, true); //判断该节点是否启用了帮助提示 0 禁用 1 启用 2 强制提示 3 选择性提示 HelpAlter(); //循环组件 轨迹图 审核组件 子流程 子线程 $('#CCForm').append(figure_Template_FigureFlowChart(wf_node)); $('#CCForm').append(figure_Template_FigureSubFlowDtl(wf_node)); //加载转向条件的下拉框.(优化去掉) //InitToNodeDDL(flowData); LoadFrmDataAndChangeEleStyle(flowData); var enName = flowData.Sys_MapData[0].No; //获得配置信息. var node = frmData.WF_Node[0]; var frmNode = flowData["WF_FrmNode"]; var flow = flowData.WF_Flow[0]; if ((flow && flow.FlowDevModel == 1 || node.FormType == 11) && frmNode != null && frmNode[0].FrmSln == 1) { /*只读的方案.*/ SetFrmReadonly(); pageData.IsReadonly = 1; } if ($("#tbTracks").length != 0) { Skip.addJs("WorkOpt/WorkCheck.js?t=" + Math.random()); getWorkCheck(); } if (pageData.IsReadonly == 0) { //写字板 var attrs = $.grep(flowData.Sys_MapAttr, function (item) { return item.UIVisible == 1 && item.UIContralType == 8 && item.UIIsEnable == 1; }); if (attrs.length > 0) { $('head').append(''); Skip.addJs("./Scripts/bootstrap/js/bootstrap.min.js"); Skip.addJs("./Scripts/bootstrap/BootstrapUIDialog.js"); attrs.forEach(function (attr) { $("#Img" + attr.KeyOfEn).on("tap", function () { var keyOfEn = this.id.replace("Img", ""); var url = "WorkOpt/HandWriting.htm?WorkID=" + pageData.WorkID + "&FK_Flow=" + pageData.FK_Flow + "&FK_Node=" + pageData.FK_Node + "&KeyOfEn=" + keyOfEn; OpenBootStrapModal(url, "eudlgframe", "签字版", 400, 240, "icon-edit", false); var $modal_dialog = $('.modal-dialog'); var m_top = ($(document).height() - $modal_dialog.height()) / 2; var m_left = ($(document).width() - $modal_dialog.width()) / 2; $('.modal').css({ 'margin': m_top + 'px ' + m_left+'px' }); }); }); } } //处理下拉框级联等扩展信息 AfterBindEn_DealMapExt(flowData); OptionLinkOthers(flowData); if (pageData.IsReadonly != 1) { var pickdates = $("#CCForm .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); } } var data = $("#" + id.replace("LAB_", "TB_")).data(); if (data && data.ReqDay != null && data.ReqDay != undefined) ReqDays(data.ReqDay); }); }, false); } }); } Common.MaxLengthError(); } function HelpAlter() { //判断该节点是否启用了帮助提示 0 禁用 1 启用 2 强制提示 3 选择性提示 var wf_node = flowData["WF_FrmNodeComponent"][0]; var btnLab = new Entity("BP.WF.Template.BtnLab", wf_node.NodeID); if (btnLab.HelpRole != 0) { var count = 0; if (btnLab.HelpRole == 3) { var mypk = webUser.No + "_ND" + node.NodeID + "_HelpAlert"; var userRegedit = new Entity("BP.Sys.UserRegedit"); userRegedit.SetPKVal(mypk); count = userRegedit.RetrieveFromDBSources(); } if (btnLab.HelpRole == 2 || (count == 0 && btnLab.HelpRole == 3)) { var filename = basePath + "/DataUser/CCForm/HelpAlert/" + wf_node.NodeID + ".htm"; var htmlobj = $.ajax({ url: filename, async: false }); if (htmlobj.status == 404) return; var str = htmlobj.responseText; if (str != null && str != "" && str != undefined) { mui.alert(str, '', "我知道了", function () { //保存用户的帮助指引信息操作 var mypk = webUser.No + "_ND" + pageData.FK_Node + "_HelpAlert" var userRegedit = new Entity("BP.Sys.UserRegedit"); userRegedit.SetPKVal(mypk); var count = userRegedit.RetrieveFromDBSources(); if (count == 0) { //保存数据 userRegedit.FK_Emp = webUser.No; userRegedit.FK_MapData = "ND" + pageData.FK_Node; userRegedit.Insert(); } }); $(".mui-popup-title").hide(); } } } } //明细表 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; } //平铺模式展示 if (dtl.MobileShowModel == 2) { dtlHtml += "
    "; dtlHtml += "

    " + gf.Lab + "

    "; dtlHtml += "
    "; dtlHtml += "
    "; dtlHtml += "
    "; dtlHtml += "
    "; return; var src = basePath + "/CCMobile/CCForm/Dtl.htm?DtlNo=" + dtl.No + "&WorkID="+pageData.WorkID+"&RefPKVal=" + pageData.WorkID + "&FK_MapData=" + dtl.FK_MapData + "&IsReadonly=" + pageData.IsReadonly + "&FK_Node" + pageData.FK_Node + "&Version=1&FrmType=0"; dtlHtml += ""; dtlHtml += "
    "; return; } } }); } return dtlHtml; } function TurnTo_Dtl(dtlNo,urlDtl, frmID) { //保存表单的数据 Save(0); if (urlDtl.indexOf("?") == -1) urlDtl = urlDtl + "?1=1"; urlDtl += "&EnsName=" + dtlNo + "&RefPKVal=" + pageData.WorkID + "&FK_MapData=" + frmID + "&IsReadonly=0&Version=1&FrmType=0"; SetHref( basePath + "/" + urlDtl); } //打开明细表 function Dtl_ShowPage(dtlNo, dtlName) { $("#frmDtlTitle").html(dtlName); $("#HD_CurDtl_No").val(dtlNo); Load_DtlInit("DtlContent", dtlNo); viewApi.go("#frmDtl"); } 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 isRead = false; var isInsert = false; var isDelete = false; if (sys_MapDtl.IsReadonly == "1" || pageData.IsReadonly == "1") isRead = true; if ((sys_MapDtl.IsInsert == "1" || sys_MapDtl.IsUpdate == "1") && pageData.IsReadonly != "1") isInsert = true; if (sys_MapDtl.IsDelete == "1" && pageData.IsReadonly != "1") isDelete = true; //存储消息 var _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 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 (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='/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 addLoadFunction(id, eventName, method) { var js = ""; js = ""; return $(js); } //初始化轨迹图 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 wf_node = flowData["WF_FrmNodeComponent"][0]; var sta = wf_node.FWCSta; if (sta == 0) return ""; var eleHtml = "
    " + wf_node.FWCTypeText + "
    "; eleHtml += '
    ' + "
    " + '
    '; return eleHtml; } //子流程 function figure_Template_FigureSubFlowDtl(wf_node) { var sta = wf_node.SFSta; if (sta == 0 || sta == '0') return $(''); var func = "initModal(\"SubFlow\")"; var eleHtml = "
    "; eleHtml += "
    启动子流程
    "; eleHtml += "
    "; eleHtml += "
    "; 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; } function figure_Template_MsgAlert(msgAlert, i) { var eleHtml = $('
    '); var titleSpan = $(' ' + (parseInt(i) + 1) + "   " + msgAlert.Title + ''); var msgDiv = $('
    ' + msgAlert.Msg + '
    '); eleHtml.append(titleSpan).append(msgDiv); return eleHtml; } //处理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 = {}; var webUser = new WebUser(); //Hide_IsShowTrack:是否隐藏该条信息,CommonShowConfig.js中定义 if ("undefined" == typeof Hide_IsShowTrack) { var Hide_IsShowTrack = true; }; //从MyFlowFree2017.htm 中拿过过的. $(function () { var frm = document.forms["divCCForm"]; if (plant == "CCFlow") frm.action = "MyFlow.ashx?method=login&IsMobile=1"; else frm.action = MyFlow + "?method=login"; initPageParam(); //初始化参数 InitToolBar("MyFlow"); //工具栏.ajax GenerWorkNode(); //表单数据.ajax //打开表单检查正则表达式 if (typeof FormOnLoadCheckIsNull != 'undefined' && FormOnLoadCheckIsNull instanceof Function) { FormOnLoadCheckIsNull(); } }); function BackToHome() { SetHref('../CCMobilePortal/Home.htm?UserNo=' + GetQueryString('UserNo') + "&Token=" + GetQueryString("Token")); } function BackToTodolist() { SetHref('Todolist.htm?UserNo=' + GetQueryString('UserNo') + "&Token=" + GetQueryString("Token")); } function BackToStart() { SetHref('Start.htm?UserNo=' + GetQueryString('UserNo') + "&Token=" + GetQueryString("Token")); } //@浙商银行 function SetFrmReadonly() { $('#CCForm').find('input,textarea,select').attr('disabled', false); $('#CCForm').find('input,textarea,select').attr('readonly', true); $('#CCForm').find('input,textarea,select').attr('disabled', true); $('#Btn_Save').attr('disabled', true); } function setHandWriteSrc(HandWriteID, imagePath, type) { if (type == 0) { imagePath = "../" + imagePath.substring(imagePath.indexOf("DataUser")); document.getElementById("Img" + HandWriteID).src = ""; $("#Img" + HandWriteID).attr("src", imagePath); $("#TB_" + HandWriteID).val(imagePath); } if (type == 1) { $("#Img_" + HandWriteID).attr("src", imagePath); if ("undefined" != typeof writeImg) writeImg = imagePath; } $('#bootStrapdlg').modal('hide'); }