var curWwwPath = window.document.location.href; var posi = curWwwPath.lastIndexOf('/'); var localhostPaht = curWwwPath.substring(0, posi); var post = localhostPaht.lastIndexOf('/'); var localhostPaht = curWwwPath.substring(0, post); var nophone="";//数据库中没有电话的用户 chris add 2018/01/10 var nowxid="";//没有绑定微信的用户 chris add 2018/01/10 var noDdid="";//没有绑定钉钉用户 /** * 每次打开表单都根据id保存, * 关闭的时候也要根据id获取值,通过判断是否存在来确定是否要重新打开新页面 * 将cookie * @param pid */ //function closeForm(pid){ // //该公文在打开第一次时关闭才执行更新数据库 // if(!openStatus){ // updateOpendFormById(pid,"N"); // } //} function sendDX(){ var data = '{"phones":"18700850426","content":"请查收短信"}'; $.ajax({ type:"post", // url:"http://xasj.nnghj.gov.cn:8085/DxService//sendDx/send", url:"http://127.0.0.1:8086/sendDx/send", data:data, contentType:"application/json", dataType: "json",//请求参数类型 success: function (result) { console.log("12316546448"); }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.log("0000000"); } }); } /** * 保存更新数据 * @returns */ function saveOrUpdateForm(type,documenttype){ var formdetailjson=getdata("save"); var formdetail = JSON.stringify(formdetailjson); $.post(global.contextPath + global.modelctls.document.save, { formdetail:formdetail, type:type }, function (result) { $("#delete,#filing").css('display','inline'); var status=$("#status").val(); if(status==0){ var ids= new Array(); //定义一数组 ids=result.split(","); if(result!=""){ pid=ids[0]; fid=ids[1]; $('#pid').val(pid); $('#fid').val(fid); } $('#outdispatches').val("cy"); updatefjlog(ids[0]); } pid=$('#pid').val(); saveOrUpdateNbview(pid); //非新建的时候才执行同步 // if(status!=0){ // websocketAsy(loginname_now,pid,action); // }else{ replaceUrl(documenttype); // } }); } function isdeleteing(){ layer.confirm('是否删除该记录!', { btn: ['确定','取消'] //按钮 }, function(){ layer.confirm('保存成功,2s后关闭当前页!', { btn: ['关闭'] //按钮 }, function(){ closewindowtab(); }); setTimeout('closewindowtab()',2000); }, function(){ layer.closeAll(); }); } /** * 发送回退操作 * @param action */ function sendback(action,formdetail){ var str=""; if(action=="rollback"){ str="回退"; $.ajaxSetup({async:false}); $.post(global.contextPath +global.modelctls.document.rollbackUser, {formdetail:formjsonstr }, function (data){ var touser=data; str=str+"至"+touser.loginname; }); }else if(action=="startcountersign"){ str="会签"; } layer.open({ content: '是否'+str+'?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function(){ $.ajax({ type: "POST", async: false, contentType:"application/json", url: documentserver + global.modelctls.document.updateForwardlogs, crossDomain:true, data: JSON.stringify(formdetail), success:function(data, textStatus, jqXHR) { //状态改为已办后 意见表isshow 改为 Y var view = $("#hqOpinion").val(); if(view==""){ layer.closeAll(); layer.msg('请填写会签意见',{icon:2}); return; } var arg={"userid":logginUserId,"isshow":"Y","viewtype":"会签意见"}; $.ajax({ type: "POST", async: false, contentType:"application/json", url: documentserver + "/api/viewinfors/updateViewByUserid", crossDomain:true, data: JSON.stringify(arg), success: function(data, textStatus, jqXHR) { newclose(action,status); refleshList(listType); layer.closeAll(); } }); }, error:function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); } }); } }); } /** * 保存或更新拟办意见 */ function saveOrUpdateNBview(content,viewtype,pid){ if(content!=null) { if(pid!=undefined||pid!=null){ updateview(content,viewtype,pid); }else{ addview(content,viewtype,pid); } } } /*传阅公文列表弹出选人窗口*/ function selectnumbers(url){ var index=parent.layer.open({ type: 2, title: '文号类型', shadeClose: true, shade: 0.3, area: ['350px', '450px'], offset:['50px'], content: url, yes:function(index,layero){}, end:function(index,layero){} }); return index; } /* *保存成功提示 */ function saveformSuccess(){ layer.msg('保存成功',{icon: 1}); } /* *发送成功不关闭页面 * */ function sendSuccessNotClose(){ layer.msg('发送成功',{icon: 1}); } /* *提醒成功不关闭页面 * */ function RemindSuccessNotClose(){ layer.msg('提醒成功',{icon: 1}); } /* *督办成功不关闭页面 * */ function SupervisionSuccessNotClose(){ layer.msg('督办成功',{icon: 1}); } /* *打印不关闭页面 * */ function printSuccessNotClose(){ layer.alert('打印预览(打印发文签)'); } /* *取回成功不关闭页面 * */ function backSuccessNotClose(){ layer.msg('取回成功',{icon: 1}); } /* *归档成功不关闭页面 * */ function archivefileSuccessNotClose(){ layer.msg('办结成功',{icon: 1}); } /* *删除不关闭页面 */ function deleteSuccessNotClose(action){ var flag=false; var str=""; if(action=="filing"){ str="办结"; }else if(action=="delete"){ str="删除"; } layer.confirm('是否'+str+'!', { btn: ['确定','取消'] //按钮 }, function(){ flag=true; }, function(){ flag=false; }); return flag; } /* *发送成功并提示关闭当前标签页 */ function sendSucess(action){ } /* *归档成功并提示关闭当前标签页 */ function archivefileSucess(){ layer.confirm('办结成功,2s后关闭当前页!', { btn: ['关闭'] //按钮 }, function(){ closewindowtab(); }); setTimeout('closewindowtab()',2000); } /* *关闭当前标签页 */ function closewindowtab(){ self.close(); window.opener.location.reload(); } function sendUser(path,selected,action,doctype,formdetail,arg,pidParam){ var index=parent.layer.open({ type: 2, title: '选择用户', shadeClose: true, shade: 0.3, area: ['640px', '550px'], content: path, btn: ['发送', '取消'], yes:function(index,layero){ var body = layer.getChildFrame('body', index); var iframeWin = parent.window[layero.find('iframe')[0]['name']]; var tousers=iframeWin.users(); var checkMessage=iframeWin.setMessageConetent(); var content = iframeWin.dWxWconContent(); //获取短信和微信的发送勾选 var checkWeChatAndMessage = iframeWin.checkMessage(); if(tousers==""||tousers==null||tousers==undefined){ parent.layer.msg('请选择人员',{icon: 2}); return; } // 控制办公室核改和会签不能同时发送 if(tousers.length > 1){ var nameStr = ""; for(var t in tousers){ nameStr += tousers[t].username + ","; } if(nameStr.indexOf("办公室核改人") != -1){ parent.layer.msg('办公室核改和会签请勿同时选取,会签完后会发送到办公室核改',{icon: 2}); return; } } // ------------------------分局内部流转则人为制定节点信息------------------------------------------------------------- // if(logginParentUnit.name != "西安市自然资源和规划局"){ // 现在不需要内部流转 // for(var t in tousers){ // var fuser = {id:tousers[t].userid}; // var user = getUser(fuser); // 获得选择的用户信息 // var dept = findDeptById(user.id); // if(dept.dept_parentname != "西安市自然资源和规划局" && dept.dept_parentname.indexOf("分局") != -1){ // 判断选择发送的人是否为分局的人 // if('' != user.position && null != user.position && user.position.indexOf("信息员") != -1){ // 判断是 信息员 // if("" != tousers[t].stagename && tousers[t].stagename != null && tousers[t].stagename != undefined){ // // } else { // tousers[t].stagename = "分局信息员"; // } // } else { // 不是信息员则人为指定一个节点 // tousers[t].stagename = "内部流转"; // } // } //// else if(dept.dept_parentname != "西安市自然资源和规划局" && dept.dept_parentname.indexOf("分局") == -1){ // 以及不为市局也不为分局 //// if('' != user.position && null != user.position && user.position.indexOf("信息员") != -1){ // 判断是 信息员 //// if("" != tousers[t].stagename && tousers[t].stagename != null && tousers[t].stagename != undefined){ //// //// } else { //// tousers[t].stagename = "处室信息员"; //// } //// } else { // 不是信息员则人为指定一个节点 //// tousers[t].stagename = "内部流转"; //// } // // } // } // } // ------------------------分局内部流转则人为制定节点信息------------------------------------------------------------- parent.layer.open({ content: '是否发送?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function(){ $("#lingdao").css("display","none"); $("#chushi").css("display","none"); if(arg){ if(status=="0"){ if(doctype = "fw"){ // 给发文添加拟稿人 formdetail.seeker = JSON.parse($.cookie('cookieuser')).user.loginname; } // 莫潇楠 2018年4月16日(星期一) 新建公文时可添加意见 var nbyjText = $('#nb_view .div-opinion-content label:first').text().trim(); if(nbyjText){ saveForm(formdetail,listType,"send",nbyjText); }else{ saveForm(formdetail,listType,"send"); } }else{ updateFormData(formdetail,"send"); } isSaveNumber=true; selected=$("#fid").val(); } sendDD(tousers,checkMessage,content); massSend(selected,tousers,action,doctype,checkMessage,content,pidParam, checkWeChatAndMessage); } }); }, end:function(index,layero){ $("#iframecontent").css('display','block'); //2017/7/31 再点击发送之后会影响父页面发送、归档、新建发文等按钮的样式 $(".button-operation").css('display','block'); } }); } /** * 列表批量发送 * @param selected * @param tousers * @param action * @param doctype * @param checkMessage * @returns */ // 不用此发送先注释 function massSend(selected,tousers,action,doctype,checkMessage,content,pidParam, checkWeChatAndMessage){ var agentid = CONF_DOCUMENT_AGENTID ? CONF_DOCUMENT_AGENTID : ""; // var agentid = ""; var wxMobileInfo = getWxMobileInfo(tousers); if(selected.constructor==Array){ for(var i = 0;i<selected.length;i++){ var ids=selected[i]; var userid= logginUserId; var username=loggin_realname; var nextstage=stage==null?"":stage.nextstage; var senderArg={ counterSign:stage.counterSign, userDetail:tousers, fid:ids, sender:username, senderid:userid, action:action, nextStage:nextstage, // 把发送短/微信放到后台 content:content, agentid:agentid, wxname:wxMobileInfo.wxname, mobile:wxMobileInfo.mobile, checkWeChatAndMessage:JSON.stringify(checkWeChatAndMessage) } // 莫潇楠 2018年4月9日(星期一) 修改公文管理可发送给所有人,且环节为局内会签或会签,只有公文管理会传pid if(pidParam){ senderArg.pid = pidParam; } $.ajax({ type: "POST", async: true, dataType:'json', contentType:"application/json", url: documentserver + global.modelctls.document.send, crossDomain:true, data: JSON.stringify(senderArg), success:function(data, textStatus, jqXHR) { // getMobileAndWeChat(tousers,checkMessage, checkWeChatAndMessage); if(listType){ refleshList(listType); }else{ refleshList(doctype); } console.log("发送插入日志表"); //若不为空 则说明存在发送给收文信息员,则将附件复制到新建的分局公文中 if(data.newDocEntityList.length>0){ // copyFileByPid(data.newDocEntityList); //更新分局信息员的所在部门 updateDepartment(data.newDocEntityList); } parent.layer.closeAll(); listType=$("#listType").val(); //防止首页点进详情页发送后报错的问题 //refleshList(listType); newclose(action,1); }, error:function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); alert(errorThrown); } }); } }else{ var ids=selected; var userid= logginUserId; var username=loggin_realname; var nextstage=stage==null?"":stage.nextstage; var senderArg={ counterSign:stage.counterSign, userDetail:tousers, fid:ids, sender:username, senderid:userid, action:action, nextStage:nextstage, // 莫潇楠 2018年7月2日 星期二 把发送短/微信放到后台 content:content, agentid:agentid, wxname:wxMobileInfo.wxname, mobile:wxMobileInfo.mobile, checkWeChatAndMessage:JSON.stringify(checkWeChatAndMessage), curunit:JSON.parse($.cookie('cookieuser')).units[0].name } // 莫潇楠 2018年4月9日(星期一) 修改公文管理可发送给所有人,且环节为局内会签或会签,只有公文管理会传pid if(pidParam){ senderArg.pid = pidParam; } $.ajax({ type: "POST", async: false, dataType:'json', contentType:"application/json", url: documentserver + global.modelctls.document.send, crossDomain:true, data: JSON.stringify(senderArg), success:function(data, textStatus, jqXHR) { // getMobileAndWeChat(tousers,checkMessage, checkWeChatAndMessage); try{ if(listType){ refleshList(listType); }else{ refleshList(doctype); } }catch(err){ console.log(err); }finally{ console.log("发送插入日志表"); //若不为空 则说明存在发送给收文信息员,则将附件复制到新建的分局公文中 if(data.newDocEntityList.length>0){ // copyFileByPid(data.newDocEntityList); //更新分局信息员的所在部门 updateDepartment(data.newDocEntityList); } parent.layer.closeAll(); listType=$("#listType").val(); //防止首页点进详情页发送后报错的问题 //refleshList(listType); newclose(action,1); } }, error:function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); } }); } //列表刷新 } function updateDepartment(data){ var touserid; var tousername; var dataArr; var entity; var docEntity; for(var i=0;i<data.length;i++){ dataArr=data[i]; for(var j=0;j<dataArr.length;j++){ entity=dataArr[j]; touserid=entity.touserid; tousername=entity.tousername; docEntity=entity.document; ajaxUpdateDocDepartment(docEntity,touserid); } } } /** * 更新数据入库 */ function ajaxUpdateDocDepartment(data,userid){ var pid=data.id; //获取发送人的部门 var userInfo=getUserInfoById(userid); var logginUnitid = userInfo.units[0].id; logginParentUnit = getLogginParentUnit(logginUnitid); var arg={ id:pid, department:logginParentUnit.name } $.ajax({ type : "POST", async : false, contentType : "application/json", url : documentserver + global.modelctls.document.updateForm, crossDomain : true, data : JSON.stringify(arg), success : function(data, textStatus, jqXHR) { }, error : function(jqXHR, textStatus, errorThrown) { } }); } /* *发送微信或者短信的判断 * chris add 2018/01/08 */ /*function checkSend(checkMessage,tousers,content){ if(checkMessage=="message"){ sendMessage(tousers,content); }else if(checkMessage=="wechat"){ sendWechat(tousers,checkMessage,content); }else if(checkMessage=="messagewechat"){ sendMessage(tousers,content); sendWechat(tousers,checkMessage,content); } if(checkMessage.indexOf("message")!=-1){ // sendMessage(tousers,content); } if(checkMessage.indexOf("wechat")!=-1){ // sendWechat(tousers,checkMessage,content); } if(checkMessage.indexOf("dd")!=-1 && $.cookie('CONF_STATE_URL')=='1'){ sendDD(tousers,checkMessage,content); } }*/ /** * 发送钉钉js处理 * chris modify 2018/01/08 */ function sendDD(tousers,checkMessage,content){ var userddids=""; for(var i=0;i<tousers.length;i++){ var userDetail=tousers[i]; if(userDetail.ddid!="null" && userDetail.ddid!=""){ userddids+=userDetail.ddid+","; }else{ if(i==tousers.length-1){ noDdid+=userDetail.username; }else{ noDdid+=userDetail.username+","; } } } if(userddids.length>0){ $.ajax({ type:"POST", url: CONF_SENDDD, async : false, data:{ users:userddids, //agentid:CONF_AGENTID, content:content, url:"eapp://page/pages/index/index" //添加点击跳转地址,跳转到钉钉应用的首页 by zj 2018-11-12 }, crossDomain:true, success: function (result) { console.log(result); if(result.errmsg=="ok"&result.invaliduser=="") { msg="ok"; } },error: function(XMLHttpRequest, textStatus, errorThrown) { msg="error"; console.log(XMLHttpRequest); console.log(textStatus); console.log(errorThrown); } }); } /*var userDetail; var touserInfo; var towxname; var flag=false; for(var i=0;i<tousers.length;i++){ userDetail=tousers[i]; touserInfo=getUserInfoById(userDetail.userid); towxname=touserInfo.user.wxname; if(!towxname){ flag=true; continue; } SendWxMessage(towxname,CONF_AGENTID,checkMessage); } if(flag&&sendWechat){ layer.msg('含有未绑定微信的用户',{icon: 2}); }*/ } /** * 发送微信提醒 */ /*function sendWeChatMessage(wxname, content) { var agentid = CONF_DOCUMENT_AGENTID ? CONF_DOCUMENT_AGENTID : ""; $.ajax({ type:"POST", async: true, url: CONF_WX_SERVERURL+"/TextMessageServlet", data:{ touser: wxname, agentid: agentid, content: content }, success: function(result) { console.log(result); //layer.msg("微信发送成功!", {icon : 0}); }, error: function(e) { console.log(e); //layer.msg("微信发送失败!", {icon : 2}); } }); }*/ /** * 发送短信 */ /*function sendSMSMessage(mobile, content) { $.ajax({ type:"POST", async: true, url: CONF_MESSAGE_SERVERURL+ "/api/message/sendMessage", data:{ recivers : mobile, content:content, sendTime: '', curuser:JSON.parse($.cookie('cookieuser')).user.realname, curunit:JSON.parse($.cookie('cookieuser')).units[0].name }, success: function(result) { console.log(result); //layer.msg("短信发送成功!", {icon : 0}); }, error: function(e) { console.log(e); //layer.msg("短信发送失败!", {icon : 2}); } }); }*/ /** * 通过返回的数据 复制附件到新建的公文 */ //function copyFileByPid(list){ // var documents; // var document; // var oldFilePath=""; // var oldpid=""; // var newFilePath=""; // var tousername=""; // var touserid=""; // var entity; // var touser; // var touserUnit; // var arg={}; // for(var i=0;i<list.length;i++){ // documents=list[i]; // for(var j=0;j<documents.length;j++){ // document=documents[j]; // tousername=document.tousername; // touserid=document.touserid; // entity=document.document; // oldpid=entity.memo; // newFilePath=entity.docattachmentpath; // $.ajax({ // type: "POST", // async: false, // url: documentserver + global.modelctls.document.forminfo, // data: {pid:oldpid}, // dataType: "json",//请求参数类型 // success: function(data){ // oldFilePath= data.docattachmentpath; // documentCopyfile(newFilePath,oldFilePath,tousername,touserid); // // },error: function(err) { // console.log("get progress data fail:"+err); // } // }); // // touser=getUserInfoByUserid(touserid); // touserUnit=getLogginParentUnit(touser.units[0].id); // arg={ // id:entity.id, // department:touserUnit.name // }; // updateDocByArg(arg); // } // } //} /** * 自动选取当前角色下的用户 */ function autoSeletedUser(rolename){ if(status=='0'||outdispatches=='拟稿'||isDarfter==true){ //根据客户需求。拟稿的时候直接发给主任意见:先获取同单位下角色为办公室主任的用户 getUserByrole(rolename); } } function getNextStageRole(){ if(stage==null){return roles} var nextstage=stage.nextstage; if(nextstage==null){return roles;} var unitname=stage.unitname; var arr=[]; if(nextstage.indexOf(",")!=-1){ var nextStageArr=nextstage.split(","); var next; var stages; var roleStr=null; var roleid=""; var role=null; var roleidArr=null; for(var i=0;i<nextStageArr.length;i++){ var stageJson={}; var roles=[]; next=nextStageArr[i]; if(next==""){continue;} stages=getStage(documenttype,unitname,next); if(!stages){continue;} roleStr=stages.roleids; if(roleStr==null){continue;} if(roleStr.indexOf(",")!=-1){ roleidArr=roleStr.split(","); for(var j=0;j<roleidArr.length;j++){ roleid=roleidArr[j]; if(roleid!=""){ role=getRoleByRoleid(roleid); if(role){roles.push(role);} } } } stageJson.stage=stages; stageJson.role=roles; arr.push(stageJson); } } return arr; } function getUserByrole(rolename){ $.ajax({ type: "POST", headers:{ "token":$.cookie('ftoken') }, async: false, dataType:'json', contentType:"application/json", url: userserver + global.modelctls.user.getuserlist, crossDomain:true, data: JSON.stringify(user), success:function(data, textStatus, jqXHR) { if(data.length<0){ layer.msg("未登录",{icon: 2}); return; } loggin_realname=data[0].realname; logginUserId=data[0].id; var id=data[0].id; // getUserInfo(data[0].id); }, error:function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); } }); $.post(global.contextPath + global.modelctls.document.getUnitusersByRole, {rolename:rolename}, function (result) { if(result==null||result==undefined){ layer.msg('发送失败,未找到角色',{icon: 2}); return; } var user=result.theUser; var touserunit=result.theUnit; touser={ id:user.id, level:'3', loginname:user.loginname, userUnit:touserunit.name, userUnitId:touserunit.id, theRoles:result.theRoles }; }); } /** * 最新需求关闭窗口方式 2016-6-13 hepo * 5秒自动关闭 */ function newclose(action,arg){ var content = ""; var source = ""; $.ajax({ url: CONF_BACK_SERVERURL+ "/mvc/sctips/tiplist.do", async:false, headers:{ "token":$.cookie('ftoken') }, success:function(data){ if(data.length>0){ var index = Math.floor(Math.random()*data.length); content = data[index].content; source = data[index].source; } }, error:function(){ console.log("获取小贴士菜单出错"); } }) //hyh 新增 让出现自动关闭的页面不出现滚动条 2017/12/27 $("#divPrompt").css("max-height","100%").css("width","45%").css("position","absolute").css("top","50%").css("left","50%").css("transform","translate(-50%, -50%)"); $("#centerFooter").css("display","none"); //$(".button-operation").css('display','none'); $(".button-operation-from").css('display','none'); $("#button_load").css('display','none'); //发送成功后右侧滚动条隐藏 $(".mCSB_dragger_bar").css("display","none"); $("#bodycontent").mCustomScrollbar("scrollTo","top"); var handle=""; if(action=="send"){ handle="发送" }else if(action=="delete"||action=="overDelete"){ handle="删除" }else if(action=="countersign"){ handle="发起会签" }else if(action=="startcountersign"){ handle="会签" }else if(action.indexOf("filing")!=-1){ handle="办结" }else if (action=="overFiling"){ if($("#filing") && $("#filing").text()=="办结"){ handle="办结"; }else{ handle="归档"; } }else if(action=="saveAsdraft"){ handle="存草稿" }else if(action=="rollback"){ handle="回退" }else if(action=="save"){ handle="保存" }else if(action=="takeback"){ handle="取回" }else if(action=="nosupervise"){ handle="取消督办" }else if(action=="supervise"){ handle="督办" } //var tip_logo = getTipLogo(); //var str=$("#action"); //$("#divPrompt").html("<div><img style='width:108px;height:99px;' src='../../../"+tip_logo+"' /><span style='margin-left:20px;font-size:40px'>每日提醒:</span></div>" // +"<div style='margin-top:53px'><span style='font-size:24px'>   "+content+"</span></div>" // +"<div style='margin-top:73px'><span style='position:absolute;right:0px;font-size:24px'>----------《"+source+"》</span></div>"); //$("#bodyContent").before("<div style='text-align:center;color:#0196ea;font-size:24px;position:fixed;top:50px;left:50%;transform:translate(-50%, 0)'><span>"+handle+"成功!窗口将在<label id=\"timeInterval\">5</label>秒后关闭!</span></div>"); //$("#form").css('display','none'); //$("#divPrompt").css('display','block'); //$(window).unbind('beforeunload'); //var status=$("#status").val(); //if(arg||status=="0"){ // setInterval("timestrigger()",1000); //} //var str=$("#action");xiewenlong2018.11.2 //$("#divPrompt span").html(handle+"成功!窗口将在<label id=\"timeInterval\">5</label>秒后关闭!"); //暂不需要提醒 /* if(nophone.length<=0 && nowxid.length<=0 && noDdid.length>0){ $("#divPrompt span").append("<span>"+noDdid+"没有绑定钉钉,无法发送钉钉提醒</span>"); }else if(nophone.length<=0 && nowxid.length>0&& noDdid.length<=0 ){ $("#divPrompt span").append("<span>"+nowxid+"没有绑定微信,无法发送微信提醒</span>"); }else if(nophone.length>0 && nowxid.length<=0 && noDdid.length<=0){ $("#divPrompt span").append("<span>"+nophone+"没有绑定手机号,无法发送短信提醒</span>"); }else if(nophone.length>0 && nowxid.length>0 && noDdid.length>0){ $("#divPrompt span ").append("<span>"+noDdid+"没有绑定钉钉,无法发送钉钉提醒</span>"); $("#divPrompt span span").append("<span>"+nowxid+"没有绑定微信,无法发送微信提醒</span>"); $("#divPrompt span span span").append("<span>"+nophone+"没有绑定手机号,无法发送短信提醒</span>"); }*/ $("#form").css('display','none'); //$("#divPrompt").css('display','block'); var status=$("#status").val(); if(arg||status=="0"){ //setInterval("timestrigger()",1000); closewindowtab(); } } function timestrigger(){ var times=$("#timeInterval").html(); times=times-1; $("#divPrompt").find("span").html("操作成功!窗口将在<label style=\"color:red; font-size:14px\">"+times+"</label>秒后关闭!"); $("#timeInterval").html(times); if(times==0){ clearInterval(); closewindowtab(); } } function getTipLogo(){ var tip_logo; $.ajax({ type:"POST", url:CONF_BACK_SERVERURL+ "/mvc/resource/finResourceByName.do", async:false, headers:{ "token":$.cookie('ftoken') }, dataType:"json", data:{name:"小贴士"}, success:function(data){ tip_logo = data.iconCls; }, error:function(e){ tip_logo = ""; console.log("获取图标出错!"); } }) return tip_logo; } /** * 每秒执行一次 */ function timestrigger(){ var times=$("#timeInterval").html(); times=times-1; //$("#divPrompt").find("span").html("操作成功!窗口将在<label style=\"color:red; font-size:14px\">"+times+"</label>秒后关闭!"); $("#timeInterval").html(times); if(times==0){ clearInterval(); closewindowtab(); } } /** * 关闭弹出窗口,并且关闭当前网页 * @param index */ function closehadle(index,action){ layer.closeAll(); if(action==undefined){//hyh 新增判断,审批改派用到,但是传进来的是undefined,所以在这里加个判断 }else{ newclose(action); } } function rollback(formjsonstr,opnion,signOrNot,type){ $.post(global.contextPath +global.modelctls.document.rollback, {formdetail:formjsonstr, opnion:opnion, signOrNot:signOrNot, type:type }, function (data){ // alert(data); }); } function allSend(tousers,checkMessage,content){ $.ajaxSetup({ async : false // 取消以下异步请求 即执行会按顺序执行,不会跳出最后再执行function(result)内的代码 }); $.post(global.contextPath + global.modelctls.sms.sendAll,{ jsonUserId:tousers, content:content, checkMessage:checkMessage },function(result){ var dXmsg = ""; var wXmsg = ""; if(result[0]!=""){ result[0]=(result[0].substring(result[0].length-1)==',')?result[0].substring(0,result[0].length-1):result[0]; dXmsg = result[0]+"号码不存在"; } if(result[1]!=""){ result[1]=(result[1].substring(result[1].length-1)==',')?result[1].substring(0,result[1].length-1):result[1]; wXmsg += result[1]+"微信号未绑定" } if(checkMessage=="message"){ // if(dXmsg=="") // layer.msg("已发送短信提醒",{icon: 1}); // else // layer.msg(dXmsg,{icon: 2}); }else if(checkMessage=="wechat"){ // if(wXmsg=="") // layer.msg("已发送微信提醒",{icon: 1}); // else // layer.msg(wXmsg,{icon: 2}); }else{ var msg = dXmsg+","+wXmsg; // if(msg==",") // layer.msg("提醒成功",{icon: 1}); // else{ // msg = (msg.substr(0,1)==',')?msg.substr(1):msg; // layer.msg(msg,{icon: 2}); // } } }); } function alertimg(){ layer.open({ type: 1, title: false, closeBtn: 0, area: '516px', skin: 'layui-layer-nobg', //没有背景色 shadeClose: true, content: $('#guidang') }); } //tabid格式如:subMenuApprovalTask_0,其中subMenuApprovalTask为二级目录div的id function iframeLoad(url, tabname, tabid) { $("#iframecontent").attr("src", url); var submenuid = tabid.split("_")[0] displayLeftContent("none");//隐藏首页左侧 $("#" + submenuid).show();//显示二级目录 //$(".menuitem-selected").attr("class", "menuitem waves-effect"); if (tabid != null && tabid != "") { var submenuid = tabid.split("_")[0]; displayLeftContent("none");//隐藏首页左侧 $("#" + submenuid).show();//显示二级目录 menuItemSelected(submenuid.replace("subMenu", "btnMenu"));//一级菜单选中效果 $(".submenuitem").attr("class", "submenuitem waves-effect"); // $("#" + submenuid + " div:first-child").attr("class", "submenuitem waves-effect submenuitem-selected"); $("#" + submenuid).find('.submenuitem')[tabid.split("_")[1]].setAttribute("class", "submenuitem waves-effect submenuitem-selected"); } } /** * 表单最终归档 * @param fid * @returns */ function finnalFiling(fid){ layer.open({ content: '是否归档?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function(){ filling("overFiling",fid,documenttype); parent.layer.closeAll(); } }); } function filingHandle(pid,fid,action,filingDoctype){ var selected = fid; layer.open({ content: '是否办结?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function(){ filling(action,selected,filingDoctype); // newclose(action,'status'); layer.closeAll(); } }); } /** * 删除当前用户所拥有的公文 * 20170106 */ function deleteByfid(selectedId,action){ var index=null; //getdealedlist(currentPage) //列表删除 if(action=="cg_delete"||action=="btnRemove"||action=="cy_delete"){ index=parent.layer.confirm('是否删除!', { btn: ['确定','取消'], //按钮 icon: 3, }, function(){ if(action=="btnRemove"){ action="overDelete"; }else{ action="delete"; } var actions = filling(action,selectedId); parent.layer.closeAll(); }); }else{ //var ids=pid+"/"+fid; //表单详情删除 index=layer.confirm('是否删除!', { btn: ['确定','取消'], //按钮 icon: 3, }, function(){ parent.layer.msg(); if(action == "cy_delete"){ action="delete"; } filling(action,selectedId); //getdealedlist(currentPage); // newclose(action,status); layer.closeAll(); }); } } function getWxMobileInfo(users){ var mobile = []; var no_mobile = []; //没有绑定电话号码的用户 var wxname = []; var no_wxname = []; //没有绑定微信号的用户 var wxMobileInfo = {} for(var i=0; i<users.length; i++) { users[i].usermobile ? mobile.push(users[i].usermobile) : no_mobile.push(users[i].realname); users[i].userwx ? wxname.push(users[i].userwx) : no_wxname.push(users[i].realname); } no_mobile = no_mobile.join(), mobile = mobile.join(); no_wxname = no_wxname.join(), wxname = wxname.join('|'); wxMobileInfo.mobile = mobile; wxMobileInfo.wxname = wxname; return wxMobileInfo; } function getUser(_user){ // 20181211 添加用于查找用户信息 var user=_user; var finduser = null; $.ajax({ type: "POST", async: false, headers:{ "token":$.cookie('ftoken') }, dataType:'json', contentType:"application/json", url: CONF_OURP_SERVERURL + global.modelctls.user.getuserlist, crossDomain:true, data: JSON.stringify(user), success:function(data, textStatus, jqXHR) { finduser = data[0]; }, error:function(jqXHR, textStatus, errorThrown) { finduser = ''; } }); return finduser; } function getRolesById(userid){ // 根据用户id获得角色 var roles; $.ajax({ type: "GET", dataType: "json", headers:{ "token":$.cookie('ftoken') }, url: CONF_OURP_SERVERURL + "/api/v1/role/user/"+userid, async: false, headers:{ "token":$.cookie('ftoken') }, success: function (result) { roles = result; } ,erro:function(result){ roles = ''; } }); return roles; } function findDeptById(_id){ // 根据用户id查找部门 var id = _id; var _dept=''; $.ajax({ cache:false, async: false, headers:{ "token":$.cookie('ftoken') }, type:"POST", url:CONF_OURP_SERVERURL+global.modelctls.user.findDeptById, data:id, contentType: "application/json", success:function(data){ _dept=data; }, error:function(error){ _dept=''; } }) return _dept; }