iframeDemo.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. 
  2. <html>
  3. <link href="js/css/scene.css" rel="stylesheet" type="text/css" />
  4. <link href="js/themes/default/easyui.css" rel="stylesheet" type="text/css" />
  5. <link href="js/themes/icon.css" rel="stylesheet" type="text/css" />
  6. <script src="js/suwell_ofdReader.js" type="text/javascript" charset="UTF-8"></script>
  7. <script src="js/jquery.min.js" type="text/javascript"></script>
  8. <script src="js/jquery.easyui.min.js" type="text/javascript"></script>
  9. <script src="apiurljs.js"></script>
  10. <script src="js/sm4.js"></script>
  11. <script language="JavaScript">
  12. var s4 = new SM4Util();
  13. var params = "?" + s4.decryptData_CBC(decodeURIComponent(location.search.match(new RegExp("[\?\&]data=([^\&]+)", "i"))[1])).replace(/\u0000|\u0001|\u0002|\u0003|\u0004|\u0005|\u0006|\u0007|\u0008|\u0009|\u000a|\u000b|\u000c|\u000d|\u000e|\u000f|\u0010|\u0011|\u0012|\u0013|\u0014|\u0015|\u0016|\u0017|\u0018|\u0019|\u001a|\u001b|\u001c|\u001d|\u001e|\u001f|\u007F/g, "")
  14. if (params.match(new RegExp("[\?\&]type=([^\&]+)", "i")) != null) {
  15. var type = params.match(new RegExp("[\?\&]type=([^\&]+)", "i"))[1];
  16. var file = params.match(new RegExp("[\?\&]file=([^\&]+)", "i"))[1];
  17. }
  18. var tablename = params.match(new RegExp("[\?\&]tablename=([^\&]+)", "i"))[1];
  19. var routeinfoid = params.match(new RegExp("[\?\&]routeinfoid=([^\&]+)", "i"))[1];
  20. var ocx;
  21. function initObject() {
  22. ocx = suwell.ofdReaderInit("OFDActiveXDIV", "1100px", "950px");
  23. if (ocx) {
  24. if (type == 0) {
  25. //有ofd文件根据数据库所存字段获取文件
  26. //if (file.slice(file.lastIndexOf(".")) == ".ofd") {
  27. ocx.downloadHttpFile(apiurljs.ofdUrl + "g2work/files/" + file, "/tmp/" + tablename + routeinfoid + file.slice(file.lastIndexOf(".")), "md5");
  28. //} else {
  29. // ocx.openFile(apiurljs.ofdUrl + "g2work/files/" + file, false);
  30. //}
  31. //ocx.openFile(apiurljs.ofdUrl+"g2workweb/UploadAttach/" + file + ".ofd", false);
  32. //setTimeout(function () {
  33. // ocx.saveFile("/tmp/" + tablename + routeinfoid + ".ofd");
  34. // ocx.openFile("/tmp/" + tablename + routeinfoid + ".ofd");
  35. //},2000)
  36. } else {//没有ofd文件根据routeinfoid获取文件
  37. ocx.downloadHttpFile(apiurljs.ofdUrl+"g2workweb/UploadAttach/ofd/" + tablename + routeinfoid, "/tmp/" + tablename + routeinfoid + ".ofd", "md5");
  38. //ocx.openFile(apiurljs.ofdUrl+"g2workweb/UploadAttach/ofd/" + tablename + routeinfoid + ".ofd", false);
  39. //setTimeout(function () {
  40. // ocx.saveFile("/tmp/" + tablename + routeinfoid + ".ofd");
  41. // ocx.openFile("/tmp/" + tablename + routeinfoid + ".ofd", false);
  42. //}, 2000)
  43. }
  44. ocx.registListener("downloadfile", "dlPerformed", true);//监听方法
  45. }
  46. }
  47. function saveFile() {
  48. ocx.performClick("f_save");//点击保存事件
  49. //提交函数
  50. var saveresult = ocx.saveFile(apiurljs.ofdUrl + "g2app/abase/saveOfdFileName?tablename=" + tablename + "&column=OFDLIST&ofdstatus=0&routeinfoid=" + routeinfoid);
  51. if (saveresult == true) {
  52. alert("保存成功!")
  53. } else {
  54. alert("保存失败!")
  55. }
  56. }
  57. function signFile() {
  58. ocx.performClick("t_tablet");//点击手签笔事件
  59. }
  60. function sealFile() {
  61. ocx.performClick("t_sealsign");//点击印章事件
  62. }
  63. function dlPerformed() {
  64. ocx.openFile("/tmp/" + tablename + routeinfoid + file.slice(file.lastIndexOf(".")), false)
  65. }
  66. //base64加密
  67. function base64(str) {
  68. // 对字符串进行编码
  69. var encode = encodeURI(str);
  70. // 对编码的字符串转化base64
  71. var base64 = btoa(encode);
  72. return base64;
  73. }
  74. //base64解密
  75. function decode(base64) {
  76. // 对base64转编码
  77. var decode = atob(base64);
  78. // 编码转字符串
  79. var str = decodeURI(decode);
  80. return str;
  81. }
  82. </script>
  83. <body onload="initObject();" style="overflow-y:hidden">
  84. <!--<div style="width:100%;text-align:right">
  85. <span style=" outline: none; border: 0; padding: 5px 15px; background: #bdc7d4; color: #000; margin: 1px 3px; cursor: pointer;" onclick="saveFile()">保存</span>
  86. <span style=" outline: none; border: 0; padding: 5px 15px; background: #bdc7d4; color: #000; margin: 1px 3px; cursor: pointer;" onclick="signFile()">签字</span>
  87. <span style=" outline: none; border: 0; padding: 5px 15px; background: #bdc7d4; color: #000; margin: 1px 3px; cursor: pointer;" onclick="sealFile()">印章</span>
  88. </div>-->
  89. <div style="width: 100%;text-align:center">
  90. <div id="OFDActiveXDIV"></div>
  91. </div>
  92. <script>
  93. function closeQian() {
  94. window.parent.closeQian()
  95. }
  96. </script>
  97. </body>
  98. </html>