detail1.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) {
  5. var self = this;
  6. var s4 = new SM4Util();
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  11. self.get_type = sp.getUrlName("type");
  12. self.get_id = sp.getUrlName("ID");
  13. self.return = "list1.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  14. var postCfg = {
  15. headers: {
  16. 'Content-Type': 'application/json',
  17. 'Authorization': "Bearer " + self.get_AccessToken
  18. }
  19. };
  20. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  21. self.Title = "表单"
  22. self.SwenList = [{
  23. VNAME: "表单",
  24. TEMPFORM: "#"
  25. }, {
  26. VNAME: "附件",
  27. TEMPFORM: "detail2.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno
  28. }, {
  29. VNAME: "稿件",
  30. TEMPFORM: "detail3.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno
  31. }];
  32. self.getData = function () {
  33. var data = {
  34. tablename: "DOCELEMENT",
  35. colums: "*",
  36. order: "ID",
  37. sqlwhere: { ID: self.get_id },
  38. sqlorwhere: "",
  39. sqlinwhere: "",
  40. sqllikewhere: ""
  41. };
  42. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  43. .success(function (obj) {
  44. var res = strToJson(s4.decryptData_CBC(obj.data));
  45. var data1 = {
  46. tablename: "DANGANATTACHFILE",
  47. colums: "*",
  48. order: "ID",
  49. sqlwhere: { ROUTEINFOID: res.data[0].ROUTEINFOID, ATTACHTYPE: "FORM_PDF" },
  50. sqlorwhere: "",
  51. sqlinwhere: "",
  52. sqllikewhere: ""
  53. }
  54. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  55. .success(function (obj1) {
  56. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  57. console.log(res1)
  58. self.bd = false;
  59. res1.data.forEach(function (item) {
  60. console.log(item)
  61. if (item.FILEEXT == "pdf") {
  62. self.bd = true;
  63. $.ajax({
  64. url: apiurljs.login.split("glwork")[0] + "fcscloud/composite/httpfile",
  65. type: "post",
  66. dataType: 'json',
  67. contentType: "application/x-www-form-urlencoded",
  68. data: {
  69. convertType: 20,
  70. fileUrl: apiurljs.login + "g2work/files2/inline/" + item.FILEURL.slice(7)
  71. },
  72. success: function (res) {
  73. if (res.errorcode === 0) {
  74. let rst = res.data;
  75. $("#iframe").css("width", $(".ibox-content").width()).css("height", $(window).height() - 113);
  76. $("#iframe").attr("src", rst.viewUrl)
  77. } else {
  78. console.log(res.message);
  79. }
  80. }
  81. })
  82. }
  83. })
  84. })
  85. self.getReturnList(res.data[0].ROUTEINFOID)
  86. })
  87. }
  88. self.getData()
  89. self.returnList = [];
  90. self.getReturnList = function (routeinfoid) {
  91. var data = {
  92. routeinfoid: routeinfoid,
  93. tablename: "DOCELEMENT_01"
  94. }
  95. $http.post(apiurljs.login + "g2app/DangAn/GetDataListForPid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  96. .success(function (obj) {
  97. var res = strToJson(s4.decryptData_CBC(obj.data));
  98. self.returnList = res.data;
  99. self.returnListShow = false;
  100. self.selectReturn = self.returnList[0];
  101. $.each(self.returnList, function (index, item) {
  102. item.BACKDATE1 = sp.format(item.BACKDATE);
  103. item.BACKDATE = sp.formatMinute(item.BACKDATE);
  104. item.BACKOPINION1 = item.BACKOPINION.length > 12 ? item.BACKOPINION.slice(0, 12) + "..." : item.BACKOPINION;
  105. })
  106. })
  107. }
  108. //头部下滚冻结
  109. $(function () {
  110. $(".sp-page-center").eq(0).css("max-height", $(window).height() - 160).css("height", $(window).height() - 160)
  111. //页面高度撑满
  112. setTimeout(function () {
  113. if ($(".ibox-content").height() < $(window).height() - 31) {
  114. $(".ibox-content").css("height", $(window).height() - 31)
  115. }
  116. }, 1)
  117. })
  118. }])