list.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.search = {
  19. date1: sp.monthfirst(sp.getLocalDate()),
  20. date2: sp.formatMonthLast(sp.getLocalDate())
  21. }
  22. self.getData = function () {
  23. self.list = [];
  24. self.loading = false;
  25. var data = {
  26. tablename: "SX_SZJWYSQGKXXCBD",
  27. colums: "*",
  28. order: "ID",
  29. sqlwhere: "",
  30. sqlinwhere: "",
  31. sqllikewhere: ""
  32. }
  33. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  34. .success(function (obj) {
  35. var res = strToJson(s4.decryptData_CBC(obj.data));
  36. self.loading = false;
  37. if (res.data == null || res.data == undefined || res.data == "") {
  38. self.noDataTip = 0;
  39. } else {
  40. self.noDataTip = 1;
  41. self.list = res.data;
  42. $.each(self.list, function (index, item) {
  43. item.SQRQ1 = sp.format(item.SQRQ)
  44. item.SJBJRQ1 = sp.format(item.SJBJRQ)
  45. self.LAIYUAN.forEach(function (item1) {
  46. if (item.LAIYUAN == item1.CODE)
  47. item.LAIYUAN1 = item1.CNAME
  48. })
  49. })
  50. }
  51. })
  52. }
  53. self.getData()
  54. self.openLayer = function () {
  55. self.search = {
  56. date1: sp.monthfirst(sp.getLocalDate()),
  57. date2: sp.formatMonthLast(sp.getLocalDate())
  58. }
  59. sp.layer("#Search")
  60. }
  61. //头部下滚冻结
  62. $(function () {
  63. //页面高度撑满
  64. setTimeout(function () {
  65. if ($(".ibox-content").height() < $(window).height() - 31) {
  66. $(".ibox-content").css("height", $(window).height() - 31)
  67. }
  68. }, 1)
  69. })
  70. }])