forwardlist.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. self.loading_del = false;
  19. let nowDate = new Date()
  20. let y = nowDate.getFullYear()
  21. let m = nowDate.getMonth() + 1
  22. let d = nowDate.getDate()
  23. self.search = {
  24. startdate: sp.dateCount(0),//y + "-01-01",
  25. enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d),
  26. startdate_: sp.dateCount(0),//y + "-01-01",
  27. enddate_: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  28. }
  29. self.noDataTip = 1; //没有数据时赋变量为0,先默认为1
  30. self.pageno = 1;
  31. self.total_count = 0;
  32. self.itemsPerPage = 10;
  33. self.pageOptions = [10, 20, 30, 40];
  34. self.getData = function (pageno) {
  35. self.loading = true;
  36. self.pageno = pageno;
  37. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  38. var data = {
  39. flowid: '',
  40. userid: '4dd97a30-bce1-4862-a95d-711c25a0bd12',//self.userId,
  41. pageno: self.pageno,
  42. pagesize: self.itemsPerPage,
  43. querycondition: JSON.stringify([{
  44. CKIND: 'VARCHAR',
  45. TABLEID: 'SYS_ROUTE_VIEW',
  46. COLID: 'TITLE',
  47. VALUEA: self.search.title || '',
  48. }, {
  49. CKIND: 'DATETIME',
  50. TABLEID: 'SYS_ROUTE_VIEW',
  51. COLID: 'APPDATE',
  52. VALUEA: self.search.startdate_,
  53. VALUEB: self.search.enddate_,
  54. }])
  55. }
  56. $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", {
  57. data: s4.encryptData_CBC(JSON.stringify(data))
  58. }, postCfg)
  59. .success(function (obj) {
  60. var res = strToJson(s4.decryptData_CBC(obj.data));
  61. self.loading = false;
  62. if (res.data == null || res.data == undefined || res.data == "") {
  63. self.noDataTip = 0;
  64. self.list = []
  65. } else {
  66. self.noDataTip = 1;
  67. res.data.forEach(function (item) {
  68. item.checked = false;
  69. if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') {
  70. item.STATUSINFO_CN = '在办'
  71. } else if (item.STATUSINFO == 'STOP') {
  72. item.STATUSINFO_CN = '办结'
  73. } else {
  74. item.STATUSINFO_CN = ''
  75. }
  76. item.userStr = ''
  77. item.TODOLIST.forEach(function (iitem) {
  78. iitem.USERS.forEach(function (iiitem) {
  79. iiitem.STATUS_CN = ''
  80. if (iiitem.STATUS == '0') {
  81. iiitem.STATUS_CN = '草稿'
  82. } else if (iiitem.STATUS == '1') {
  83. iiitem.STATUS_CN = '待办'
  84. } else if (iiitem.STATUS == '2') {
  85. iiitem.STATUS_CN = '在办'
  86. }
  87. if (iiitem.USERNAME && iiitem.STATUS_CN) {
  88. if (item.userStr) {
  89. item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN
  90. } else {
  91. item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_CN
  92. }
  93. }
  94. })
  95. })
  96. })
  97. self.list = res.data;
  98. self.total_count = res.meta.totalCount;
  99. }
  100. })
  101. }
  102. self.load = function () {
  103. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  104. self.getData(self.pageno);
  105. } else {
  106. $timeout(function () {
  107. self.getData(self.get_lastReturnPageno);
  108. }, 1)
  109. }
  110. }
  111. self.load();
  112. self.openSearch = function () {
  113. sp.layer("#Search")
  114. }
  115. self.doSearch = function () {
  116. self.getData(1);
  117. sp.layerhide()
  118. }
  119. self.cancal = function () {
  120. self.search = {
  121. keyword: "",
  122. startdate: "",
  123. enddate: ""
  124. }
  125. self.getData(1);
  126. sp.layerhide()
  127. }
  128. self.refresh = function () {
  129. self.getData(self.pageno);
  130. }
  131. self.goUrl = function (obj) {
  132. sp.openNewWindow("forward.html?" + obj.FILEN.split("?")[1])
  133. }
  134. //self.goUrl()
  135. //头部下滚冻结
  136. $(function () {
  137. //页面高度撑满
  138. setTimeout(function () {
  139. if ($(".ibox-content").height() < $(window).height() - 31) {
  140. $(".ibox-content").css("height", $(window).height() - 31)
  141. }
  142. }, 1)
  143. })
  144. }])
  145. app.filter('trustHtml', function ($sce) {
  146. return function (input) {
  147. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  148. };
  149. });