GLJ1.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. //} 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) {
  74. // if (self.type == 1) {
  75. // flowid = "AA65"
  76. // } else {
  77. // flowid = "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA98|AA0A|AA99|AA0E|AA0P"
  78. // }
  79. //} else if ("AA16|AA18".indexOf(self.flowid) > -1) {
  80. // flowid = "AA65"
  81. //}
  82. var data = {
  83. flowid: flowid,
  84. userid: self.userId,
  85. infostatus: "START|DEAL|STOP",
  86. pagesize: 10,
  87. pageno: pageno
  88. }
  89. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRelateFlowWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  90. .success(function (obj) {
  91. var res = strToJson(s4.decryptData_CBC(obj.data));
  92. self.gljList = res.data;
  93. self.total_count = res.totalCount
  94. })
  95. }
  96. self.subFLOW = function (item) {
  97. var data = {
  98. routeinfoid: self.type == 1 ? self.routeinfoid : item.ROUTEINFOID,
  99. lastrouteinfoid: self.type == 1 ? item.ROUTEINFOID : self.routeinfoid
  100. }
  101. $http.post(apiurljs.login + "g2work/routeinfo/updateRelateWithRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  102. .success(function (obj) {
  103. var res = strToJson(s4.decryptData_CBC(obj.data))
  104. if (res.success) {
  105. self.type = 0;
  106. self.getGLJ()
  107. } else {
  108. sp.dialog(res.message)
  109. }
  110. })
  111. }
  112. self.delFLOW = function (item) {
  113. var data = {
  114. routeinfoid: self.type == 1 ? item.ROUTEINFOID : item.LASTROUTEINFOID,
  115. lastrouteinfoid: self.type == 1 ? item.LASTROUTEINFOID : item.ROUTEINFOID
  116. }
  117. $http.post(apiurljs.login + "g2work/routeinfo/cancelRelateWithRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  118. .success(function (obj) {
  119. var res=strToJson(s4.decryptData_CBC(obj.data))
  120. if (res.success) {
  121. self.type = 0;
  122. self.getGLJ()
  123. } else {
  124. sp.dialog(res.message)
  125. }
  126. })
  127. }
  128. }])