|
|
|
|
|
$(function () {
|
|
|
//打开表单检查正则表达式
|
|
|
if (typeof FormOnLoadCheckIsNull != 'undefined' && FormOnLoadCheckIsNull instanceof Function) {
|
|
|
FormOnLoadCheckIsNull();
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//. 保存嵌入式表单. 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() {
|
|
|
|
|
|
var val = SaveSelfFrom();
|
|
|
if (val == false) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (val != true) {
|
|
|
//就说明是传来的参数,这些参数需要存储到WF_GenerWorkFlow里面去,用于方向条件的判断。
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow");
|
|
|
handler.AddPara("WorkID", GetQueryString("WorkID"));
|
|
|
handler.AddPara("Paras", val);
|
|
|
handler.DoMethodReturnString("SaveParas");
|
|
|
}
|
|
|
|
|
|
Send();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function SysCheckFrm() {
|
|
|
}
|
|
|
|
|
|
function Change() {
|
|
|
var btn = document.getElementById('Btn_Save');
|
|
|
if (btn != null) {
|
|
|
if (btn.value.valueOf('*') == -1)
|
|
|
btn.value = btn.value + '*';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//执行分支流程退回到分合流节点。
|
|
|
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(url, "dialogPage")
|
|
|
}
|
|
|
|
|
|
function WinOpen(url, winName) {
|
|
|
var newWindow = window.open(url, winName, 'width=700,height=400,top=100,left=300,scrollbars=yes,resizable=yes,toolbar=false,location=false,center=yes,center: yes;');
|
|
|
newWindow.focus();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
function DoDelSubFlow(fk_flow, workid) {
|
|
|
if (window.confirm('您确定要终止进程吗?') == false)
|
|
|
return;
|
|
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow");
|
|
|
handler.AddPara("FK_Flow", fk_flow);
|
|
|
handler.AddPara("WorkID", workid);
|
|
|
var data = handler.DoMethodReturnString("DelSubFlow");
|
|
|
|
|
|
alert(data);
|
|
|
Reload();
|
|
|
}
|
|
|
|
|
|
function Do(warning, url) {
|
|
|
if (window.confirm(warning) == false)
|
|
|
return;
|
|
|
SetHref(url);
|
|
|
}
|
|
|
//设置底部工具栏
|
|
|
function SetBottomTooBar() {
|
|
|
var form;
|
|
|
//窗口的可视高度
|
|
|
var windowHeight = document.all ? document.getElementsByTagName("html")[0].offsetHeight : window.innerHeight;
|
|
|
var pageHeight = Math.max(windowHeight, document.getElementsByTagName("body")[0].scrollHeight);
|
|
|
form = document.getElementById('divCCForm');
|
|
|
|
|
|
//设置toolbar
|
|
|
var toolBar = document.getElementById("bottomToolBar");
|
|
|
if (toolBar) {
|
|
|
document.getElementById("bottomToolBar").style.display = "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
window.onload = function () {
|
|
|
// ResizeWindow();
|
|
|
SetBottomTooBar();
|
|
|
};
|
|
|
|
|
|
//然浏览器最大化.
|
|
|
function ResizeWindow() {
|
|
|
if (window.screen) { //判断浏览器是否支持window.screen判断浏览器是否支持screen
|
|
|
var myw = screen.availWidth; //定义一个myw,接受到当前全屏的宽
|
|
|
var myh = screen.availHeight; //定义一个myw,接受到当前全屏的高
|
|
|
window.moveTo(0, 0); //把window放在左上角
|
|
|
window.resizeTo(myw, myh); //把当前窗体的长宽跳转为myw和myh
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function OpenCC() {
|
|
|
var url = $("#CC_Url").val();
|
|
|
var v = window.showModalDialog(url, 'cc', 'scrollbars=yes;resizable=yes;center=yes;minimize:yes;maximize:yes;dialogHeight: 650px; dialogWidth: 850px; dialogTop: 100px; dialogLeft: 150px;');
|
|
|
if (v == '1')
|
|
|
return true;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//关注 按钮.
|
|
|
function FocusBtn(btn, workid) {
|
|
|
|
|
|
if (btn.value == '关注') {
|
|
|
btn.value = '取消关注';
|
|
|
}
|
|
|
else {
|
|
|
btn.value = '关注';
|
|
|
}
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow");
|
|
|
handler.AddPara("WorkID", workid);
|
|
|
var data = handler.DoMethodReturnString("Focus"); //执行保存方法.
|
|
|
|
|
|
}
|
|
|
|
|
|
//确认 按钮.
|
|
|
function ConfirmBtn(btn, workid) {
|
|
|
|
|
|
if (btn.value == '确认') {
|
|
|
btn.value = '取消确认';
|
|
|
}
|
|
|
else {
|
|
|
btn.value = '确认';
|
|
|
}
|
|
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow");
|
|
|
handler.AddPara("WorkID", workid);
|
|
|
var data = handler.DoMethodReturnString("Confirm"); //执行保存方法.
|
|
|
}
|
|
|
|
|
|
//以下是软通写的
|
|
|
//初始化网页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");
|
|
|
//FK_Flow=004&FK_Node=402&FID=0&WorkID=232&IsRead=0&T=20160920223812&Paras=
|
|
|
pageData.FID = GetQueryString("FID") == null ? 0 : GetQueryString("FID");
|
|
|
pageData.WorkID = GetQueryString("WorkID");
|
|
|
pageData.IsRead = GetQueryString("IsRead");
|
|
|
pageData.T = GetQueryString("T");
|
|
|
pageData.Paras = GetQueryString("Paras");
|
|
|
pageData.IsReadonly = GetQueryString("IsReadonly"); //如果是IsReadonly,就表示是查看页面,不是处理页面
|
|
|
pageData.IsStartFlow = GetQueryString("IsStartFlow"); //是否是启动流程页面 即发起流程
|
|
|
|
|
|
pageData.DoType1 = GetQueryString("DoType")//View
|
|
|
//$('#navIframe').attr('src', 'Admin/CCBPMDesigner/truck/centerTrakNav.html?FK_Flow=' + pageData.FK_Flow + "&FID=" + pageData.FID + "&WorkID=" + pageData.WorkID);
|
|
|
}
|
|
|
|
|
|
//将获取过来的URL参数转成URL中的参数形式 &
|
|
|
function pageParamToUrl() {
|
|
|
var paramUrlStr = '';
|
|
|
for (var param in pageData) {
|
|
|
|
|
|
var val = pageData[param];
|
|
|
if (val == null || val == undefined)
|
|
|
continue;
|
|
|
|
|
|
paramUrlStr += '&' + (param.indexOf('@') == 0 ? param.substring(1) : param) + '=' + pageData[param];
|
|
|
}
|
|
|
return paramUrlStr;
|
|
|
}
|
|
|
|
|
|
|
|
|
//设置附件为只读
|
|
|
function setAttachDisabled() {
|
|
|
//附件设置
|
|
|
var attachs = $('iframe[src*="Ath.htm"]');
|
|
|
$.each(attachs, function (i, attach) {
|
|
|
if (attach.src.indexOf('IsReadonly') == -1) {
|
|
|
$(attach).attr('src', $(attach).attr('src') + "&IsReadonly=1");
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
//隐藏下方的功能按钮
|
|
|
function setToobarUnVisible() {
|
|
|
//隐藏下方的功能按钮
|
|
|
$('#bottomToolBar').css('display', 'none');
|
|
|
}
|
|
|
|
|
|
//隐藏下方的功能按钮
|
|
|
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() {
|
|
|
SaveSelfFrom();
|
|
|
}
|
|
|
|
|
|
//退回工作
|
|
|
function returnWorkWindowClose(data) {
|
|
|
|
|
|
if (data == "" || data == "取消") {
|
|
|
$('#returnWorkModal').modal('hide');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$('#returnWorkModal').modal('hide');
|
|
|
//通过下发送按钮旁的下拉框选择下一个节点
|
|
|
if (data.indexOf('SaveOK@') == 0) {
|
|
|
//说明保存人员成功,开始调用发送按钮.
|
|
|
var toNode = 0;
|
|
|
//含有发送节点 且接收
|
|
|
if ($('#DDL_ToNode').length > 0) {
|
|
|
var selectToNode = $('#DDL_ToNode option:selected').data();
|
|
|
toNode = selectToNode.No;
|
|
|
}
|
|
|
|
|
|
execSend(toNode);
|
|
|
//$('[name=Send]:visible').click();
|
|
|
return;
|
|
|
} else {//可以重新打开接收人窗口
|
|
|
winSelectAccepter = null;
|
|
|
}
|
|
|
|
|
|
if (data.indexOf('err@') == 0 || data == "取消") {//发送时发生错误
|
|
|
$('#Message').html(data);
|
|
|
$('#MessageDiv').modal().show();
|
|
|
}
|
|
|
else {
|
|
|
OptSuc(data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//刷新子流程
|
|
|
function refSubSubFlowIframe() {
|
|
|
var iframe = $('iframe[src*="SubFlow.aspx"]');
|
|
|
//iframe[0].contentWindow.location.reload();
|
|
|
iframe[0].contentWindow.location.href = filterXSS(iframe[0].src);
|
|
|
}
|
|
|
//回填扩展字段的值
|
|
|
function SetAth(data) {
|
|
|
var atParamObj = $('#iframeAthForm').data();
|
|
|
var tbId = atParamObj.tbId;
|
|
|
var divId = atParamObj.divId;
|
|
|
var athTb = $('#' + tbId);
|
|
|
var athDiv = $('#' + divId);
|
|
|
|
|
|
$('#athModal').modal('hide');
|
|
|
//不存在或来自于viewWorkNodeFrm
|
|
|
if (atParamObj != undefined && atParamObj.IsViewWorkNode != 1 && divId != undefined && tbId != undefined) {
|
|
|
if (atParamObj.AthShowModel == "1") {
|
|
|
athTb.val(data.join('*'));
|
|
|
athDiv.html(data.join('; '));
|
|
|
} else {
|
|
|
athTb.val('@AthCount=' + data.length);
|
|
|
athDiv.html("附件<span class='badge' >" + data.length + "</span>个");
|
|
|
}
|
|
|
} else {
|
|
|
$('#athModal').removeClass('in');
|
|
|
}
|
|
|
$('#athModal').hide();
|
|
|
var ifs = $("iframe[id^=track]").contents();
|
|
|
if (ifs.length > 0) {
|
|
|
for (var i = 0; i < ifs.length; i++) {
|
|
|
$(ifs[i]).find(".modal-backdrop").hide();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//查看页面的附件展示 查看页面调用
|
|
|
function ShowViewNodeAth(athLab, atParamObj, src) {
|
|
|
var athForm = $('iframeAthForm');
|
|
|
var athModal = $('athModal');
|
|
|
var athFormTitle = $('#athModal .modal-title');
|
|
|
athFormTitle.text("上传附件:" + athLab);
|
|
|
athModal.modal().show();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//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(workNodeData, mapAttr, defVal) {
|
|
|
var operations = '';
|
|
|
//外键类型
|
|
|
if (mapAttr.LGType == 2) {
|
|
|
if (workNodeData[mapAttr.KeyOfEn] != undefined) {
|
|
|
$.each(workNodeData[mapAttr.KeyOfEn], function (i, obj) {
|
|
|
operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
|
|
|
});
|
|
|
}
|
|
|
else if (workNodeData[mapAttr.UIBindKey] != undefined) {
|
|
|
$.each(workNodeData[mapAttr.UIBindKey], function (i, obj) {
|
|
|
operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
var enums = workNodeData.Sys_Enum;
|
|
|
enums = $.grep(enums, function (value) {
|
|
|
return value.EnumKey == mapAttr.UIBindKey;
|
|
|
});
|
|
|
|
|
|
|
|
|
$.each(enums, function (i, obj) {
|
|
|
operations += "<option " + (obj.IntKey == defVal ? " selected='selected' " : "") + " value='" + obj.IntKey + "'>" + obj.Lab + "</option>";
|
|
|
});
|
|
|
|
|
|
}
|
|
|
return operations;
|
|
|
}
|
|
|
|
|
|
//发送
|
|
|
function Send() {
|
|
|
|
|
|
// if (SaveSelfFrom() == false)
|
|
|
// return;
|
|
|
|
|
|
var toNode = 0;
|
|
|
window.hasClickSend = true; //标志用来刷新待办
|
|
|
//含有发送节点 且接收
|
|
|
if ($('#DDL_ToNode').length > 0) {
|
|
|
var selectToNode = $('#DDL_ToNode option:selected').data();
|
|
|
if (selectToNode.IsSelectEmps == "1") {//跳到选择接收人窗口
|
|
|
|
|
|
initModal("sendAccepter", selectToNode);
|
|
|
|
|
|
$('#returnWorkModal').modal().show();
|
|
|
return false;
|
|
|
} else {
|
|
|
toNode = selectToNode.No;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
execSend(toNode);
|
|
|
}
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
setAttachDisabled();
|
|
|
setToobarDisiable();
|
|
|
setFormEleDisabled();
|
|
|
|
|
|
$('#btnMsgModalOK1').bind('click', function () {
|
|
|
window.close();
|
|
|
opener.window.focus();
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
function execSend(toNodeID) {
|
|
|
|
|
|
//先设置按钮等不可用.
|
|
|
setToobarDisiable();
|
|
|
|
|
|
|
|
|
//组织数据.
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow");
|
|
|
handler.AddPara('ToNode', toNodeID);
|
|
|
|
|
|
var data = handler.DoMethodReturnString("Send"); //执行保存方法.
|
|
|
if (data.indexOf('err@') == 0) { //发送时发生错误
|
|
|
mui.alert(data);
|
|
|
setToobarEnable();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (data.indexOf('TurnUrl@') == 0) { //发送成功时转到指定的URL
|
|
|
var url = data;
|
|
|
url = url.replace('TurnUrl@', '');
|
|
|
SetHref(url);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (data.indexOf('SelectNodeUrl@') == 0) {
|
|
|
var url = data;
|
|
|
url = url.replace('SelectNodeUrl@', '');
|
|
|
SetHref(url);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.indexOf('url@') == 0) { //发送成功时转到指定的URL
|
|
|
|
|
|
if (data.indexOf('Accepter') != 0 && data.indexOf('AccepterGener') == -1) {
|
|
|
|
|
|
//求出来 url里面的FK_Node=xxxx
|
|
|
var params = data.split("&");
|
|
|
|
|
|
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", toNodeID);
|
|
|
$('#returnWorkModal').modal().show();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var url = data;
|
|
|
url = url.replace('url@', '');
|
|
|
SetHref(url);
|
|
|
return;
|
|
|
}
|
|
|
OptSuc(data);
|
|
|
}
|
|
|
|
|
|
//发送 退回 移交等执行成功后转到 指定页面
|
|
|
function OptSuc(msg) {
|
|
|
msg = msg.replace("@查看<img src='/WF/Img/Btn/PrintWorkRpt.gif' >", '')
|
|
|
mui.alert(msg.replace(/@/g, '<br/>'),function(){
|
|
|
|
|
|
location.href = "../CCMobilePortal/Home.htm";
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//初始化发送节点下拉框
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
// $('[value=发送]').
|
|
|
var toNodeDDL = $('<select style="width:auto;" id="DDL_ToNode"></select>');
|
|
|
$.each(flowData.ToNodes, function (i, toNode) {
|
|
|
//IsSelectEmps: "1"
|
|
|
//Name: "节点2"
|
|
|
//No: "702"
|
|
|
|
|
|
var opt = "";
|
|
|
if (toNode.IsSelected == "1") {
|
|
|
var opt = $("<option value='" + toNode.No + "' selected='true' >" + toNode.Name + "</option>");
|
|
|
opt.data(toNode);
|
|
|
} else {
|
|
|
var opt = $("<option value='" + toNode.No + "'>" + toNode.Name + "</option>");
|
|
|
opt.data(toNode);
|
|
|
}
|
|
|
|
|
|
toNodeDDL.append(opt);
|
|
|
|
|
|
});
|
|
|
|
|
|
$('[name=Send]').after(toNodeDDL);
|
|
|
}
|
|
|
|
|
|
//根据下拉框选定的值,弹出提示信息 绑定那个元素显示,哪个元素不显示
|
|
|
function showNoticeInfo() {
|
|
|
var workNode = JSON.parse(jsonStr);
|
|
|
var rbs = workNode.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)) {
|
|
|
//高级JS设置; 设置表单字段的 可用 可见 不可用
|
|
|
var fieldConfig = data[j].FieldsCfg;
|
|
|
var fieldConfigArr = fieldConfig.split('@');
|
|
|
for (var k = 0; k < fieldConfigArr.length; k++) {
|
|
|
var fieldCon = fieldConfigArr[k];
|
|
|
if (fieldCon != '' && fieldCon.split('=').length == 2) {
|
|
|
var fieldConArr = fieldCon.split('=');
|
|
|
var ele = $('[name$=' + fieldConArr[0] + ']');
|
|
|
if (ele.length == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
var labDiv = undefined;
|
|
|
var eleDiv = undefined;
|
|
|
if (ele.css('display').toUpperCase() == "NONE") {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (ele.parent().attr('class').indexOf('input-group') >= 0) {
|
|
|
labDiv = ele.parent().parent().prev();
|
|
|
eleDiv = ele.parent().parent();
|
|
|
} else {
|
|
|
labDiv = ele.parent().prev();
|
|
|
eleDiv = ele.parent();
|
|
|
}
|
|
|
switch (fieldConArr[1]) {
|
|
|
case "1": //可用
|
|
|
if (labDiv.css('display').toUpperCase() == "NONE" && ele[0].id.indexOf('DDL_') == 0) {
|
|
|
needShowDDLids.push(ele[0].id);
|
|
|
}
|
|
|
|
|
|
labDiv.css('display', 'block');
|
|
|
eleDiv.css('display', 'block');
|
|
|
ele.removeAttr('disabled');
|
|
|
|
|
|
|
|
|
break;
|
|
|
case "2": //可见
|
|
|
if (labDiv.css('display').toUpperCase() == "NONE" && ele[0].id.indexOf('DDL_') == 0) {
|
|
|
needShowDDLids.push(ele[0].id);
|
|
|
}
|
|
|
|
|
|
labDiv.css('display', 'block');
|
|
|
eleDiv.css('display', 'block');
|
|
|
break;
|
|
|
case "3": //不可见
|
|
|
labDiv.css('display', 'none');
|
|
|
eleDiv.css('display', 'none');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//根据下拉列表的值选择弹出提示信息
|
|
|
if (noticeInfo == undefined || noticeInfo.trim() == '') {
|
|
|
break;
|
|
|
}
|
|
|
noticeInfo = noticeInfo.replace(/\\n/g, '<br/>')
|
|
|
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_NoticeInfo .popover-title span')[0]).text(selectText);
|
|
|
$('#div_NoticeInfo .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_NoticeInfo').height() - 30 < 0) {
|
|
|
//让提示框在下方展示
|
|
|
$('#div_NoticeInfo').removeClass('top');
|
|
|
$('#div_NoticeInfo').addClass('bottom');
|
|
|
top = top;
|
|
|
} else {
|
|
|
$('#div_NoticeInfo').removeClass('bottom');
|
|
|
$('#div_NoticeInfo').addClass('top');
|
|
|
top = top - $('#div_NoticeInfo').height() - 30;
|
|
|
}
|
|
|
$('#div_NoticeInfo').css('top', top);
|
|
|
$('#div_NoticeInfo').css('left', left);
|
|
|
$('#div_NoticeInfo').css('display', 'block');
|
|
|
//$("#btnNoticeInfo").popover('show');
|
|
|
//$('#btnNoticeInfo').trigger('click');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$.each(needShowDDLids, function (i, ddlId) {
|
|
|
$('#' + ddlId).change();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
$('#span_CloseNoticeInfo').bind('click', function () {
|
|
|
$('#div_NoticeInfo').css('display', 'none');
|
|
|
})
|
|
|
|
|
|
$("input[type=radio]:checked,select").change();
|
|
|
$('#span_CloseNoticeInfo').click();
|
|
|
}
|
|
|
|
|
|
//给出文本框输入提示信息
|
|
|
function showTbNoticeInfo() {
|
|
|
var workNode = JSON.parse(jsonStr);
|
|
|
var mapAttr = workNode.Sys_MapAttr;
|
|
|
mapAttr = $.grep(mapAttr, function (attr) {
|
|
|
var atParams = attr.AtPara;
|
|
|
return atParams != undefined && AtParaToJson(atParams).Tip != undefined && AtParaToJson(atParams).Tip != '' && $('#TB_' + attr.KeyOfEn).length > 0 && $('#TB_' + attr.KeyOfEn).css('display') != 'none';
|
|
|
})
|
|
|
|
|
|
$.each(mapAttr, function (i, attr) {
|
|
|
$('#TB_' + attr.KeyOfEn).bind('focus', function (obj) {
|
|
|
var workNode = JSON.parse(jsonStr);
|
|
|
var mapAttr = workNode.Sys_MapAttr;
|
|
|
|
|
|
mapAttr = $.grep(mapAttr, function (attr) {
|
|
|
return 'TB_' + attr.KeyOfEn == obj.target.id;
|
|
|
})
|
|
|
var atParams = AtParaToJson(mapAttr[0].AtPara);
|
|
|
var noticeInfo = atParams.Tip;
|
|
|
|
|
|
if (noticeInfo == undefined || noticeInfo == '')
|
|
|
return;
|
|
|
|
|
|
//noticeInfo = noticeInfo.replace(/\\n/g, '<br/>')
|
|
|
|
|
|
$($('#div_NoticeInfo .popover-title span')[0]).text(mapAttr[0].Name);
|
|
|
$('#div_NoticeInfo .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 (top - $('#div_NoticeInfo').height() - 30 < 0) {
|
|
|
//让提示框在下方展示
|
|
|
$('#div_NoticeInfo').removeClass('top');
|
|
|
$('#div_NoticeInfo').addClass('bottom');
|
|
|
top = top;
|
|
|
} else {
|
|
|
$('#div_NoticeInfo').removeClass('bottom');
|
|
|
$('#div_NoticeInfo').addClass('top');
|
|
|
top = top - $('#div_NoticeInfo').height() - 30;
|
|
|
}
|
|
|
$('#div_NoticeInfo').css('top', top);
|
|
|
$('#div_NoticeInfo').css('left', left);
|
|
|
$('#div_NoticeInfo').css('display', 'block');
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
//将v1版本表单元素转换为v2 杨玉慧 silverlight 自由表单转化为H5表单
|
|
|
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.WF_MyFlow");
|
|
|
handler.AddUrlData(urlParam);
|
|
|
var data = handler.DoMethodReturnString("MyFlowSelfForm_Init");
|
|
|
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert(data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//console.info(data);
|
|
|
jsonStr = data;
|
|
|
var gengerWorkNode = {};
|
|
|
var flow_Data;
|
|
|
|
|
|
try {
|
|
|
|
|
|
flow_Data = JSON.parse(data);
|
|
|
workNodeData = flow_Data;
|
|
|
|
|
|
} catch (err) {
|
|
|
alert("GenerWorkNode转换JSON失败:" + jsonStr);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//设置标题.
|
|
|
document.title = workNodeData.WF_Node[0].Name;
|
|
|
document.getElementById("title").innerHTML = workNodeData.WF_Node[0].Name;
|
|
|
|
|
|
$('#CCForm').html('');
|
|
|
|
|
|
var mapData = workNodeData.Sys_MapData[0];
|
|
|
var wf_node = workNodeData.WF_Node[0];
|
|
|
var frmName = mapData.Name;
|
|
|
|
|
|
var url = wf_node.FormUrl;
|
|
|
if(url.indexOf("@basePath")!=-1)
|
|
|
url = url.replace('@basePath',basePath);
|
|
|
|
|
|
if (url == "")
|
|
|
url = basePath+"/DataUser/DefaultSelfFormUrl.htm";
|
|
|
else
|
|
|
if(url.indexOf("http")==-1)
|
|
|
url = basePath + url;
|
|
|
|
|
|
if (url.indexOf('?') == -1) {
|
|
|
url = url + "?1=2";
|
|
|
}
|
|
|
|
|
|
|
|
|
url += "&WorkID=" + GetQueryString("WorkID") + "&FK_Flow=" + GetQueryString("FK_Flow") + "&FK_Node=" + GetPageParas("FK_Node");
|
|
|
|
|
|
var html = "<iframe ID='SelfForm' src='" + url + "' frameborder=0 style='width:100%; height:100%' leftMargin='0' topMargin='0' />";
|
|
|
|
|
|
$('#CCForm').html("").append(html);
|
|
|
|
|
|
//循环之前的提示信息.
|
|
|
var info = "";
|
|
|
var message ="";
|
|
|
for (var i in flow_Data.AlertMsg) {
|
|
|
var alertMsg = flow_Data.AlertMsg[i];
|
|
|
var alertMsgEle = figure_Template_MsgAlert(alertMsg, i);
|
|
|
message +=alertMsgEle+"<hr/>";
|
|
|
}
|
|
|
|
|
|
if (flow_Data.AlertMsg.length != 0) {
|
|
|
mui.alert(message);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InitToNodeDDL(flow_Data);
|
|
|
|
|
|
Common.MaxLengthError();
|
|
|
|
|
|
|
|
|
showNoticeInfo();
|
|
|
|
|
|
showTbNoticeInfo();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
function figure_Template_MsgAlert(msgAlert, i) {
|
|
|
var html = "";
|
|
|
html+="<div>";
|
|
|
html+="<span class='titleAlertSpan'> " + (parseInt(i) + 1) + ' '+ msgAlert.Title +"</span>";
|
|
|
html+="<div>" + msgAlert.Msg + "</div>";
|
|
|
html+="</div>";
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
var workNodeData = {};
|
|
|
|
|
|
//处理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) + "=" + workNodeData.MainTable[0][paramArr[1].substr('@WebUser.'.length)];
|
|
|
}
|
|
|
if (workNodeData.MainTable[0][paramArr[1].substr(1)] != undefined) {
|
|
|
params[i] = paramArr[0].substring(1) + "=" + workNodeData.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 workNodeData.MainTable[0]) {
|
|
|
if (paramArr[0].substring(1) == ele) {
|
|
|
result = workNodeData.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 pageData = {};
|
|
|
var globalVarList = {};
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
var frm = document.forms["divCCForm"];
|
|
|
|
|
|
initPageParam(); //初始化参数
|
|
|
|
|
|
InitToolBar(); //工具栏.ajax
|
|
|
|
|
|
GenerWorkNode(); //表单数据.ajax
|
|
|
|
|
|
|
|
|
}) |