tzgglist.js 3.6 KB

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