/** *生成PDF * 3.自动生成    1)自动判断电脑是否有安装电子印章key(该key需要公安自行安装)    2)有key,自动生成电子证,并进入下一步    3)没有key,弹框提示。在您在电脑上没有检查到符合相关电子印章信息,请与上级公安机关联系,继续将无法生成电子证书【取消】【继续】    4)生成pdf后,不管有没有盖电子印章,都分发给相应申请者 4.公安端下载保安公司电子证    保安服务公司/培训机构打印页面列表新增一列,列表“电子证书”  列内容【下载】按钮,点击下载,通过浏览器下载已生成的电子证书 * */ /** *确认pdfKey * */ function checkPdfKey(businesstype,businessid){ loadIndex = parent.layer.load(0, {shade: [0.3, '#808080']}); //确认是否有key $.ajax({ type: 'POST', url: restHost + "createpdf/checkStamp.json", dataType: "json", data: { "sid": sid, "businessid": businessid }, // async : false, success: function (json) { parent.layer.close(loadIndex); if (json.successful == true || json.successful == "true") { bulidPdf(businesstype,businessid,true); } else { top.layer.confirm("在您在电脑上没有检查到符合相关电子印章信息,请与上级公安机关联系,继续将无法生成电子证书", { title: "温馨提示", skin: "confirm-class", btn: ['继续', '取消'] //按钮 }, function (index) { bulidPdf(businesstype,businessid,false); parent.layer.close(index); }); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { parent.layer.close(loadIndex); console && console.log(errorThrown); } }); } function bulidPdf(businesstype,businessid,hasStamp){ loadIndex = parent.layer.load(0, {shade: [0.3, '#808080']}); //确认是否有key $.ajax({ type: 'POST', url: restHost + "createpdf/create.json", dataType: "json", data: { "sid": sid, "businessid": businessid, "businesstype":businesstype, "hasStamp":hasStamp }, // async : false, success: function (json) { parent.layer.close(loadIndex); if (json.successful == true || json.successful == "true") { parent.layer.close(loadIndex); toastrSuccess("生成pdf成功!"); } else { toastrSuccess("生成pdf失败:"+json.msg); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { parent.layer.close(loadIndex); console && console.log(errorThrown); } }); } /** * 下载pdf * */ function downloadpdf(){ var pdfurl1= $("#pdf1").val(); var pdfurl2= $("#pdf2").val(); parent.layer.open({ type: 2, title: "下载pdf文件", shadeClose: false, skin: "edit-class editTaskMax2", shade: [0.8, '#222'], closeBtn: 1, scrollbar: false, maxmin: false, //开启最大化最小化按钮 area: ['25%', '40%'], content: ctx + '/iframe/approval/downloadpdf.jsp', success: function (layero, index) { var iframeWin = parent.window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method(); iframeWin.setpdfURL(pdfurl1,pdfurl2); } }); }