list2.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  12. self.get_type = sp.getUrlName("type");
  13. var postCfg = {
  14. headers: {
  15. 'Content-Type': 'application/json',
  16. 'Authorization': "Bearer " + self.get_AccessToken
  17. }
  18. }
  19. self.getUserRole = function () {
  20. var data = {
  21. userid: self.userId
  22. };
  23. $http.post(apiurljs.login + "g2work/datazu/queryDataUserAuth", data, postCfg)
  24. .success(function (res) {
  25. for (var i = 0; i < res.data[0].auths.length; i++) {
  26. if ((res.data[0].auths[i].ZID == "AA08" || res.data[0].auths[i].ZID == "AA85" || res.data[0].auths[i].ZID == "AA21" || res.data[0].auths[i].ZID == "AA71" || res.data[0].auths[i].ZID == "0") && res.data[0].auths[i].AUTH == "1") {
  27. self.userRole = 1;
  28. break
  29. } else if ((res.data[0].auths[i].ZID == "AA28" || res.data[0].auths[i].ZID == "AA30") && res.data[0].auths[i].AUTH == "1") {
  30. self.userRole = 2;
  31. break
  32. }
  33. }
  34. console.log(self.userRole)
  35. if (self.userRole == 1) {
  36. self.getData1()
  37. } else {
  38. self.getDP()
  39. }
  40. });
  41. }
  42. self.getDP = function () {
  43. var data = {
  44. userid: self.userId
  45. }
  46. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  47. .success(function (obj) {
  48. var res = strToJson(s4.decryptData_CBC(obj.data));
  49. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  50. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  51. self.getData1();
  52. })
  53. }
  54. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  55. self.getData1 = function () {
  56. self.list1 = [];
  57. var data = {
  58. fwflow: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA55|AA56|AA98|AA99|AA0A|AA0P",
  59. swflow: "AA18|AA16",
  60. yzflow: "",
  61. begindate: "",
  62. enddate: "",
  63. rediskey: "MMMMMMMMM"
  64. }
  65. $http.post(apiurljs.login + "g2app/richang/GongWenStatistics", data, postCfg)
  66. .success(function (res) {
  67. if (res.data == null || res.data == undefined || res.data == "") {
  68. self.noDataTip = 0;
  69. } else {
  70. self.noDataTip = 1;
  71. if (self.userRole == 1) {
  72. self.list1 = res.data.DEPARTMENT;
  73. } else {
  74. self.list1 = res.data.DEPARTMENT.filter(function (item) {
  75. return item.SECTCODE == self.userDpCode;
  76. })
  77. }
  78. }
  79. })
  80. }
  81. self.getUserRole()
  82. self.searchIds = function (ids, obj) {
  83. self.activeObj = obj;
  84. if (ids) {
  85. self.loading = true;
  86. self.routeinfoids = ids.replace(/\|/g, ",");
  87. self.searchType = [];
  88. self.search = {
  89. title: ""
  90. }
  91. $(".sp-checkbox-blue input").each(function () {
  92. $(this).attr("checked", false);
  93. $(this).parent("label").removeClass("chb-blue-checked");
  94. })
  95. self.getList(1)
  96. } else {
  97. return
  98. }
  99. }
  100. self.searchType = [];
  101. self.selectType = function (str) {
  102. if (self.searchType.indexOf(str) == -1) {
  103. self.searchType.push(str)
  104. } else {
  105. self.searchType.splice(self.searchType.indexOf(str), 1)
  106. }
  107. self.loading = true;
  108. self.routeinfoids = "";
  109. self.activeObj = null;
  110. self.getList(1)
  111. }
  112. self.search = {
  113. title: ""
  114. }
  115. self.getData2 = function () {
  116. self.loading = true;
  117. self.routeinfoids = "";
  118. self.activeObj = null;
  119. self.getList(1)
  120. }
  121. self.pageno = 1;
  122. self.total_count = 0;
  123. self.itemsPerPage = 10;
  124. self.pageOptions = [10, 20, 30, 40];
  125. self.getList = function (pageno) {
  126. self.pageno = pageno;
  127. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  128. var array = [];
  129. if (self.routeinfoids != "") {
  130. array.push({ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE_INFO", "COLID": "ROUTEINFOID", "VALUEA": self.routeinfoids, "VALUEB": "" })
  131. }
  132. var data = {
  133. flowid: "AA16|AA18",
  134. sectcode: self.userRole == 1 ? "" : self.userDpCode,
  135. lwdw: self.searchType.join("|"),
  136. title: self.search.title,
  137. userid: self.userId,
  138. pageno: self.pageno,
  139. pagesize: self.itemsPerPage,
  140. querycondition: JSON.stringify(array),
  141. columnscondition: ""
  142. }
  143. $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengBumenDubanWithPage", data, postCfg)
  144. .success(function (res) {
  145. self.loading = false;
  146. if (res.data == null || res.data == undefined || res.data == "") {
  147. self.noDataTip = 0;
  148. self.qlcList = []
  149. self.total_count = 0;
  150. } else {
  151. self.noDataTip = 1;
  152. res.data.forEach(function (item) {
  153. item.APPDATE = sp.format(item.APPDATE)
  154. item.ARCHIVESDATE = sp.format(item.ARCHIVESDATE)
  155. if (item.MARKARCHIVES == '1' || item.MARKARCHIVES == '2') {
  156. item.STATUSINFO_CN = '办结'
  157. } else{
  158. item.STATUSINFO_CN = '在办'
  159. }
  160. if (item.RELATELIST) {
  161. item.RELATELIST.forEach(function (iitem) {
  162. iitem.APPDATE = sp.format(iitem.APPDATE)
  163. if (iitem.STATUS == 'DEAL' || iitem.STATUS == 'START') {
  164. iitem.STATUSINFO_CN = '在办'
  165. } else if (iitem.STATUS == 'STOP') {
  166. iitem.STATUSINFO_CN = '办结'
  167. } else {
  168. iitem.STATUSINFO_CN = ''
  169. }
  170. })
  171. }
  172. })
  173. self.qlcList = res.data;
  174. self.total_count = res.meta.totalCount;
  175. }
  176. })
  177. }
  178. self.flowList = [];
  179. self.getFlow = function () {
  180. var data = {
  181. userid: self.userId,
  182. ntops: 0//6
  183. }
  184. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  185. .success(function (obj) {
  186. var res = strToJson(s4.decryptData_CBC(obj.data));
  187. res.data.forEach(function (item) {
  188. if (item.FLOWID != "无") {
  189. self.flowList.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
  190. }
  191. })
  192. })
  193. }
  194. self.getFlow()
  195. self.goUrl = function (obj) {
  196. let href = window.location.href
  197. let hrefArr = href.split('totalshouwen')
  198. if (hrefArr.length > 0) {
  199. self.flowList.forEach(function (item) {
  200. if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
  201. let FILENArr = item.FILEN.split('/')
  202. sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN)
  203. }
  204. })
  205. }
  206. }
  207. self.ywblMove = function (n) {
  208. var marginLeft = parseInt($(".List").css("margin-left").slice(0, $(".List").css("margin-left").indexOf("px"))) + n * $(".Item").outerWidth(true);
  209. if (marginLeft > 0) {
  210. $(".List").css("margin-left", 0)
  211. } else if (marginLeft < ($(".List").outerWidth(true) - $(".Item").outerWidth(true) * 5) * -1) {
  212. $(".List").css("margin-left", ($(".List").outerWidth(true) - $(".Item").outerWidth(true) * 5) * -1)
  213. } else {
  214. $(".List").css("margin-left", marginLeft)
  215. }
  216. }
  217. }])
  218. app.directive("repeatFinish", function () {
  219. return {
  220. link: function (scope) {
  221. $(".Item").eq(scope.$index).css("width", $(".List").parent().width() / 5 - 20)
  222. if (scope.$last == true) {
  223. $(".List").css("width", scope.$parent.ctl.list1.length * ($(".List").parent().width() / 5 + 20))
  224. }
  225. }
  226. };
  227. });
  228. app.directive("spCheckboxBlueItem", function () {
  229. return {
  230. restrict: "A",
  231. link: function (scope, elem, attrs) {
  232. if (!scope == false) {
  233. spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
  234. }
  235. }
  236. }
  237. });