/***toolbar的图标颜色81C4FF,大小20 */ var wf_node = null; var webUser = new WebUser(); var toolbarPos = getConfigByKey("ToolbarPos", '0'); //签名图片的默认后缀 var btnMenu = null; $(function () { var barHtml = ""; var data; //广西计算中心特意加的一个url参数,用来控制toolbar隐藏 if (GetQueryString("hideAllBtn") === "1") return; var handler = ""; //MyCC if ($("#JS_CC").length == 1) { handler = "BP.WF.HttpHandler.WF_MyCC"; } else if ($("#JS_MyView").length == 1 || $("#JS_MyFrm").length == 1) { handler = "BP.WF.HttpHandler.WF_MyView"; } else { handler = "BP.WF.HttpHandler.WF_MyFlow"; } var handler = new HttpHandler(handler); handler.AddUrlData(); if ($("#JS_MyFrm").length == 1) data = handler.DoMethodReturnString("MyFrm_InitToolBar"); else data = handler.DoMethodReturnString("InitToolBar"); if (data.indexOf("err@") != -1) { alert(data); console.log(data); return; } data = JSON.parse(data); //当前节点的信息 if (data.WF_Node != undefined) wf_node = data.WF_Node[0]; else wf_node = new Entity("BP.WF.Node", paramData.FK_Node); var toolBars = data.ToolBar; if (toolBars == undefined) { toolBars = data; } var _html = ""; var sendBtnOper = ""; $.each(toolBars, function (i, toolBar) { var Oper = ""; if (toolBar.Oper != "") { if (toolBar.No == "Send" || toolBar.No == "SendBtn" || toolBar.No == "Save") Oper = "onclick=\"" + toolBar.Oper + "\""; else Oper = "data-info=\"" + toolBar.Oper + "\""; //Oper = "onclick=\"" + toolBar.Oper + "\""; if (toolBar.No == "Send") sendBtnOper = Oper; } if (toolBar.No == "Save") { //_html += ""; _html += ""; return true; } if (toolBar.No == "NodeToolBar") { //自定义工具栏按钮 var Icon = toolBar.Icon; //自定义的默认按钮 var img = " " //有上传的icon,否则用默认的 if (Icon != "" && Icon != undefined) { var index = Icon.indexOf("\DataUser"); if (index != -1) Icon = Icon.replace(Icon.substr(0, index), "../"); img = " "; } _html += ""; } else { if (toolBar.No == "Send") //_html += ""; _html += ""; else { //_html += ""; _html += ""; } } }); if (toolbarPos == "0") { $('#ToolBar').html(_html); $('#Toolbar').html(_html); $(".layui-header").show(); if (toolBars.length == 0) $(".layui-header").hide(); } if (toolbarPos == "1") { $('#bottomToolBar').html(_html); $('#bottomToolBar').html(_html); $(".layui-footer").show(); $(".layui-header").hide(); $(".layui-fluid").css("padding-top", "0px"); $(".layui-fluid").css("top", "0px"); } //引入数据批阅的js if ($('[name=FrmDBRemark]').length > 0) { loadScript(basePath + "/WF/CCForm/JS/FrmDBRemark.js?t=" + Math.random()); } if ($('[name=FrmDBVer]').length > 0) { loadScript(basePath + "/WF/CCForm/JS/FrmDBVer.js?t=" + Math.random()); } //按钮旁的下来框 if (wf_node != null && wf_node.IsBackTrack == 0) InitToNodeDDL(data, wf_node); //如果启用的按钮操作太多时,自适应高度 if (toolbarPos == "0") { var btnH = $("#ToolBar").height(); if (btnH > 50) { $("#ToolBar").parent().height(btnH); $("#ContentDiv").parent().css("padding-top", btnH + "px"); } } if (toolbarPos == "1") { var btnH = $('#bottomToolBar').height(); if (btnH > 50) { $("#bottomToolBar").parent().height(btnH); $("#ContentDiv").parent().css("padding-bottom", btnH + "px"); } } $('[name=SaveBtn]').attr("saveType", 0); $('.layui-bar').on('click', function () { var oper = $(this).data("info"); if (oper != null && oper != undefined && oper != "") { oper = oper.toString().replace(/~/g, "'"); oper = DealExp(oper, webUser, false); cceval(oper); } }); if ($('[name=Return]').length > 0) { $('[name=Return]').bind('click', function () { //增加退回前的事件 if (typeof beforeReturn != 'undefined' && beforeReturn instanceof Function) if (beforeReturn() == false) return false; if (typeof Save != 'undefined' && Save instanceof Function) Save(1); initModal("returnBack"); }); } //流转自定义 if ($('[name=TransferCustom]').length > 0) { $('[name=TransferCustom]').bind('click', function () { initModal("TransferCustom"); }); } //挂起 if ($('[name=Hungup]').length > 0) { $('[name=Hungup]').bind('click', function () { initModal("Hungup"); }); } if ($('[name=Thread]').length > 0) { $('[name=Thread]').bind('click', function () { initModal("Thread"); }); } if ($('[name=Shift]').length > 0) { $('[name=Shift]').bind('click', function () { initModal("shift"); }); } if ($('[name=Btn_WorkCheck]').length > 0) { $('[name=Btn_WorkCheck]').bind('click', function () { initModal("shift"); }); } if ($('[name=Askfor]').length > 0) { $('[name=Askfor]').bind('click', function () { initModal("askfor"); }); } if ($('[name=Track]').length > 0) { $('[name=Track]').bind('click', function () { initModal("Track"); }); } if ($('[name=HuiQian]').length > 0) { $('[name=HuiQian]').bind('click', function () { initModal("HuiQian"); }); } if ($('[name=AddLeader]').length > 0) { $('[name=AddLeader]').bind('click', function () { initModal("AddLeader"); }); } if ($('[name=CC]').length > 0) { $('[name=CC]').bind('click', function () { initModal("CC"); }); } if ($('[name=PackUp_zip]').length > 0) { $('[name=PackUp_zip]').bind('click', function () { initModal("PackUp_zip"); }); } if ($('[name=PackUp_html]').length > 0) { $('[name=PackUp_html]').bind('click', function () { printHtml(); }); } if ($('[name=PackUp_pdf]').length > 0) { $('[name=PackUp_pdf]').bind('click', function () { initModal("PackUp_pdf"); }); } if ($('[name=PrintDoc]').length > 0) { $('[name=PrintDoc]').bind('click', function () { initModal("PrintDoc"); }); } if ($('[name=PR]').length > 0) { $('[name=PR]').bind('click', function () { initModal("PR"); }); } if ($('[name=SelectAccepter]').length > 0) { $('[name=SelectAccepter]').bind('click', function () { initModal("accepter"); }); } if ($('[name=DBTemplate]').length > 0) { $('[name=DBTemplate]').bind('click', function () { initModal("DBTemplate"); }); } if ($('[name=Delete]').length > 0) { $('[name=Delete]').bind('click', function () { //增加删除前事件 if (typeof beforeDelete != 'undefined' && beforeDelete instanceof Function) if (beforeDelete() == false) return false; DeleteFlow(); }); } if ($('[name=ParentForm]').length > 0) { $('[name=ParentForm]').bind('click', function () { var myPWorkID = GetQueryString("PWorkID"); var myPFlow = GetQueryString("PFlowNo"); if (myPFlow == null) { //取得父流程FK_Flow var gwf = new Entity("BP.WF.GenerWorkFlow", GetQueryString("WorkID")); myPFlow = gwf.PFlowNo; } var url = "MyView.htm?WorkID=" + myPWorkID + "&FK_Flow=" + myPFlow+"&IsReadonly=1"; window.open(url); }); } if ($('[name=CH]').length > 0) { $('[name=CH]').bind('click', function () { initModal("CH"); }); } if ($('[name=Note]').length > 0) { $('[name=Note').bind('click', function () { initModal("Note"); }); } //公文正文组件 if ($('[name=GovDocFile]').length > 0) { $('[name=GovDocFile').bind('click', function () { initModal("GovDocFile"); }); } //公文 if ($('[name=DocWord]').length > 0) { $('[name=DocWord').bind('click', function () { initModal("DocWord"); }); } //回滚 Rollback if ($('[name=Rollback]').length > 0) { $('[name=Rollback]').bind('click', function () { initModal("Rollback"); }); } //跳转 JumpWay if ($('[name=JumpWay]').length > 0) { $('[name=JumpWay]').bind('click', function () { initModal("JumpWay"); }); } //生成二维码 if ($('[name=QRCode]').length > 0) { $('[name=QRCode]').bind('click', function () { initModal("QRCode"); }); } //数据库版本 // if ($('[name=FrmDBVer]').length > 0) { // $('[name=FrmDBVer]').bind('click', function () { initModal("FrmDBVer"); }); //} //小纸条 if ($('[name=Scrip]').length > 0) { $('[name=Scrip]').bind('click', function () { initModal("Scrip"); }); } //评论 if ($('[name=FlowBBS]').length > 0) { $('[name=FlowBBS]').bind('click', function () { initModal("FlowBBS"); }); } //IM if ($('[name=IM]').length > 0) { $('[name=IM]').bind('click', function () { initModal("IM"); }); } //分流节点,查看表单 if ($('[name=OpenFrm]').length > 0) { $('[name=OpenFrm]').bind('click', function () { initModal("OpenFrm"); }); } //切换组织 if ($('[name=ChangeOrg]').length > 0) { $('[name=ChangeOrg]').bind('click', function () { //获取所有的部门 var handler = new HttpHandler("BP.WF.HttpHandler.WF_Setting"); var depts = handler.DoMethodReturnString("ChangeDept_Init"); if (depts.indexOf('err@') == 0) { layer.alert(depts); return; } depts = JSON.parse(depts); if (depts.length == 1) { layer.alert("您只有一个部门[" + depts[0].Name + "],不需要切换部门"); return; } var _html = ""; depts.forEach(function (dept) { if(webUser.FK_Dept === dept.No) _html += '' + dept.Name + '(当前部门)'; else _html += '' + dept.Name + ''; }) layer.open({ title: '切换部门' , content: _html }); }); } //延期发送 if ($('[name=DelayedSend]').length > 0) { $('[name=DelayedSend]').bind('click', function () { DelayedSend(); }); } HelpAlter(); if (typeof AfterToolbarLoad == "function") AfterToolbarLoad(); }); function DelayedSend(formType) { //设置延期发送,需要验证表单填写内容是否全面 if (beforeSendCheck(formType) == false) return false; //需要先保存,当前表单的数据 isSaveOnly = true; $('[name=SaveBtn]').attr("saveType", 1); $('[name=SaveBtn]').trigger("click"); $('[name=SaveBtn]').attr("saveType", 0); if (isSaveOnly == false) return; var toNodeID = 0; var selectToNode; var isSelectEmps = false; if ($('#DDL_ToNode').length > 0) { selectToNode = $('#TB_ToNode').data(); toNodeID = selectToNode.id; if (["1", "2", "3", "4", "5"].includes(selectToNode.IsSelectEmps)) isSelectEmps = true; } if (isSelectEmps == true) { debugger; Send(false, formType,1); return; } var _html = `
`; layui.use(['form', 'layer'], function () { var form = layui.form; var layer = layui.layer; layer.open({ title: '设置延期发送' , content: _html, area: ['auto', '350px'], yes: function (index, layero) { var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow"); handler.AddUrlData(); var day = $("#TB_Day").val() || 0; var hour = $("#TB_Hour").val() || 0; var minute = $("#DDL_Minute").val() || 0; if (day == 0 && hour == 0 && minute == 0) { layer.alert("请设置延期发送的时间"); return; } handler.AddPara("TB_Day", day); handler.AddPara("TB_Hour", hour); handler.AddPara("DDL_Minute", minute); handler.AddPara("ToNodeID", toNodeID); var data = handler.DoMethodReturnString("DelayedSend"); if (data.indexOf("err@") != -1) { layer.alert(data); return; } layer.alert("延期发送设置成功"); layer.close(index); //如果设定了yes回调,需进行手工关闭 closeWindow(); } }); form.render(); }); } function SelectEmps(selectEmpType,toNodeID) { if (selectEmpType == "1") initModal("sendAccepter", toNodeID, 0); } function ChangeDept(deptNo) { if (deptNo == WebUser.FK_Dept) return; var handler = new HttpHandler("BP.WF.HttpHandler.WF_Setting"); handler.AddPara("DeptNo", deptNo); var data = handler.DoMethodReturnString("ChangeDept_Submit"); if (data.indexOf('err@') == 0) { layer.alert(data); return; } SetHref(GetHrefUrl()); } //添加保存动态 function SaveOnly() { $("button[name=Save]").html(" 正在保存..."); try { Save($('[name=SaveBtn]').attr("saveType")); } catch (e) { alert(e); return; } $("button[name=Save]").html(" ...."); setTimeout(function () { $("button[name=Save]").html(" 保存"); }, 300); } function setModalMax() { //设置bootstrap最大化窗口 var w = ddocument.body.clientWidth - 40; $("#returnWorkModal .modal-dialog").css("width", w + "px"); } //初始化退回、移交、加签窗口 function initModal(modalType, toNode, url, isDelayedSend) { $("#returnWorkModal").on('hide.bs.modal', function () { setToobarEnable(); }); var isFrameCross = GetHrefUrl().indexOf(basePath) == -1 ? 1 : 0; var modalIframeSrc = ''; var width = window.innerWidth / 2; var height = 50; var title = ""; if (modalType != undefined) { var isShowColseBtn = 1; switch (modalType) { case "returnBack": title = "退回"; width = window.innerWidth / 2; var node = new Entity("BP.WF.Template.NodeExt", paramData.FK_Node); var info = ""; if (info == "" && node.ReturnField != "") { if ($("#" + node.ReturnField).length == 1) info = $("#" + node.ReturnField).val(); if (info == undefined && $("#TB_" + node.ReturnField).length == 1) info = $("#TB_" + node.ReturnField).val(); if (info == undefined) info = ""; } modalIframeSrc = ccbpmPath + "/WF/WorkOpt/ReturnWork.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=" + info + "&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "Send": SetChildPageSize(80, 80); break; case "TransferCustom": title = "流转自定义"; width = window.innerWidth * 3 / 5; height = 60; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/TransferCustom.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "accpter": title = "工作移交"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Accepter.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; isShowColseBtn = 0; break; case "Thread": case "thread": title = "子线程"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/ThreadDtl.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "shift": title = "工作移交"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Shift.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; isShowColseBtn = 0; break; case "GovDocFile": title = "公文正文"; width = window.innerWidth * 2 / 5; height = 40; modalIframeSrc = ccbpmPath + "/WF/CCForm/GovDocFile.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "DocWord": title = "公文"; width = window.innerWidth * 2 / 5; height = 40; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/DocWord.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "askfor": title = "加签"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Askfor.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "Btn_WorkCheck": title = "审核"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/WorkCheck.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "Track": //轨迹. title = "处理记录、轨迹"; width = window.innerWidth * 4 / 5; height = 80; var workID = paramData.WorkID; if (paramData.WorkID == 0 && paramData.FID != 0) workID = paramData.FID; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/OneWork/OneWork.htm?CurrTab=Truck&FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + workID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "HuiQian": width = window.innerWidth * 4 / 5; height = 80; if (toNode != null) title = "先会签,后发送。"; else title = "加签"; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/HuiQian.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&ToNode=" + toNode + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; isShowColseBtn = 0; break; case "AddLeader": title = "加主持人"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/HuiQian.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&ToNode=" + toNode + "&HuiQianType=AddLeader&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "Hungup": var gwf = new Entity("BP.WF.GenerWorkFlow", paramData.WorkID); if (gwf.WFState == 4) { alert("业务已经被挂起,不可以重复操作."); return; } title = "挂起/延期"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Hungup.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&ToNode=" + toNode + "&HuiQianType=AddLeader&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "CC": title = "抄送"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/CC.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&ToNode=" + toNode + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "PackUp_zip": case "PackUp_html": case "PackUp_pdf": title = "打包下载/打印"; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Packup.htm?FileType=" + modalType.replace('PackUp_', '') + "&FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&Info=&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "PrintDoc": title = "打印单据"; if (wf_node.FormType == 5) { //绑定表单的时候增加一个tab页到页面 var formData = { No: "PrintDoc", "Name": "打印单据" }; vm.openPage(formData); return; } modalIframeSrc = ccbpmPath + "/WF/WorkOpt/PrintDoc.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&s=" + Math.random(); break; case "Press": //$('#modalHeader').text("催办"); //modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Press.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&s=" + Math.random() + "&isFrameCross=" + isFrameCross; break; case "Accepter": case "accepter": title = "选择下一个节点及下一个节点接受人"; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Accepter.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&s=" + Math.random() + "&isFrameCross=" + isFrameCross + "&IsDelayedSend=" + isDelayedSend; isShowColseBtn = 0; break; //发送选择接收节点和接收人 case "sendAccepter": //获取到达节点 var nodeOne = new Entity("BP.WF.Template.NodeSimple", toNode); title = "选择接受人(到达节点:" + nodeOne.Name + ")"; width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = ccbpmPath + "/WF/WorkOpt/Accepter.htm?FK_Node=" + paramData.FK_Node + "&FID=" + paramData.FID + "&WorkID=" + paramData.WorkID + "&FK_Flow=" + paramData.FK_Flow + "&PWorkID=" + GetQueryString("PWorkID") + "&ToNode=" + toNode + "&s=" + Math.random() + "&isFrameCross=" + isFrameCross + "&IsDelayedSend=" + isDelayedSend; isShowColseBtn = 0; break; case "SelectNodeUrl": title = "请选择到达的节点"; // width = 700;// window.innerWidth * 1 / 2; width = window.innerWidth * 0.8; // / 2; height = 100; modalIframeSrc = url; break; case "BySelfUrl"://接收人规则自定义URL width = window.innerWidth * 4 / 5; height = 80; modalIframeSrc = url; if ($("#returnWorkModal .modal-footer").length == 0) { var footBtn = $('