opinionlist.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $interval, $sce) {
  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.flows = [];
  18. self.test = [];
  19. self.getFlow = function () {
  20. var data = {
  21. userid: self.userId,
  22. ntops: 0//6
  23. }
  24. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  25. .success(function (obj) {
  26. var res = strToJson(s4.decryptData_CBC(obj.data));
  27. res.data.forEach(function (item) {
  28. if (item.FLOWID != "无") {
  29. self.flows.push(item.FLOWID)
  30. self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
  31. }
  32. })
  33. })
  34. }
  35. self.getFlow()
  36. self.loading = false;
  37. self.loading_del = false;
  38. let nowDate = new Date()
  39. let y = nowDate.getFullYear()
  40. let m = nowDate.getMonth() + 1
  41. let d = nowDate.getDate()
  42. self.search = {
  43. startdate: sp.dateCount(0),//y + "-01-01",
  44. enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d),
  45. startdate_: sp.dateCount(0),//y + "-01-01",
  46. enddate_: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  47. }
  48. self.noDataTip = 1; //没有数据时赋变量为0,先默认为1
  49. self.pageno = 1;
  50. self.total_count = 0;
  51. self.itemsPerPage = 10;
  52. self.pageOptions = [10, 20, 30, 40];
  53. self.getData = function (pageno) {
  54. self.loading = true;
  55. self.pageno = pageno;
  56. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  57. var data = {
  58. flowid: '',
  59. userid: '4dd97a30-bce1-4862-a95d-711c25a0bd12',//self.userId,
  60. pageno: self.pageno,
  61. pagesize: self.itemsPerPage,
  62. querycondition: JSON.stringify([{
  63. CKIND: 'VARCHAR',
  64. TABLEID: 'SYS_ROUTE_VIEW',
  65. COLID: 'TITLE',
  66. VALUEA: self.search.title || '',
  67. }, {
  68. CKIND: 'DATETIME',
  69. TABLEID: 'SYS_ROUTE_VIEW',
  70. COLID: 'APPDATE',
  71. VALUEA: self.search.startdate_,
  72. VALUEB: self.search.enddate_,
  73. }])
  74. }
  75. $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", {
  76. data: s4.encryptData_CBC(JSON.stringify(data))
  77. }, postCfg)
  78. .success(function (obj) {
  79. var res = strToJson(s4.decryptData_CBC(obj.data));
  80. self.loading = false;
  81. if (res.data == null || res.data == undefined || res.data == "") {
  82. self.noDataTip = 0;
  83. self.list = []
  84. } else {
  85. self.noDataTip = 1;
  86. res.data.forEach(function (item) {
  87. item.checked = false;
  88. if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') {
  89. item.STATUSINFO_CN = '在办'
  90. } else if (item.STATUSINFO == 'STOP') {
  91. item.STATUSINFO_CN = '办结'
  92. } else {
  93. item.STATUSINFO_CN = ''
  94. }
  95. item.userStr = ''
  96. item.TODOLIST.forEach(function (iitem) {
  97. iitem.USERS.forEach(function (iiitem) {
  98. iiitem.STATUS_CN = ''
  99. if (iiitem.STATUS == '0') {
  100. iiitem.STATUS_CN = '草稿'
  101. } else if (iiitem.STATUS == '1') {
  102. iiitem.STATUS_CN = '待办'
  103. } else if (iiitem.STATUS == '2') {
  104. iiitem.STATUS_CN = '在办'
  105. }
  106. if (iiitem.USERNAME && iiitem.STATUS_CN) {
  107. if (item.userStr) {
  108. item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN
  109. } else {
  110. item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_CN
  111. }
  112. }
  113. })
  114. })
  115. })
  116. self.list = res.data;
  117. self.total_count = res.meta.totalCount;
  118. }
  119. })
  120. }
  121. self.load = function () {
  122. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  123. self.getData(self.pageno);
  124. } else {
  125. $timeout(function () {
  126. self.getData(self.get_lastReturnPageno);
  127. }, 1)
  128. }
  129. }
  130. self.load();
  131. self.openSearch = function () {
  132. sp.layer("#Search")
  133. }
  134. self.doSearch = function () {
  135. self.getData(1);
  136. sp.layerhide()
  137. }
  138. self.cancal = function () {
  139. self.search = {
  140. keyword: "",
  141. startdate: "",
  142. enddate: ""
  143. }
  144. self.getData(1);
  145. sp.layerhide()
  146. }
  147. self.refresh = function () {
  148. self.getData(self.pageno);
  149. }
  150. self.goUrl = function (obj) {
  151. let href = window.location.href
  152. let hrefArr = href.split('fontOA')
  153. if (hrefArr.length > 0) {
  154. self.test.forEach(function (item) {
  155. if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
  156. let FILENArr = item.FILEN.split('/')
  157. sp.openNewWindow("../" + FILENArr[1] + '/' + obj.FILEN)
  158. }
  159. })
  160. }
  161. }
  162. self.goUrl1 = function (obj) {
  163. sp.openNewWindow("opinion.html?" + obj.FILEN.split("?")[1])
  164. }
  165. //self.goUrl()
  166. //头部下滚冻结
  167. $(function () {
  168. //页面高度撑满
  169. setTimeout(function () {
  170. if ($(".ibox-content").height() < $(window).height() - 31) {
  171. $(".ibox-content").css("height", $(window).height() - 31)
  172. }
  173. }, 1)
  174. })
  175. }])
  176. app.filter('trustHtml', function ($sce) {
  177. return function (input) {
  178. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  179. };
  180. });