";
} else if (attr.UIIsEnable == "0" && attr.UIContralType != 12) {
html_string += "
";
html_string += "
" + attr.Name + "
";
}
//身份证件解析增加一个
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 = "
" + attr.Name + mustInput + "
";
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 = "
" + attr.Name + mustInput + "
";
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 = "
" + attr.Name + mustInput + "
";
if (attr.UIIsEnable == "0") {
inputHtml += "
";
}
else {
inputHtml += "
";
inputHtml += " 请选择日期
";
inputHtml += " ";
inputHtml += "
";
}
return inputHtml;
},
CreateTBDateTime: function (attr) {
var mustInput = attr.UIIsInput == 1 ? '
* ' : "";
var inputHtml = "
" + attr.Name + mustInput + "
";
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 += "
" + attr.Name + "
";
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 = "
" + attr.Name + mustInput + "
";
html_Select += "
";
html_Select += InitDDLOperation(frmData, attr, "");
html_Select += " ";
return html_Select;
},
CreateDDLPK: function (attr) {
var mustInput = attr.UIIsInput == 1 ? '
* ' : "";
var html_Select = "
" + attr.Name + mustInput + "
";
html_Select += "
";
html_Select += InitDDLOperation(frmData, attr, "");
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 = "
" + attr.Name + " ";
//展示内容
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 = "
" + attr.Name + " ";
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 += "
" + obj.Lab + " ";
});
}
return operations;
}
if (data == undefined) {
return operations;
}
$.each(data, function (i, obj) {
operations += "
" + obj.Name + " ";
});
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 = $("
" + toNode.Name + "
");
} else {
opt = $("
" + toNode.Name + "
");
}
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("
返回主页 a> 返回待办 a>");
$("#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 = $("" + toNode.Name + " ");
opt.data(toNode);
} else {
var opt = $("" + toNode.Name + " ");
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 += "