detail3.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
  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.Title = "稿件"
  21. self.SwenList = [{
  22. VNAME: "表单",
  23. TEMPFORM: "detail1.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno
  24. }, {
  25. VNAME: "附件",
  26. TEMPFORM: "detail2.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno
  27. }, {
  28. VNAME: "稿件",
  29. TEMPFORM: "#"
  30. }];
  31. self.getData = function () {
  32. var data = {
  33. tablename: "DOCELEMENT",
  34. colums: "*",
  35. order: "ID",
  36. sqlwhere: { ID: self.get_id },
  37. sqlorwhere: "",
  38. sqlinwhere: "",
  39. sqllikewhere: ""
  40. };
  41. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  42. .success(function (obj) {
  43. var res = strToJson(s4.decryptData_CBC(obj.data));
  44. self.routeinfoid = res.data[0].ROUTEINFOID;
  45. var data1 = {
  46. tablename: "DANGANATTACHFILE",
  47. colums: "*",
  48. order: "ID",
  49. sqlwhere: { ROUTEINFOID: self.routeinfoid, ATTACHTYPE: "CWG_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. self.zhengwen = res.data;
  58. self.getReturnList()
  59. })
  60. })
  61. }
  62. self.getData()
  63. self.returnList = [];
  64. self.getReturnList = function () {
  65. var data = {
  66. routeinfoid: self.routeinfoid,
  67. tablename: "DOCELEMENT_01"
  68. }
  69. $http.post(apiurljs.login + "g2app/DangAn/GetDataListForPid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  70. .success(function (obj) {
  71. var res = strToJson(s4.decryptData_CBC(obj.data));
  72. self.returnList = res.data;
  73. self.returnListShow = false;
  74. self.selectReturn = self.returnList[0];
  75. $.each(self.returnList, function (index, item) {
  76. item.BACKDATE1 = sp.format(item.BACKDATE);
  77. item.BACKDATE = sp.formatMinute(item.BACKDATE);
  78. item.BACKOPINION1 = item.BACKOPINION.length > 12 ? item.BACKOPINION.slice(0, 12) + "..." : item.BACKOPINION;
  79. })
  80. })
  81. }
  82. self.browse = function (item) {
  83. var set_convertType = 0;
  84. if (item.FILEEXT == "doc") {
  85. set_convertType = 0;
  86. } else if (item.FILEEXT == "pdf") {
  87. set_convertType = 20;
  88. } else if (item.FILEEXT == "ofd") {
  89. set_convertType = 570;
  90. } else {
  91. set_convertType = 0;
  92. }
  93. let postData = {
  94. convertType: set_convertType,
  95. fileUrl: apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL
  96. };
  97. var postCfg_transfer = {
  98. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  99. transformRequest: function (data) {
  100. return $.param(data);
  101. }
  102. };
  103. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  104. .success(function (res) {
  105. //console.log(res);
  106. if (res.errorcode === 0) {
  107. $("#iframe_WO").css("width", $(".col-md-10").width() - 10).css("height", $(window).height() - 125);
  108. $("#iframe_WO").attr("src", res.data.viewUrl);
  109. } else {
  110. sp.dialog(res.message);
  111. }
  112. });
  113. }
  114. //头部下滚冻结
  115. $(function () {
  116. $(".sp-page-center").css("max-height", $(window).height() - 58).css("height", $(window).height() - 58)
  117. //页面高度撑满
  118. setTimeout(function () {
  119. if ($(".ibox-content").height() < $(window).height() - 31) {
  120. $(".ibox-content").css("height", $(window).height() - 31)
  121. }
  122. }, 1)
  123. $(".sp-bgMask").bind("click", function () {
  124. $('.sp-page-center').show(); $('.Browse').attr('src', $('.Browse').attr('src'));
  125. });
  126. })
  127. }])