search.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. }
  17. self.loading = false;
  18. self.getGKSXLB = function () {
  19. var data = {
  20. ckey: "CODE_GKSXLB",
  21. routeinfoid: self.routeinfoid
  22. }
  23. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  24. .success(function (obj) {
  25. var res = strToJson(s4.decryptData_CBC(obj.data));
  26. self.GKSXLB = res.data.CODE_GKSXLB;
  27. self.getLAIYUAN()
  28. })
  29. }
  30. self.getGKSXLB()
  31. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  32. self.getLAIYUAN = function () {
  33. var data = {
  34. ckey: "CODE_LAIYUAN",
  35. routeinfoid: self.routeinfoid
  36. }
  37. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  38. .success(function (obj) {
  39. var res = strToJson(s4.decryptData_CBC(obj.data));
  40. self.LAIYUAN = res.data.CODE_LAIYUAN;
  41. self.search = {
  42. LAIYUAN: self.LAIYUAN[0].CODE,
  43. BIANHAO: "",
  44. GKSXLB: "",
  45. GMFRHQYMC: "",
  46. DATE1: "",
  47. DATE2: ""
  48. }
  49. self.getData(1)
  50. })
  51. }
  52. self.openLayer = function () {
  53. if (self.search == null) {
  54. self.search = {
  55. LAIYUAN: self.LAIYUAN[0].CODE,
  56. BIANHAO: "",
  57. GKSXLB: "",
  58. GMFRHQYMC: "",
  59. DATE1: "",
  60. DATE2: ""
  61. }
  62. }
  63. sp.layer("#Search")
  64. }
  65. self.doSearch = function () {
  66. if (self.search.DATE1 != "" && self.search.DATE2 == "") {
  67. self.search.DATE2 = self.search.DATE1
  68. }
  69. if (self.search.DATE2 != "" && self.search.DATE1 == "") {
  70. self.search.DATE1 = self.search.DATE2
  71. }
  72. self.getData(1)
  73. sp.layerhide()
  74. }
  75. self.cancal = function () {
  76. self.search = {
  77. LAIYUAN: self.LAIYUAN[0].CODE,
  78. BIANHAO: "",
  79. GKSXLB: "",
  80. GMFRHQYMC: "",
  81. DATE1: "",
  82. DATE2: ""
  83. }
  84. self.getData(1)
  85. sp.layerhide()
  86. }
  87. self.pageno = 1;
  88. self.total_count = 0;
  89. self.itemsPerPage = 10;
  90. self.pageOptions = [10, 20, 30, 40];
  91. self.getData = function (pageno) {
  92. self.pageno = pageno;
  93. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  94. self.list = [];
  95. self.loading = false;
  96. var sqlwhere = []
  97. if (self.search.LAIYUAN != "C14") {
  98. sqlwhere.push(" and LAIYUAN='" + self.search.LAIYUAN + "'")
  99. }
  100. if (self.search.BIANHAO != "") {
  101. sqlwhere.push(" and BIANHAO like'%" + self.search.BIANHAO + "%'")
  102. }
  103. if (self.search.GKSXLB != "") {
  104. sqlwhere.push(" and GKSXLB='" + self.search.GKSXLB + "'")
  105. }
  106. if (self.search.GMFRHQYMC != "") {
  107. sqlwhere.push(" and GMFRHQYMC like'%" + self.search.GMFRHQYMC + "%'")
  108. }
  109. if (self.search.DATE1 != "" && self.search.DATE1 != "") {
  110. sqlwhere.push(" and SQRQ between'" + self.search.DATE1 + " 00:00:00' and '" + self.search.DATE2 + " 23:59:59'")
  111. }
  112. var data = {
  113. tablename: "SX_SZJWYSQGKXXCBD",
  114. colums: "*",
  115. order: "SJRQ",
  116. sqlwhere: sqlwhere.join(" "),
  117. pageno: self.pageno,
  118. pagesize: self.itemsPerPage
  119. }
  120. $http.post(apiurljs.login + "g2app/xinxigongkai/queryFormDataByColStrWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  121. .success(function (obj) {
  122. var res = strToJson(s4.decryptData_CBC(obj.data));
  123. self.loading = false;
  124. if (res.data == null || res.data == undefined || res.data == "") {
  125. self.noDataTip = 0;
  126. } else {
  127. self.noDataTip = 1;
  128. self.list = res.data;
  129. self.total_count = res.totalCount;
  130. $.each(self.list, function (index, item) {
  131. item.SQRQ1 = sp.format(item.SQRQ)
  132. item.SJBJRQ1 = sp.format(item.SJBJRQ)
  133. self.LAIYUAN.forEach(function (item1) {
  134. if (item.LAIYUAN == item1.CODE)
  135. item.LAIYUAN1 = item1.CNAME
  136. })
  137. self.GKSXLB.forEach(function (item1) {
  138. if (item.GKSXLB == item1.CODE)
  139. item.GKSXLB1 = item1.CNAME
  140. })
  141. })
  142. }
  143. })
  144. }
  145. self.goUrl = function (obj) {
  146. sp.openNewWindow("../../tpl/gongkaizhu/" + obj.FILEN, obj.BIANHAO)
  147. }
  148. //头部下滚冻结
  149. $(function () {
  150. //页面高度撑满
  151. setTimeout(function () {
  152. if ($(".ibox-content").height() < $(window).height() - 31) {
  153. $(".ibox-content").css("height", $(window).height() - 31)
  154. }
  155. }, 1)
  156. })
  157. }])