msgListCopy.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  12. self.get_type = sp.getUrlName("type");
  13. var postCfg = {
  14. headers: {
  15. 'Content-Type': 'application/json',
  16. 'Authorization': "Bearer " + self.get_AccessToken
  17. }
  18. }
  19. self.type = self.get_type != "" ? self.get_type : "1";
  20. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  21. self.pageno = 1;
  22. self.total_count = 0;
  23. self.itemsPerPage = 10;
  24. self.pageOptions = [10, 20, 30, 40];
  25. self.getData = function (pageno) {
  26. var data = {
  27. userid: self.userId,
  28. msgkind: "公文事项办理",
  29. mark: self.type == 1 ? "未读" : "已读"
  30. }
  31. $http.post(apiurljs.login + "g2work/routeinfo/queryDataMessage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  32. .success(function (obj) {
  33. var res = strToJson(s4.decryptData_CBC(obj.data));
  34. self.list = res.data;
  35. console.log(self.list)
  36. })
  37. }
  38. self.load = function () {
  39. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  40. self.getData(self.pageno);
  41. } else {
  42. $timeout(function () {
  43. self.getData(self.get_lastReturnPageno);
  44. }, 1)
  45. }
  46. }
  47. self.changeType = function (str) {
  48. if (self.type == str) {
  49. return;
  50. } else {
  51. self.type = str;
  52. self.getData(1)
  53. }
  54. }
  55. self.load();
  56. self.refresh = function () {
  57. self.getData(self.pageno);
  58. }
  59. self.goUrl = function (item) {
  60. if (item.MARK == "未读") {
  61. var data = {
  62. id: item.ID
  63. }
  64. $http.post(apiurljs.login + "g2work/routeinfo/updateDataMessage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  65. .success(function (obj) {
  66. var res = strToJson(s4.decryptData_CBC(obj.data));
  67. self.getData(self.pageno)
  68. sp.openNewWindow("../../" + item.DURL, item.CONTENTS)
  69. })
  70. } else {
  71. sp.openNewWindow("../../" + item.DURL, item.CONTENTS)
  72. }
  73. }
  74. //头部下滚冻结
  75. $(function () {
  76. //页面高度撑满
  77. setTimeout(function () {
  78. if ($(".ibox-content").height() < $(window).height() - 31) {
  79. $(".ibox-content").css("height", $(window).height() - 31)
  80. }
  81. }, 1)
  82. })
  83. }])