testWO.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. </head>
  8. <body>
  9. <button id="btn">打开编辑</button>
  10. <button onclick="btnPreview()">在线预览</button>
  11. <script src="../../js/jquery.min.js"></script>
  12. <script type="text/javascript">
  13. function btnPreview() {
  14. var set_convertType = 0;
  15. //if (obj.FILEEXT == "doc") {
  16. // set_convertType = 0;
  17. //} else if (obj.FILEEXT == "pdf") {
  18. // set_convertType = 20;
  19. //} else if (obj.FILEEXT == "ofd") {
  20. // set_convertType = 570;
  21. //} else {
  22. // set_convertType = 0;
  23. //}
  24. ////http://10.233.22.204:8088/glwork/g2work/files/4d8c3459225b48c6cafbb566136cac7f/166b0abc34fa497c43d27018acef4884/e8b7afe5be84.xls
  25. let postData = {
  26. convertType: 0,
  27. fileUrl:"http://10.233.22.204:8088/glwork/g2work/files2/inline/6dcdadb1f70f8eff8360d97566957c62/2ab09aea96928e078003283d1fdb3591/e696b0e5bbba204d6963726f736f667420576f726420e69687e6a1a3.doc"
  28. };
  29. $.ajax({
  30. url: "http://10.233.22.204:8088/fcscloud/composite/httpfile",
  31. data: {
  32. jsonParams: encodeURIComponent(JSON.stringify(postData))
  33. },
  34. type: "POST",
  35. dataType: "json",
  36. general: false,
  37. async: false,
  38. success: function (data) {
  39. console.log(data);
  40. if (data) {
  41. if (data.errorCode === "0") {
  42. let rst = data.result;
  43. console.log(rst.urls);
  44. if (rst && rst.urls) {
  45. window.open(get_urls, "_blank");
  46. } else {
  47. console.warn("ajax响应内容data.result有问题:" + rst);
  48. }
  49. } else {
  50. alert(data.errorMessage);
  51. }
  52. } else {
  53. console.warn("ajax响应内容为空!");
  54. }
  55. },
  56. });
  57. ///20230324---zyg ---永中转换-----end
  58. }
  59. var setstr="%7B%22method%22%3A1%2C%22params%22%3A%7B%22userId%22%3A%2210.222.33.204%22%2C%22fileId%22%3A%22bcc3655a692547259a2f2335f78cd52f_1262116709%22%2C%22filePath%22%3A%22%2F5G%E7%BB%BD%E6%94%BE%E6%9D%AF%EF%BC%88%E7%AC%AC%E5%9B%9B%E5%B1%8A%EF%BC%89.docx%22%2C%22userRight%22%3A0%2C%22mobileFlag%22%3Afalse%2C%22saveFlag%22%3Atrue%7D%2C%22indexFlag%22%3Atrue%7D";
  60. //console.log(decodeURIComponent(setstr));
  61. //{"method":1,"params":{"userId":"10.222.33.204","fileId":"bcc3655a692547259a2f2335f78cd52f_1262116709","filePath":"/5G绽放杯(第四届).docx","userRight":0,"mobileFlag":false,"saveFlag":true},"indexFlag":true}
  62. //let data = {
  63. // method: 1,
  64. // params: {
  65. // userId: "10.222.33.204",
  66. // fileId: "bcc3655a692547259a2f2335f78cd52f_1262116709",
  67. // filePath: "/5G绽放杯(第四届).docx"
  68. // }
  69. //};
  70. //let data = {
  71. // method: 1,
  72. // params: {
  73. // userId: "2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf",
  74. // fileId: "111121",
  75. // fileName:"路径.xls",
  76. // filePath: "http://10.233.22.204:8088/glwork/g2work/files/4d8c3459225b48c6cafbb566136cac7f/166b0abc34fa497c43d27018acef4884/e8b7afe5be84.xls"
  77. // //文件的绝对路径,如果配置文件webOffice.properties里面的filePath值有效,则此处参数为相对路径
  78. // }
  79. //};
  80. ///自定义表单工作梳理.doc
  81. ///http://10.233.22.204:8088/glwork/g2work/files2/inline/865e508cb0c706bd2e09e73f2168cb8a/431d39d5e28fec47bc346a3b8e2f35f7/e887aae5ae9ae8a1a8e58d95e5b7a5e4bd9ce9878fe9878de696b0e6a2b3e79086.doc
  82. let data = {
  83. method: 1,
  84. params: {
  85. userId: "2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf",
  86. fileId: "111121",
  87. fileName: "测试永中转换.pdf",
  88. filePath: "http://10.233.22.204:8088/glwork/g2work/files2/inline/701eb9dd32a111e5b0a3d0eeb25920c7/00907aaf12fb2b4a846358e6d5b7f2fe/e6b58be8af95e6b0b8e4b8ade8bdace68da2.pdf"
  89. //文件的绝对路径,如果配置文件webOffice.properties里面的filePath值有效,则此处参数为相对路径
  90. }
  91. };
  92. $("#btn").click(function(){
  93. $.ajax({
  94. url: apiurljs.yzFileWo + "api.do",
  95. //url: "http://10.4.23.31/api.do",
  96. data: {
  97. jsonParams: encodeURIComponent(JSON.stringify(data))
  98. },
  99. type: "POST",
  100. dataType: "json",
  101. general: false,
  102. async: false,
  103. success: function (data) {
  104. console.log(data);
  105. if (data) {
  106. if (data.errorCode === "0") {
  107. let rst = data.result;
  108. console.log(rst.urls);
  109. if (rst && rst.urls) {
  110. var get_urls = rst.urls;
  111. if (typeof (get_urls) === "string") {
  112. window.open(get_urls, "_blank");
  113. } else if ($.isArray(get_urls) && get_urls.length) {
  114. get_urls.forEach(url, function () {
  115. if (url) {
  116. window.open(url, "_blank");
  117. }
  118. });
  119. } else {
  120. console.warn("无效的urls:" + get_urls);
  121. }
  122. } else {
  123. console.warn("ajax响应内容data.result有问题:" + rst);
  124. }
  125. } else {
  126. alert(data.errorMessage);
  127. }
  128. } else {
  129. console.warn("ajax响应内容为空!");
  130. }
  131. },
  132. });
  133. });
  134. </script>
  135. </body>
  136. </html>