tzgg.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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, postCfg)
  23. .success(function (obj) {
  24. //var res = strToJson(s4.decryptData_CBC(obj.data));
  25. var res = obj;
  26. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  27. self.getTZGG();
  28. })
  29. }
  30. self.getTZGG = function () {
  31. var data = {
  32. tablename: "SX_TZGG",
  33. colums: "ID,GGBT,FBSJ,FBFW",
  34. order: "ID desc",
  35. sqlwhere: { FBZT: 1, GGBK: "C01" },
  36. sqlorwhere: "",
  37. sqlinwhere: "",
  38. sqllikewhere: ""
  39. }
  40. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", data, postCfg)
  41. .success(function (obj) {
  42. //var res = strToJson(s4.decryptData_CBC(obj.data))
  43. var res = obj;
  44. $.each(res.data, function (index, item) {
  45. if (item.FBFW == "全部" || item.FBFW.indexOf(self.userDpName) > -1 || item.FBFW.indexOf(self.userChineseName) > -1) {
  46. self.TZGG = item;
  47. return false
  48. }
  49. })
  50. if (self.TZGG.FJSC && self.TZGG.FJSC != "") {
  51. self.arrayFile = JSON.parse(self.TZGG.FJSC);
  52. }
  53. $timeout(function () {
  54. var height = 0;
  55. $(".content").siblings().each(function () {
  56. height = height + $(this).outerHeight(true);
  57. })
  58. $(".content").css("height", 300 - height)
  59. $(".content").html(base64.decode(self.TZGG.GGNR));
  60. },1)
  61. })
  62. }
  63. self.getDP()
  64. }])