list.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$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.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  12. self.get_type = sp.getUrlName("type");
  13. var postCfg = {
  14. headers: {
  15. 'Content-Type': 'application/json',
  16. 'Authorization': "Bearer " + self.get_AccessToken
  17. }
  18. }
  19. self.zonglan = true;
  20. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  21. self.getData = function () {
  22. self.list1 = [];
  23. self.list2 = [];
  24. var data = {
  25. fwflow: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA55|AA56|AA98|AA99|AA0A|AA0P",
  26. swflow: "AA18|AA16",
  27. yzflow: "",
  28. begindate: "",
  29. enddate: ""
  30. }
  31. $http.post(apiurljs.login + "g2app/richang/GongWenStatistics", data, postCfg)
  32. .success(function (res) {
  33. if (res.data == null || res.data == undefined || res.data == "") {
  34. self.noDataTip = 0;
  35. } else {
  36. self.noDataTip = 1;
  37. self.gwsl = res.data.GWCOUNT;
  38. self.blz = res.data.DEAL;
  39. self.ygd = res.data.STOP;
  40. self.bys = {
  41. total: res.data.SW_MONTH.total,
  42. totalids: res.data.SW_MONTH_IDS,
  43. banli: res.data.SW_MONTH_BANLI,
  44. banliids: res.data.SW_MONTH_BANLI_IDS,
  45. guidang: res.data.SW_MONTH_GUIDANG,
  46. guidangids: res.data.SW_MONTH_GUIDANG_IDS
  47. };
  48. self.byf = {
  49. total: res.data.FW_MONTH.total,
  50. totalids: res.data.FW_MONTH_IDS,
  51. banli: res.data.FW_MONTH_BANLI,
  52. banliids: res.data.FW_MONTH_BANLI_IDS,
  53. guidang: res.data.FW_MONTH_GUIDANG,
  54. guidangids: res.data.FW_MONTH_GUIDANG_IDS
  55. };
  56. self.list1 = res.data.DEPARTMENT;
  57. self.list2 = res.data.DIRECTUNDER;
  58. }
  59. })
  60. }
  61. self.getData()
  62. self.searchIds = function (ids) {
  63. if (ids) {
  64. self.loading = true;
  65. self.routeinfoids = ids.replace(/\|/g, ",");
  66. self.getList(1)
  67. } else {
  68. return
  69. }
  70. }
  71. self.pageno = 1;
  72. self.total_count = 0;
  73. self.itemsPerPage = 10;
  74. self.pageOptions = [10, 20, 30, 40];
  75. self.getList = function (pageno) {
  76. self.pageno = pageno;
  77. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  78. var array = [{ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE_INFO", "COLID": "ROUTEINFOID", "VALUEA": self.routeinfoids, "VALUEB": "" }];
  79. var data = {
  80. flowid: '',
  81. userid: self.userId,
  82. pageno: self.pageno,
  83. pagesize: self.itemsPerPage,
  84. querycondition: JSON.stringify(array)
  85. }
  86. $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", data, postCfg)
  87. .success(function (res) {
  88. self.zonglan = false;
  89. self.loading = false;
  90. if (res.data == null || res.data == undefined || res.data == "") {
  91. self.qlcList = []
  92. } else {
  93. self.noDataTip = 1;
  94. res.data.forEach(function (item) {
  95. item.APPDATE = sp.format(item.APPDATE)
  96. if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') {
  97. item.STATUSINFO_CN = '在办'
  98. } else if (item.STATUSINFO == 'STOP') {
  99. item.STATUSINFO_CN = '办结'
  100. } else {
  101. item.STATUSINFO_CN = ''
  102. }
  103. item.userStr = ''
  104. if (item.TODOLIST) {
  105. item.TODOLIST.forEach(function (iitem) {
  106. iitem.USERS.forEach(function (iiitem) {
  107. iiitem.STATUS_CN = ''
  108. if (iiitem.STATUS == '0') {
  109. iiitem.STATUS_CN = '草稿'
  110. } else if (iiitem.STATUS == '1') {
  111. iiitem.STATUS_CN = '待办'
  112. } else if (iiitem.STATUS == '2') {
  113. iiitem.STATUS_CN = '在办'
  114. }
  115. if (iiitem.USERNAME && iiitem.STATUS_CN) {
  116. if (item.userStr) {
  117. item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN
  118. } else {
  119. item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_CN
  120. }
  121. }
  122. })
  123. })
  124. }
  125. })
  126. self.qlcList = res.data;
  127. self.total_count = res.meta.totalCount;
  128. }
  129. })
  130. }
  131. self.flowList = [];
  132. self.getFlow = function () {
  133. var data = {
  134. userid: self.userId,
  135. ntops: 0//6
  136. }
  137. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  138. .success(function (obj) {
  139. var res = strToJson(s4.decryptData_CBC(obj.data));
  140. res.data.forEach(function (item) {
  141. if (item.FLOWID != "无") {
  142. self.flowList.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
  143. }
  144. })
  145. })
  146. }
  147. self.getFlow()
  148. self.goUrl = function (obj) {
  149. let href = window.location.href
  150. let hrefArr = href.split('totalshouwen')
  151. if (hrefArr.length > 0) {
  152. self.flowList.forEach(function (item) {
  153. if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
  154. let FILENArr = item.FILEN.split('/')
  155. sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN)
  156. }
  157. })
  158. }
  159. }
  160. }])