backlist.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.search = {
  19. title: "",
  20. startdate: sp.getWeekNumber(new Date()).begin,
  21. enddate: sp.getWeekNumber(new Date()).end
  22. }
  23. self.flows = [];
  24. self.test = [];
  25. self.getFlow = function () {
  26. var data = {
  27. userid: self.userId,
  28. ntops: 0//6
  29. }
  30. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  31. .success(function (obj) {
  32. var res = strToJson(s4.decryptData_CBC(obj.data));
  33. res.data.forEach(function (item) {
  34. if (item.FLOWID != "无") {
  35. self.flows.push(item.FLOWID)
  36. self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
  37. }
  38. })
  39. })
  40. }
  41. self.getFlow()
  42. self.noDataTip = 1; //没有数据时赋变量为0,先默认为1
  43. self.pageno = 1;
  44. self.total_count = 0;
  45. self.itemsPerPage = 10;
  46. self.pageOptions = [10, 20, 30, 40];
  47. self.getData = function (pageno) {
  48. self.loading = true;
  49. self.pageno = pageno;
  50. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  51. var data = {
  52. flowid: "A20,AA03,AA10,AA55,AA56,AA57,AA08,AA23,AA77,AA06,AA88,AA89,AA46,AA22,AA54,AA65",
  53. sx_order: "flowid",
  54. order: "routeid",
  55. pageno: self.pageno,
  56. pagesize: self.itemsPerPage,
  57. sqlwhere: "returndate between '" + self.search.startdate + " 00:00:00' and '" + self.search.enddate + " 23:59:59'" + (self.search.title == "" ? "" : " and title like '%" + self.search.title + "%'")
  58. }
  59. $http.post(apiurljs.login + "g2app/dataabase/queryDataByReturnManageWithPage", {
  60. data: s4.encryptData_CBC(JSON.stringify(data))
  61. }, postCfg)
  62. .success(function (obj) {
  63. var res = strToJson(s4.decryptData_CBC(obj.data));
  64. self.loading = false;
  65. if (res.data == null || res.data == undefined || res.data == "") {
  66. self.noDataTip = 0;
  67. self.list = []
  68. } else {
  69. self.noDataTip = 1;
  70. res.data.forEach(function (item) {
  71. if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') {
  72. item.STATUSINFO_CN = '在办'
  73. } else if (item.STATUSINFO == 'STOP') {
  74. item.STATUSINFO_CN = '办结'
  75. } else {
  76. item.STATUSINFO_CN = ''
  77. }
  78. })
  79. self.list = res.data;
  80. self.total_count = res.meta.totalCount;
  81. }
  82. })
  83. }
  84. self.load = function () {
  85. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  86. self.getData(self.pageno);
  87. } else {
  88. $timeout(function () {
  89. self.getData(self.get_lastReturnPageno);
  90. }, 1)
  91. }
  92. }
  93. self.load();
  94. self.openSearch = function () {
  95. sp.layer("#Search")
  96. }
  97. self.doSearch = function () {
  98. self.getData(1);
  99. sp.layerhide()
  100. }
  101. self.refresh = function () {
  102. self.getData(self.pageno);
  103. }
  104. self.goUrl = function (obj) {
  105. if (!obj.COUNTS) {
  106. let href = window.location.href
  107. let hrefArr = href.split('tool')
  108. self.test.forEach(function (item) {
  109. if (item.FLOWID.indexOf(self.returnFlowid) > -1) {
  110. let FILENArr = item.FILEN.split('/')
  111. sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN)
  112. }
  113. })
  114. }else if (obj.COUNTS == 1) {
  115. let href = window.location.href
  116. let hrefArr = href.split('tool')
  117. self.test.forEach(function (item) {
  118. if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
  119. let FILENArr = item.FILEN.split('/')
  120. sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN)
  121. }
  122. })
  123. } else {
  124. self.returnTitle = obj.TITLE;
  125. self.returnFlowid = obj.FLOWID;
  126. self.returnList = obj.RETURNLIST;
  127. sp.layer("#returnlist")
  128. }
  129. }
  130. //头部下滚冻结
  131. $(function () {
  132. //页面高度撑满
  133. setTimeout(function () {
  134. if ($(".ibox-content").height() < $(window).height() - 31) {
  135. $(".ibox-content").css("height", $(window).height() - 31)
  136. }
  137. }, 1)
  138. })
  139. }])