total.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.search = {
  18. year: sp.currentYear(),
  19. month: sp.currentMonth(),
  20. CSDW: ""
  21. }
  22. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  23. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  24. self.pageno = 1;
  25. self.total_count = 0;
  26. self.itemsPerPage = 10;
  27. self.pageOptions = [10, 20, 30, 40];
  28. self.getData = function (pageno) {
  29. self.pageno = pageno;
  30. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  31. self.list = [];
  32. var data = {
  33. tablename: "SX_XXBSD",
  34. colums: "*",
  35. order: "ID desc",
  36. sqlwhere: "",
  37. sqlorwhere: "",
  38. sqlinwhere: "",
  39. sqllikewhere: { CSDW: self.search.CSDW, RQ: self.search.year + "-" + formate(self.search.month) },
  40. pageno: self.pageno,
  41. pagesize: self.itemsPerPage
  42. }
  43. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  44. .success(function (obj) {
  45. var res = strToJson(s4.decryptData_CBC(obj.data));
  46. self.canExportExcel = true;
  47. if (res.data == null || res.data == undefined || res.data == "") {
  48. self.noDataTip = 0;
  49. } else {
  50. self.noDataTip = 1;
  51. self.list = res.data;
  52. self.list.forEach(function (item) {
  53. item.RQ = sp.format(item.RQ);
  54. })
  55. }
  56. })
  57. }
  58. self.getData(self.pageno)
  59. //头部下滚冻结
  60. $(function () {
  61. //页面高度撑满
  62. setTimeout(function () {
  63. if ($(".ibox-content").height() < $(window).height() - 31) {
  64. $(".ibox-content").css("height", $(window).height() - 31)
  65. }
  66. }, 1)
  67. })
  68. }])
  69. function formate(d) {
  70. return d * 1 > 9 ? d * 1 : "0" + d * 1
  71. }