tzgglist.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.getDP = function () {
  18. var data = {
  19. userid: self.userId
  20. }
  21. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", data, postCfg)
  22. .success(function (obj) {
  23. //var res = strToJson(s4.decryptData_CBC(obj.data));
  24. var res =obj;
  25. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  26. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  27. self.getParentDP();
  28. })
  29. }
  30. self.getParentDP = function () {
  31. self.userPDpName = "";
  32. var data = { code: "AA" }
  33. $http.post(apiurljs.login + "g2work/sect/querySect", data, postCfg)
  34. .success(function (obj) {
  35. //var res = strToJson(s4.decryptData_CBC(obj.data));
  36. var res =obj;
  37. res.data[0].C_H_I_L_D.forEach(function (item) {
  38. item.C_H_I_L_D.forEach(function (item1) {
  39. if (item1.CODE == self.userDpCode) {
  40. self.userPDpName = item.SECTION
  41. }
  42. })
  43. })
  44. self.getData();
  45. })
  46. }
  47. self.today = sp.format(sp.getLocalDate());
  48. self.getData = function () {
  49. var data = {
  50. tablename: "SX_TZGG",
  51. pagesize: 8,
  52. pageno: 1,
  53. colums: "ID,GGBT,FBSJ,FBFW",
  54. order: "FBSJ",
  55. sqlwhere: "and FBZT=1 and GGBK='C01' and (FBFWMANUSERID like '%" + self.userId + "%' or FBFWMANUSERID='全部')"
  56. };
  57. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage3", data, postCfg)
  58. .success(function (obj) {
  59. //var res = strToJson(s4.decryptData_CBC(obj.data));
  60. var res = obj;
  61. self.dataList = res.data;
  62. self.list = res.data;
  63. //self.dataList.forEach(function (item) {
  64. // if (item.FBFW == "" || item.FBFW == "全部") {
  65. // self.list.push(item)
  66. // } else {
  67. // item.FBFW.split(",").forEach(function (item1) {
  68. // if (item1 == self.userDpName) {
  69. // self.list.push(item)
  70. // } else if (item1 == self.userPDpName) {
  71. // self.list.push(item)
  72. // } if (item1 == self.userChineseName) {
  73. // self.list.push(item)
  74. // }
  75. // })
  76. // }
  77. //})
  78. })
  79. }
  80. self.getDP()
  81. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  82. self.openTab = function (id) {
  83. if (self.deviceType == "pad") {
  84. sp.openNewWindow("../../tpl/tongzhibg/TZGG/detail.html?id=" + id, "通知公告")
  85. } else {
  86. sp.openNewWindow("../../tpl/tongzhibg/TZGG/detail.html?id=" + id, "通知公告")
  87. }
  88. }
  89. }])