list2.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
  6. var self = this;
  7. var s4 = new SM4Util();
  8. self.userId = $.cookie("GlWorkPlatform-userid");
  9. self.userName = $.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.CrossPage = window.parent.CrossPage;
  18. self.loading = false;
  19. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  20. self.pageno = 1;
  21. self.total_count = 0;
  22. self.getData = function (pageno) {
  23. self.list = [];
  24. self.loading = false;
  25. self.pageno = pageno;
  26. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  27. var data = {
  28. tablename: "WJFB_TPXW",
  29. pagesize: 30,
  30. pageno: self.pageno,
  31. colums: "*",
  32. order: "FBRQ desc",
  33. sqlwhere: { FBZT: "1" },
  34. sqlorwhere: "",
  35. sqlinwhere: "",
  36. sqllikewhere: ""
  37. };
  38. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  39. .success(function (obj) {
  40. var res = strToJson(s4.decryptData_CBC(obj.data));
  41. self.loading = false;
  42. if (res.data == null || res.data == undefined || res.data == "") {
  43. self.noDataTip = 0;
  44. } else {
  45. self.noDataTip = 1;
  46. self.list = res.data;
  47. self.total_count = res.totalCount;
  48. self.list.forEach(function (item) {
  49. item.FBRQ1 = item.FBRQ.slice(0, 10);
  50. self.getImg(item)
  51. //if (item.IMAGEDATA && item.IMAGEDATA != "") {
  52. // item.IMAGEDATA1 = apiurljs.login + "g2work/" + JSON.parse(item.IMAGEDATA)[0].FILEURL
  53. //} else if (item.IMAGESDATA && item.IMAGESDATA != "") {
  54. // item.IMAGEDATA1 = apiurljs.login + "g2work/" + JSON.parse(item.IMAGESDATA)[0].FILEURL
  55. //} else {
  56. //}
  57. })
  58. }
  59. })
  60. }
  61. self.getImg = function (parent) {
  62. var data = {
  63. tablename: "FILE_ATTACH",
  64. colums: "*",
  65. order: "ID",
  66. sqlwhere: { ROUTEINFOID: parent.ROUTEINFOID },
  67. sqlorwhere: "",
  68. sqlinwhere: "",
  69. sqllikewhere: ""
  70. };
  71. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  72. .success(function (obj) {
  73. var res = strToJson(s4.decryptData_CBC(obj.data));
  74. for (var i = 0; i < res.data.length; i++) {
  75. if (res.data[i].ATTACHTYPE == "IMAGEDATA") {
  76. parent.IMAGEDATA1 = apiurljs.login + "g2work" + res.data[i].FILEURL
  77. break
  78. } else if (res.data[i].ATTACHTYPE == "IMAGESDATA") {
  79. parent.IMAGEDATA1 = apiurljs.login + "g2work" + res.data[i].FILEURL
  80. }
  81. }
  82. })
  83. }
  84. self.load = function () {
  85. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  86. self.getData(self.pageno);
  87. } else {
  88. $timeout(function () {
  89. self.getData(self.get_lastReturnPageno);
  90. }, 1)
  91. }
  92. }
  93. self.goUrl = function (item) {
  94. sp.openNewWindow("../../tpl/wenjianbg/WJFBB1/detail.html?id=" + item.ID + "&formPage=wenjianshow", item.BT)
  95. }
  96. self.load();
  97. //记录日志
  98. self.journalRecord = function (time1, time2, title, func, url) {
  99. if (!self.CrossPage || !self.CrossPage.cname) { return; }
  100. var data = {
  101. tablename: "SYS_CLICKLOG",
  102. data: {
  103. CTIME: time1 == null ? sp.getLocalDate1() : time1,
  104. TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
  105. REQUESTURL: url,
  106. REQUESTHEADERURL: window.location.origin,
  107. LOGTYPE: func,
  108. USERTYPE: $.cookie("GlWorkPlatform-userType"),
  109. ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
  110. CLIENTIP: sp.myIP(),
  111. PCNAME: sp.detectOS(),
  112. BROWSERNAME: sp.browser(),
  113. RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
  114. USERID: self.userId,
  115. USERNAME: self.userName
  116. }
  117. }
  118. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  119. .success(function (res) {
  120. self.CrossPage.type = 1;
  121. })
  122. }
  123. //头部下滚冻结
  124. $(function () {
  125. //页面高度撑满
  126. setTimeout(function () {
  127. if ($(".ibox-content").height() < $(window).height() - 31) {
  128. $(".ibox-content").css("height", $(window).height() - 31)
  129. }
  130. }, 1)
  131. })
  132. }])