msgListCopy.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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, postCfg)
  32. .success(function (obj) {
  33. // var res = strToJson(s4.decryptData_CBC(obj.data));
  34. var res = obj;
  35. self.list = res.data;
  36. console.log(self.list)
  37. })
  38. }
  39. self.load = function () {
  40. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  41. self.getData(self.pageno);
  42. } else {
  43. $timeout(function () {
  44. self.getData(self.get_lastReturnPageno);
  45. }, 1)
  46. }
  47. }
  48. self.changeType = function (str) {
  49. if (self.type == str) {
  50. return;
  51. } else {
  52. self.type = str;
  53. self.getData(1)
  54. }
  55. }
  56. self.load();
  57. self.refresh = function () {
  58. self.getData(self.pageno);
  59. }
  60. self.goUrl = function (item) {
  61. if (item.MARK == "未读") {
  62. var data = {
  63. id: item.ID
  64. }
  65. $http.post(apiurljs.login + "g2work/routeinfo/updateDataMessage", data, postCfg)
  66. .success(function (obj) {
  67. //var res = strToJson(s4.decryptData_CBC(obj.data));
  68. var res = obj;
  69. self.getData(self.pageno)
  70. sp.openNewWindow("../../" + item.DURL, item.CONTENTS)
  71. })
  72. } else {
  73. sp.openNewWindow("../../" + item.DURL, item.CONTENTS)
  74. }
  75. }
  76. //头部下滚冻结
  77. $(function () {
  78. //页面高度撑满
  79. setTimeout(function () {
  80. if ($(".ibox-content").height() < $(window).height() - 31) {
  81. $(".ibox-content").css("height", $(window).height() - 31)
  82. }
  83. }, 1)
  84. })
  85. }])