dbmore.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.search = {
  18. TITLE: "",
  19. DATE1: "",
  20. DATE2: ""
  21. }
  22. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  23. self.pageno = 1;
  24. self.total_count = 0;
  25. self.itemsPerPage = 10;
  26. self.pageOptions = [10, 20, 40, 60];
  27. self.getData = function (pageno) {
  28. self.list = [];
  29. self.loading = true;
  30. self.pageno = pageno;
  31. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  32. var querycondition = [];
  33. if (self.search.TITLE != "") {
  34. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "SYS_MSG", "COLID": "CONTENTS", "VALUEA": self.search.TITLE, "VALUEB": "" })
  35. }
  36. if (self.search.DATE1 != "" && self.search.DATE2 != "") {
  37. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_MSG", "COLID": "FINISHDATE", "VALUEA": self.search.DATE1, "VALUEB": self.search.DATE2 })
  38. } else if (self.search.DATE1 != "" && self.search.DATE2 == "") {
  39. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_MSG", "COLID": "FINISHDATE", "VALUEA": self.search.DATE1, "VALUEB": "" })
  40. } else if (self.search.DATE1 == "" && self.search.DATE2 != "") {
  41. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_MSG", "COLID": "FINISHDATE", "VALUEA": "", "VALUEB": self.search.DATE2 })
  42. }
  43. var data = {
  44. userid: self.userId,
  45. msgkind: "督办台账",
  46. pageno: self.pageno,
  47. pagesize: self.itemsPerPage,
  48. querycondition: JSON.stringify(querycondition)
  49. }
  50. $http.post(apiurljs.login + "icenter/notice/queryDataMessageWithPage", data, postCfg)
  51. .success(function (obj) {
  52. var res = strToJson(s4.decryptData_CBC(obj.data));
  53. self.loading = false;
  54. if (res.data == null || res.data == undefined || res.data == "") {
  55. self.noDataTip = 0;
  56. } else {
  57. self.noDataTip = 1;
  58. self.list = res.data;
  59. self.total_count = res.totalCount;
  60. }
  61. })
  62. }
  63. self.getData(self.pageno)
  64. self.openLayer = function () {
  65. sp.layer("#Search")
  66. }
  67. self.doSearch = function () {
  68. self.getData(self.pageno)
  69. sp.layerhide()
  70. }
  71. self.cancal = function () {
  72. self.search = {
  73. TITLE: "",
  74. DATE1: "",
  75. DATE2: ""
  76. }
  77. self.getData(1)
  78. sp.layerhide()
  79. }
  80. self.refresh = function () {
  81. self.getData(self.pageno);
  82. }
  83. self.goUrl = function (item) {
  84. var data = {
  85. id: item.ID
  86. }
  87. $http.post(apiurljs.login+ "icenter/notice/updateDataMessageReaded", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  88. .success(function (obj) {
  89. var res = strToJson(s4.decryptData_CBC(obj.data));
  90. if (res.success) {
  91. self.getData(self.pageno)
  92. if (self.deviceType == "pad") {
  93. //window.location.href = item.FILEN + "&dotype=" + getDoType(self.type)
  94. window.location.href = "../../" + item.DURL
  95. } else {
  96. sp.openNewWindow("../../" + item.DURL)
  97. //sp.openNewWindow(item.FILEN + "&dotype=" + getDoType(self.type), item.TITLE)
  98. }
  99. }
  100. })
  101. }
  102. }])