list.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $interval, $sce) {
  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. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. }
  17. self.loading = false;
  18. let nowDate = new Date()
  19. let y = nowDate.getFullYear()
  20. let m = nowDate.getMonth() + 1
  21. let d = nowDate.getDate()
  22. self.search = {
  23. startdate: y + "-01-01",
  24. enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  25. }
  26. self.flows = [];
  27. self.test = [];
  28. self.getFlow = function () {
  29. var data = {
  30. userid: self.userId,
  31. ntops: 0//6
  32. }
  33. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  34. .success(function (obj) {
  35. var res = strToJson(s4.decryptData_CBC(obj.data));
  36. res.data.forEach(function (item) {
  37. if (item.FLOWID != "无") {
  38. self.flows.push(item.FLOWID)
  39. self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
  40. }
  41. })
  42. })
  43. }
  44. self.getFlow()
  45. self.noDataTip = 1; //没有数据时赋变量为0,先默认为1
  46. self.pageno = 1;
  47. self.total_count = 0;
  48. self.itemsPerPage = 20;
  49. self.pageOptions = [20, 30, 40];
  50. self.getData = function (pageno) {
  51. self.loading = true;
  52. self.pageno = pageno;
  53. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  54. var data = {
  55. flowid: 'AA18|AA16',
  56. userid: self.userId,
  57. pageno: self.pageno,
  58. pagesize: self.itemsPerPage,
  59. querycondition: [{
  60. CKIND: 'VARCHAR',
  61. TABLEID: 'SYS_ROUTE_VIEW',
  62. COLID: 'TITLE',
  63. VALUEA: self.search.title || '',
  64. }, {
  65. CKIND: 'DATETIME',
  66. TABLEID: 'SYS_ROUTE_VIEW',
  67. COLID: 'APPDATE',
  68. VALUEA: self.search.startdate,
  69. VALUEB: self.search.enddate,
  70. }]
  71. }
  72. $http.post(apiurljs.login + "g2work/routeinfo/queryDataDutyWatchWithPage", {
  73. data: s4.encryptData_CBC(JSON.stringify(data))
  74. }, postCfg)
  75. .success(function (obj) {
  76. var res = strToJson(s4.decryptData_CBC(obj.data));
  77. self.loading = false;
  78. if (res.data == null || res.data == undefined || res.data == "") {
  79. self.noDataTip = 0;
  80. self.list = []
  81. } else {
  82. self.noDataTip = 1;
  83. console.log(res.data)
  84. res.data.forEach(function (item) {
  85. item.checked = false;
  86. if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') {
  87. item.STATUSINFO_CN = '在办'
  88. } else if (item.STATUSINFO == 'STOP') {
  89. item.STATUSINFO_CN = '办结'
  90. } else {
  91. item.STATUSINFO_CN = ''
  92. }
  93. item.userStr = ''
  94. item.TODOLIST.forEach(function (iitem) {
  95. iitem.USERS.forEach(function (iiitem) {
  96. iiitem.STATUS_CN = ''
  97. if (iiitem.STATUS == '0') {
  98. iiitem.STATUS_CN = '草稿'
  99. } else if (iiitem.STATUS == '1') {
  100. iiitem.STATUS_CN = '待办'
  101. } else if (iiitem.STATUS == '2') {
  102. iiitem.STATUS_CN = '在办'
  103. }
  104. if (iiitem.USERNAME && iiitem.STATUS_CN) {
  105. if (item.userStr) {
  106. item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN
  107. } else {
  108. item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_CN
  109. }
  110. }
  111. })
  112. })
  113. })
  114. self.list = res.data;
  115. self.total_count = res.meta.totalCount;
  116. }
  117. })
  118. }
  119. self.load = function () {
  120. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  121. self.getData(self.pageno);
  122. } else {
  123. $timeout(function () {
  124. self.getData(self.get_lastReturnPageno);
  125. }, 1)
  126. }
  127. }
  128. self.load();
  129. self.openSearch = function () {
  130. sp.layer("#Search")
  131. }
  132. self.doSearch = function () {
  133. self.getData(1);
  134. sp.layerhide()
  135. }
  136. self.cancal = function () {
  137. self.search = {
  138. keyword: "",
  139. startdate: "",
  140. enddate: ""
  141. }
  142. self.getData(1);
  143. sp.layerhide()
  144. }
  145. self.refresh = function () {
  146. self.getData(self.pageno);
  147. }
  148. self.goUrl = function (obj) {
  149. let href = window.location.href
  150. let hrefArr = href.split('dutywatch')
  151. if (hrefArr.length > 0) {
  152. self.test.forEach(function (item) {
  153. if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
  154. let FILENArr = item.FILEN.split('/')
  155. sp.openNewWindow(hrefArr[0].replace("tpk","tpl") + FILENArr[1] + '/' + obj.FILEN)
  156. }
  157. })
  158. }
  159. }
  160. //self.goUrl()
  161. //头部下滚冻结
  162. $(function () {
  163. //页面高度撑满
  164. setTimeout(function () {
  165. if ($(".ibox-content").height() < $(window).height() - 31) {
  166. $(".ibox-content").css("height", $(window).height() - 31)
  167. }
  168. }, 1)
  169. })
  170. }])
  171. app.filter('trustHtml', function ($sce) {
  172. return function (input) {
  173. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  174. };
  175. });