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) { console.log('handlerDashboardCtrl is load'); //页面刷新 $scope.reload = function() { $scope.refreshListData(); } $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": "李四" }] //跳转到查看列表 $scope.lookFunction = function(data) { $state.go('tab.myNoticeDetail', { 'item': JSON.stringify(data) }); }; //跳转到请求人事件列表 $scope.toMyIncident = function(searchType) { $state.go('tab.incidentHandler'); sessionStorage.setItem("toMyIncident", JSON.stringify({ 'searchType': searchType, 'isClick': true })); }; //跳转到编辑列表 $scope.editorFunction = function(data) { $state.go('tab.incidentHandlerCustomFormIndex', { taskId: data.taskId, processInstanceId: data.processInstanceId }); }; //加载最近5条公告 $scope.refreshListData = function(filterData, loadStyle) { // var pdKey = 'bpm_incident'; var showData = {}; if (filterData) { filterData = angular.extend($scope.defaultData, filterData); } else { filterData = $scope.defaultData; } //遮罩层开启 $ionicLoading.show({ template: 'Loading...' }); api_bpm_domain.fetchtask('bpm_incident', $scope.incidentData).then(function(data) { var myData = Restangular.stripRestangular(data); if (angular.isArray(myData.data) && myData.data.length > 0) { $scope.incidentLists = myData.data; } else {} //遮罩层关闭 $ionicLoading.hide(); }, function() { $ionicLoading.hide(); }); api_user_data.fetchDataList('notice', filterData).then(function(data) { var myData = Restangular.stripRestangular(data); if (angular.isArray(myData.list) && myData.list.length > 0) { $scope.noticeLists = myData.list; } else {} //遮罩层关闭 $ionicLoading.hide(); }, function() { //遮罩层关闭 $ionicLoading.hide(); }); } if (!sessionStorage.sessionLogin) { var promise = getLoginUser.query(); promise.then(function(sessionLogin) { //返回成功 $scope.tokenType = sessionLogin.tokenType; var sessionLogin = JSON.parse(sessionStorage.sessionLogin); var loginUser = sessionLogin.user; $scope.sessionLogin = sessionLogin $rootScope.user = sessionLogin.user; $scope.defaultData = { // 'assignee': loginUser.account, 'idx': 0, 'sum': 5, // 'candidateGroups': loginUser.group["0"].id }; $scope.filterData = { // 'assignee': loginUser.account, 'idx': 0, 'sum': 5, }; $scope.incidentData = { 'assignee': loginUser.id, 'idx': 0, 'sum': 2, // 'candidateGroups': loginUser.group["0"].id 'candidateGroups': 0 }; $scope.reload() }, function(data) { //返回失败 }); } else { var sessionLogin = JSON.parse(sessionStorage.sessionLogin); var loginUser = sessionLogin.user; $scope.sessionLogin = sessionLogin $rootScope.user = sessionLogin.user; $scope.defaultData = { // 'assignee': loginUser.account, 'idx': 0, 'sum': 10, // 'candidateGroups': loginUser.group["0"].id }; $scope.filterData = { // 'assignee': loginUser.account, 'idx': 0, 'sum': 5, }; $scope.incidentData = { 'assignee': loginUser.id, 'idx': 0, 'sum': 2, // 'candidateGroups': loginUser.group["0"].id 'candidateGroups': 0 }; $scope.reload() } }])