list4.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination',
  4. ]);
  5. app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", "$sce", function ($scope, $http, $interval, $timeout, $sce) {
  6. var self = this;
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-username");
  9. self.userChineseName = $.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.getZRBM = function () {
  18. var data = {
  19. ckey: "CODE_ZRBM",
  20. routeinfoid: self.routeinfoid
  21. }
  22. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  23. .success(function (obj) {
  24. var res = strToJson(s4.decryptData_CBC(obj.data));
  25. self.ZRBM = res.data.CODE_ZRBM;
  26. self.getData(1)
  27. })
  28. }
  29. self.getZRBM()
  30. self.loading = false;
  31. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  32. self.pageno = 1;
  33. self.total_count = 0;
  34. self.itemsPerPage = 10;
  35. self.pageOptions = [10, 20, 30, 40];
  36. self.getData = function (pageno) {
  37. self.list = [];
  38. self.loading = false;
  39. self.pageno = pageno;
  40. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  41. var data = {
  42. tablename: "WJFB_CB",
  43. pagesize: self.itemsPerPage,
  44. pageno: self.pageno,
  45. colums: "ID,FBZT,LX,WJBT,FBBM,FBRQ",
  46. order: "FBRQ desc",
  47. sqlwhere: { LX: sp.getUrlName('val'), FBZT: "1" },
  48. sqlorwhere: "",
  49. sqlinwhere: "",
  50. sqllikewhere: ""
  51. };
  52. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  53. .success(function (obj) {
  54. var res = strToJson(s4.decryptData_CBC(obj.data));
  55. self.loading = false;
  56. console.log(res)
  57. if (res.data == null || res.data == undefined || res.data == "") {
  58. self.noDataTip = 0;
  59. } else {
  60. self.noDataTip = 1;
  61. self.list = res.data;
  62. self.total_count = res.totalCount;
  63. self.list.forEach(function (item) {
  64. self.ZRBM.forEach(function (item1) {
  65. if (item.FBBM == item1.CODE) {
  66. item.FBBM1 = item1.CNAME;
  67. }
  68. })
  69. })
  70. }
  71. })
  72. }
  73. self.goUrl = function (item) {
  74. sp.openNewWindow("detail1.html?id=" + item.ID + "&code=" + sp.getUrlName('val')+ "&lastReturnPageno=" + self.pageno, item.WJBT)
  75. }
  76. }])