ywbl2.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. self.list1 = [
  18. { FLOWID: "AA18|AA16|AA02|AA17", FLOWCODE: "FZB01", CNAME: "收文办理", FILEN: "tpl/shouwenbg/list.html", sortid: 1 },
  19. { FLOWID: "AA19", FLOWCODE: "FZB02", CNAME: "督办公文延期", FILEN: "tpl/shouwenys/list.html", sortid: 2 },
  20. { FLOWID: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80", FLOWCODE: "FZC01", CNAME: "行政发文", FILEN: "tpl/fawenbg/list.html", sortid: 3 },
  21. { FLOWID: "AA88|AA89|AA46|AA22|AA54|AA58", FLOWCODE: "FZC02", CNAME: "党委发文", FILEN: "tpl/fawendw/list.html", sortid: 4 },
  22. { FLOWID: "AA73|AA82", FLOWCODE: "FZD01", CNAME: "事项督办", FILEN: "tpl/shixiangdb/list.html", sortid: 5 },
  23. { FLOWID: "AA52", FLOWCODE: "FZD02", CNAME: "事项督办延时", FILEN: "tpl/shixiangys/list.html", sortid: 6 },
  24. { FLOWID: "AA50|AA84", FLOWCODE: "FZE01", CNAME: "文件发布", FILEN: "tpl/wenjianbg/list.html", sortid: 7 },
  25. { FLOWID: "AA53", FLOWCODE: "FZF01", CNAME: "市政府转办", FILEN: "tpl/gongkaishi/list.html", sortid: 8 },
  26. { FLOWID: "AA51", FLOWCODE: "FZF02", CNAME: "住建委申请", FILEN: "tpl/gongkaizhu/list.html", sortid: 9 },
  27. { FLOWID: "AA25", FLOWCODE: "FZG01", CNAME: "网站信息发布", FILEN: "tpl/wangzhaninfo/list.html", sortid: 10 },
  28. { FLOWID: "AA26", FLOWCODE: "FZG02", CNAME: "住建工作动态", FILEN: "tpl/gongzuodt/list.html", sortid: 11 },
  29. { FLOWID: "AA01", FLOWCODE: "FZI01", CNAME: "政民零距离", FILEN: "tpl/xinfangzm/list.html", sortid: 12 },
  30. { FLOWID: "AA12", FLOWCODE: "FZI02", CNAME: "信访办理", FILEN: "tpl/xinfangbg/list.html", sortid: 13 },
  31. { FLOWID: "AA13|AA14|AA15", FLOWCODE: "FZJ02", CNAME: "车辆派遣", FILEN: "tpl/cheliangbg/list.html", sortid: 14 },
  32. { FLOWID: "AA81", FLOWCODE: "FZJ04", CNAME: "办公用品", FILEN: "tpl/bangongbg/list.html", sortid: 15 },
  33. { FLOWID: "AA27|AA71|AA72", FLOWCODE: "FZJ07", CNAME: "会议室申请", FILEN: "tpl/huiyishibg/list.html", sortid: 16 },
  34. { FLOWID: "AA91", FLOWCODE: "FZJ22", CNAME: "会议反馈", FILEN: "tpl/huiyishibg/list1.html", sortid: 17 },
  35. { FLOWID: "AA66|AA67|AA83", FLOWCODE: "FZJ08", CNAME: "值班管理", FILEN: "tpl/zhibanmgr/list.html", sortid: 18 },
  36. { FLOWID: "AA28|AA29|AA30|AA31|AA32|AA33|AA34|AA35", FLOWCODE: "FZJ09", CNAME: "请假管理", FILEN: "tpl/qingjiamgr/list.html", sortid: 19 },
  37. { FLOWID: "AA36|AA37|AA38|AA39", FLOWCODE: "FZJ10", CNAME: "销假管理", FILEN: "tpl/xiaojiamgr/list.html", sortid: 20 },
  38. { FLOWID: "AA74", FLOWCODE: "FZJ11", CNAME: "OA变更管理", FILEN: "tpl/oabgmgr/list.html", sortid: 21 },
  39. { FLOWID: "AA64", FLOWCODE: "FZJ13", CNAME: "用章管理", FILEN: "tpl/yzhangmgr/list.html", sortid: 22 },
  40. { FLOWID: "AA68", FLOWCODE: "FZJ15", CNAME: "领导日程", FILEN: "tpl/lingdaobg/list.html", sortid: 23 },
  41. { FLOWID: "AA85", FLOWCODE: "FZJ16", CNAME: "通知公告", FILEN: "tpl/tongzhibg/list.html", sortid: 24 },
  42. { FLOWID: "AA47", FLOWCODE: "FZJ21", CNAME: "自定义工作", FILEN: "tpl/custom/list.html", sortid: 25 }
  43. ]
  44. self.list2 = [];
  45. self.list3 = [];
  46. self.getTop6 = function () {
  47. var data = {
  48. userid: self.userId
  49. }
  50. $http.post(apiurljs.login + "UserPower/Permissions", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  51. .success(function (obj) {
  52. var res = strToJson(s4.decryptData_CBC(obj.data));
  53. console.log(res.data)
  54. res.data.rows.forEach(function (item) {
  55. item.C_H_I_L_D.forEach(function (item1) {
  56. self.list1.forEach(function (item2) {
  57. if (item2.FLOWCODE == item1.PKID) {
  58. if (self.list2.indexOf(item2) == -1) {
  59. self.list2.push(item2)
  60. }
  61. }
  62. })
  63. })
  64. })
  65. if (self.list2.length < 6) {
  66. var n = 6 - self.list2.length;
  67. self.list1.forEach(function (item) {
  68. if (self.list2.length < 6) {
  69. if (self.list2.indexOf(item) == -1) {
  70. self.list2.push(item)
  71. }
  72. }
  73. })
  74. }
  75. self.getNum(0)
  76. })
  77. }
  78. self.getTop6()
  79. self.getNum = function (n) {
  80. var data = { "flowid": self.list2[n].FLOWID, "userid": self.userId, "pageno": 0, "pagesize": 0 }
  81. $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  82. .success(function (obj) {
  83. var res = strToJson(s4.decryptData_CBC(obj.data));
  84. self.list2[n].NUM = res.meta.totalCount;
  85. if (n + 1 < self.list2.length) {
  86. self.getNum(n + 1)
  87. } else {
  88. self.list2 = self.list2.sort(function (a, b) {
  89. if (a.NUM < b.NUM) {
  90. return 1;
  91. }
  92. if (a.NUM > b.NUM) {
  93. return -1;
  94. }
  95. return 0;
  96. })
  97. for (var i = 0; i < 6; i++) {
  98. self.list2[i].background = { "background-image": "url(img/img" + (i + 1) + ".png)" }
  99. self.list3.push(self.list2[i])
  100. }
  101. }
  102. })
  103. }
  104. self.addTabNav = function (obj) {
  105. window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  106. }
  107. }])