index1.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", "$interval", "$sce", function ($scope, $http, $timeout, $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.searchFlag = false;
  19. self.search = {
  20. keyword: ""
  21. }
  22. self.keyLogin = function () {
  23. if (event.keyCode == 13) {
  24. self.getData()
  25. }
  26. }
  27. self.noDataTip = 1;
  28. self.pageno = 1;
  29. self.total_count = 0;
  30. self.itemsPerPage = 10;
  31. self.pageOptions = [10, 20, 30, 40, 50];
  32. self.getData = function () {
  33. self.loading = true;
  34. self.searchFlag = true;
  35. var data = {
  36. value: self.search.keyword
  37. }
  38. $http.post(apiurljs.login + "g2app/d2es/queryShouWenData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  39. .success(function (obj) {
  40. var res = strToJson(s4.decryptData_CBC(obj.data));
  41. self.loading = false;
  42. if (res.data == null || res.data == undefined || res.data == "") {
  43. self.list = []
  44. } else {
  45. self.noDataTip = 1;
  46. self.list = res.data;
  47. self.total_count = res.data.totalCount;
  48. self.list.forEach(function (item) {
  49. item.LWRQ = sp.format(item.LWRQ);
  50. })
  51. }
  52. })
  53. }
  54. }])