tzgg.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination',
  4. ]);
  5. app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) {
  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. var base64 = new Base64(); //声明base解码和编码类
  18. self.getDP = function () {
  19. var data = {
  20. userid: self.userId
  21. }
  22. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  23. .success(function (obj) {
  24. var res = strToJson(s4.decryptData_CBC(obj.data));
  25. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  26. self.getTZGG();
  27. })
  28. }
  29. self.getTZGG = function () {
  30. var data = {
  31. tablename: "SX_TZGG",
  32. colums: "ID,GGBT,FBSJ,FBFW",
  33. order: "ID desc",
  34. sqlwhere: { FBZT: 1, GGBK: "C01" },
  35. sqlorwhere: "",
  36. sqlinwhere: "",
  37. sqllikewhere: ""
  38. }
  39. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  40. .success(function (obj) {
  41. var res = strToJson(s4.decryptData_CBC(obj.data))
  42. $.each(res.data, function (index, item) {
  43. if (item.FBFW == "全部" || item.FBFW.indexOf(self.userDpName) > -1 || item.FBFW.indexOf(self.userChineseName) > -1) {
  44. self.TZGG = item;
  45. return false
  46. }
  47. })
  48. if (self.TZGG.FJSC && self.TZGG.FJSC != "") {
  49. self.arrayFile = JSON.parse(self.TZGG.FJSC);
  50. }
  51. $timeout(function () {
  52. var height = 0;
  53. $(".content").siblings().each(function () {
  54. height = height + $(this).outerHeight(true);
  55. })
  56. $(".content").css("height", 300 - height)
  57. $(".content").html(base64.decode(self.TZGG.GGNR));
  58. },1)
  59. })
  60. }
  61. self.getDP()
  62. }])