GLJ1.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("GLJCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
  6. var self = this;
  7. var s4 = new SM4Util();
  8. self.userId = $.cookie("GlWorkPlatform-userid");
  9. self.userName = $.cookie("GlWorkPlatform-chineseName");
  10. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  11. self.routeid = sp.getUrlName("routeid");
  12. self.routeinfoid = sp.getUrlName("routeinfoid");
  13. self.copyrightid = sp.getUrlName("copyrightid");
  14. self.directionid = sp.getUrlName("directionid");
  15. self.formeditid = sp.getUrlName("formeditid");
  16. self.flowid = sp.getUrlName("flowid");
  17. var postCfg = {
  18. headers: {
  19. 'Content-Type': 'application/json',
  20. 'Authorization': "Bearer " + self.get_AccessToken
  21. }
  22. };
  23. //var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  24. // return item.CNAME
  25. //})
  26. self.getGLJ = function () {
  27. var data = {
  28. userid: self.userid,
  29. routeinfoid: self.routeinfoid
  30. }
  31. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRelatedFlow", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  32. .success(function (obj) {
  33. var res = strToJson(s4.decryptData_CBC(obj.data));
  34. self.FLOWIN = res.data.FLOWIN;
  35. self.FLOWIN.forEach(function (item) {
  36. if (!item.LASTROUTEINFOID) {
  37. item.FILEN.split("&").forEach(function (item1) {
  38. if (item1.indexOf("lastrouteinfoid") > -1) {
  39. item.LASTROUTEINFOID = item1.split("=")[1]
  40. }
  41. })
  42. }
  43. })
  44. self.FLOWOUT = res.data.FLOWOUT;
  45. self.FLOWOUT.forEach(function (item) {
  46. if (!item.LASTROUTEINFOID) {
  47. item.FILEN.split("&").forEach(function (item1) {
  48. if (item1.indexOf("lastrouteinfoid") > -1) {
  49. item.LASTROUTEINFOID = item1.split("=")[1]
  50. }
  51. })
  52. }
  53. })
  54. })
  55. }
  56. self.getGLJ()
  57. //AA16、AA18收文
  58. //AA65签报
  59. //AA20、AA03、AA10、AA55、AA56、AA57、AA08、AA23、AA77、AA06行政发文
  60. //AA88、AA89、AA46、AA22、AA54党委发文
  61. //AA98、AA0A、AA99、AA0E、AA0P机关党建
  62. //n等于1为上关联,n等于2为下关联
  63. self.type = 0;
  64. self.CREATFLOW = function (n, pageno) {
  65. self.type = n;
  66. var flowid = "AA16|AA18|AA65|AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA98|AA0A|AA99|AA0E|AA0P";
  67. //if (self.flowid == "AA65") {
  68. // if (self.type == 1) {
  69. // flowid = "AA16|AA18"
  70. // } else {
  71. // flowid = "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA98|AA0A|AA99|AA0E|AA0P"
  72. // }
  73. //}
  74. //else if ("AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA98|AA0A|AA99|AA0E|AA0P".indexOf(self.flowid) > -1) {
  75. // if (self.type == 1) {
  76. // flowid = "AA65"
  77. // } else {
  78. // flowid = "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA98|AA0A|AA99|AA0E|AA0P"
  79. // }
  80. //}
  81. //else if ("AA16|AA18".indexOf(self.flowid) > -1) {
  82. // flowid = "AA65"
  83. //}
  84. var data = {
  85. flowid: flowid,
  86. userid: self.userId,
  87. infostatus: "START|DEAL|STOP",
  88. pagesize: 10,
  89. pageno: pageno
  90. }
  91. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRelateFlowWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  92. .success(function (obj) {
  93. var res = strToJson(s4.decryptData_CBC(obj.data));
  94. self.gljList = res.data;
  95. self.total_count = res.totalCount
  96. })
  97. }
  98. self.subFLOW = function (item) {
  99. var data = {
  100. routeinfoid: self.type == 1 ? self.routeinfoid : item.ROUTEINFOID,
  101. lastrouteinfoid: self.type == 1 ? item.ROUTEINFOID : self.routeinfoid
  102. }
  103. $http.post(apiurljs.login + "g2work/routeinfo/updateRelateWithRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  104. .success(function (obj) {
  105. var res = strToJson(s4.decryptData_CBC(obj.data))
  106. if (res.success) {
  107. self.type = 0;
  108. self.getGLJ()
  109. } else {
  110. sp.dialog(res.message)
  111. }
  112. })
  113. }
  114. self.delFLOW = function (item) {
  115. var data = {
  116. routeinfoid: self.type == 1 ? item.ROUTEINFOID : item.LASTROUTEINFOID,
  117. lastrouteinfoid: self.type == 1 ? item.LASTROUTEINFOID : item.ROUTEINFOID
  118. }
  119. $http.post(apiurljs.login + "g2work/routeinfo/cancelRelateWithRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  120. .success(function (obj) {
  121. var res=strToJson(s4.decryptData_CBC(obj.data))
  122. if (res.success) {
  123. self.type = 0;
  124. self.getGLJ()
  125. } else {
  126. sp.dialog(res.message)
  127. }
  128. })
  129. }
  130. }])