handlerDashboardCtrl.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. app.controller('handlerDashboardCtrl', ["$rootScope", "$scope", '$stateParams', '$http', '$state', '$timeout', '$ionicPopover', '$ionicLoading', 'api_bpm_domain', 'Restangular', 'api_user_data', 'getLoginUser', function($rootScope, $scope, $stateParams, $http, $state, $timeout, $ionicPopover, $ionicLoading, api_bpm_domain, Restangular, api_user_data, getLoginUser) {
  2. console.log('handlerDashboardCtrl is load');
  3. //页面刷新
  4. $scope.reload = function() {
  5. $scope.refreshListData();
  6. }
  7. $scope.testNumber = [{ "id": 1, "name": "张三" }, { "id": 2, "name": "李四" }, { "id": 3, "name": "王五" }, { "id": 4, "name": "李四" }, { "id": 5, "name": "李四" }, { "id": 6, "name": "李四" }, { "id": 7, "name": "李四" }, { "id": 2, "name": "李四" }, { "id": 2, "name": "李四" }, { "id": 2, "name": "李四" }, { "id": 8, "name": "李四" }, { "id": 9, "name": "李四" }, { "id": 10, "name": "李四" }, { "id": 11, "name": "李四" }, { "id": 12, "name": "李四" }, { "id": 13, "name": "李四" }, { "id": 14, "name": "李四" }, { "id": 15, "name": "李四" }, { "id": 16, "name": "李四" }, { "id": 17, "name": "李四" }, { "id": 18, "name": "李四" }]
  8. //跳转到查看列表
  9. $scope.lookFunction = function(data) {
  10. $state.go('tab.myNoticeDetail', {
  11. 'item': JSON.stringify(data)
  12. });
  13. };
  14. //跳转到请求人事件列表
  15. $scope.toMyIncident = function(searchType) {
  16. $state.go('tab.incidentHandler');
  17. sessionStorage.setItem("toMyIncident", JSON.stringify({ 'searchType': searchType, 'isClick': true }));
  18. };
  19. //跳转到编辑列表
  20. $scope.editorFunction = function(data) {
  21. $state.go('tab.incidentHandlerCustomFormIndex', {
  22. taskId: data.taskId,
  23. processInstanceId: data.processInstanceId
  24. });
  25. };
  26. //加载最近5条公告
  27. $scope.refreshListData = function(filterData, loadStyle) {
  28. // var pdKey = 'bpm_incident';
  29. var showData = {};
  30. if (filterData) {
  31. filterData = angular.extend($scope.defaultData, filterData);
  32. } else {
  33. filterData = $scope.defaultData;
  34. }
  35. //遮罩层开启
  36. $ionicLoading.show({
  37. template: 'Loading...'
  38. });
  39. api_bpm_domain.fetchtask('bpm_incident', $scope.incidentData).then(function(data) {
  40. var myData = Restangular.stripRestangular(data);
  41. if (angular.isArray(myData.data) && myData.data.length > 0) {
  42. $scope.incidentLists = myData.data;
  43. } else {}
  44. //遮罩层关闭
  45. $ionicLoading.hide();
  46. }, function() {
  47. $ionicLoading.hide();
  48. });
  49. api_user_data.fetchDataList('notice', filterData).then(function(data) {
  50. var myData = Restangular.stripRestangular(data);
  51. if (angular.isArray(myData.list) && myData.list.length > 0) {
  52. $scope.noticeLists = myData.list;
  53. } else {}
  54. //遮罩层关闭
  55. $ionicLoading.hide();
  56. }, function() {
  57. //遮罩层关闭
  58. $ionicLoading.hide();
  59. });
  60. }
  61. if (!sessionStorage.sessionLogin) {
  62. var promise = getLoginUser.query();
  63. promise.then(function(sessionLogin) { //返回成功
  64. $scope.tokenType = sessionLogin.tokenType;
  65. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  66. var loginUser = sessionLogin.user;
  67. $scope.sessionLogin = sessionLogin
  68. $rootScope.user = sessionLogin.user;
  69. $scope.defaultData = {
  70. // 'assignee': loginUser.account,
  71. 'idx': 0,
  72. 'sum': 5,
  73. // 'candidateGroups': loginUser.group["0"].id
  74. };
  75. $scope.filterData = {
  76. // 'assignee': loginUser.account,
  77. 'idx': 0,
  78. 'sum': 5,
  79. };
  80. $scope.incidentData = {
  81. 'assignee': loginUser.id,
  82. 'idx': 0,
  83. 'sum': 2,
  84. // 'candidateGroups': loginUser.group["0"].id
  85. 'candidateGroups': 0
  86. };
  87. $scope.reload()
  88. }, function(data) { //返回失败
  89. });
  90. } else {
  91. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  92. var loginUser = sessionLogin.user;
  93. $scope.sessionLogin = sessionLogin
  94. $rootScope.user = sessionLogin.user;
  95. $scope.defaultData = {
  96. // 'assignee': loginUser.account,
  97. 'idx': 0,
  98. 'sum': 10,
  99. // 'candidateGroups': loginUser.group["0"].id
  100. };
  101. $scope.filterData = {
  102. // 'assignee': loginUser.account,
  103. 'idx': 0,
  104. 'sum': 5,
  105. };
  106. $scope.incidentData = {
  107. 'assignee': loginUser.id,
  108. 'idx': 0,
  109. 'sum': 2,
  110. // 'candidateGroups': loginUser.group["0"].id
  111. 'candidateGroups': 0
  112. };
  113. $scope.reload()
  114. }
  115. }])