handlerDashboardCtrl.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. app.controller('handlerDashboardCtrl', ["$rootScope", "$scope", '$stateParams', '$http', '$state', '$timeout', '$ionicPopover', '$ionicLoading', 'api_bpm_domain', 'Restangular', 'api_user_data', 'getLoginUser', 'api_sysinfo', function($rootScope, $scope, $stateParams, $http, $state, $timeout, $ionicPopover, $ionicLoading, api_bpm_domain, Restangular, api_user_data, getLoginUser, api_sysinfo) {
  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. //常见问题
  27. $scope.fuwuurl = "";
  28. api_sysinfo.fetchDataList('systemConfiguration', { idx: 0, sum: 1000 }).then(function(data) {
  29. var myData = Restangular.stripRestangular(data).list;
  30. angular.forEach(myData, function(item) {
  31. if (item.id == 60) {
  32. $scope.fuwuurl = item.valueconfig;
  33. }
  34. });
  35. }, function() {
  36. // $ionicLoading.hide();
  37. });
  38. //加载最近5条公告
  39. $scope.refreshListData = function(filterData, loadStyle) {
  40. // var pdKey = 'bpm_incident';
  41. var showData = {};
  42. if (filterData) {
  43. filterData = angular.extend($scope.defaultData, filterData);
  44. } else {
  45. filterData = $scope.defaultData;
  46. }
  47. //遮罩层开启
  48. $ionicLoading.show({
  49. template: 'Loading...'
  50. });
  51. api_bpm_domain.fetchtask('bpm_incident', $scope.incidentData).then(function(data) {
  52. var myData = Restangular.stripRestangular(data);
  53. if (angular.isArray(myData.data)) {
  54. $scope.incidentLists = myData.data;
  55. } else {}
  56. //遮罩层关闭
  57. $ionicLoading.hide();
  58. }, function() {
  59. $ionicLoading.hide();
  60. });
  61. api_user_data.fetchDataList('notice', filterData).then(function(data) {
  62. var myData = Restangular.stripRestangular(data);
  63. if (angular.isArray(myData.list)) {
  64. $scope.noticeLists = myData.list;
  65. } else {}
  66. //遮罩层关闭
  67. $ionicLoading.hide();
  68. }, function() {
  69. //遮罩层关闭
  70. $ionicLoading.hide();
  71. });
  72. }
  73. if (!sessionStorage.sessionLogin) {
  74. var promise = getLoginUser.query();
  75. promise.then(function(sessionLogin) { //返回成功
  76. $scope.tokenType = sessionLogin.tokenType;
  77. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  78. var loginUser = sessionLogin.user;
  79. $scope.sessionLogin = sessionLogin
  80. $rootScope.user = sessionLogin.user;
  81. $scope.defaultData = {
  82. // 'assignee': loginUser.account,
  83. 'idx': 0,
  84. 'sum': 5,
  85. // 'candidateGroups': loginUser.group["0"].id
  86. };
  87. $scope.filterData = {
  88. // 'assignee': loginUser.account,
  89. 'idx': 0,
  90. 'sum': 5,
  91. };
  92. $scope.incidentData = {
  93. 'assignee': loginUser.id,
  94. 'idx': 0,
  95. 'sum': 2,
  96. 'candidateGroups': loginUser.group["0"].id
  97. };
  98. $scope.reload()
  99. }, function(data) { //返回失败
  100. });
  101. } else {
  102. var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
  103. var loginUser = sessionLogin.user;
  104. $scope.sessionLogin = sessionLogin
  105. $rootScope.user = sessionLogin.user;
  106. $scope.defaultData = {
  107. // 'assignee': loginUser.account,
  108. 'idx': 0,
  109. 'sum': 10,
  110. // 'candidateGroups': loginUser.group["0"].id
  111. };
  112. $scope.filterData = {
  113. // 'assignee': loginUser.account,
  114. 'idx': 0,
  115. 'sum': 5,
  116. };
  117. $scope.incidentData = {
  118. 'assignee': loginUser.id,
  119. 'idx': 0,
  120. 'sum': 2,
  121. 'candidateGroups': loginUser.group["0"].id,
  122. 'searchType':'todo'
  123. };
  124. $scope.reload()
  125. }
  126. }])