123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- app.controller('AdminSchoolReportCtrl', function($rootScope, $scope, $http, $timeout, $state, $window, $q, toaster) {
- $scope.pageObj = {pageSize: 10, total: 1, page: 1, totalPage: 1, query: ''};
-
- $scope.goPage = function(page){
- if(page < 1){
- toaster.pop('error', '已是第一页');
- return;
- }else if(page > $scope.pageObj.totalPage){
- toaster.pop('error', '超过最大页码');
- return;
- }
-
- console.log('go page school report');
-
- $scope.pageObj.page = page;
- var getCount = $http({
- url : $rootScope.host_url + '/adminOptr/schoolReportCount?session=' + $rootScope.session,
- method : 'post',
- data : angular.toJson($scope.pageObj)
- }).success(function(data) {
- if(data.code == 0){
- $scope.pageObj.total = data.result.stdCount;
- $scope.pageObj.totalPage = Math.ceil(data.result.stdCount / $scope.pageObj.pageSize);
- $scope.pageObj.totalPage = $scope.pageObj.totalPage == 0 ? 1 : $scope.pageObj.totalPage;
- }
- }).error(function() {
- });
-
- var getData = $http({
- url : $rootScope.host_url + '/adminOptr/schoolReport?session=' + $rootScope.session,
- method : 'post',
- data : angular.toJson($scope.pageObj)
- }).success(function(data) {
- if(data.code == 0){
- $scope.array = data.result;
- }
- }).error(function() {
- });
-
- $scope.myPromise = $q.all([getData, getCount]);
- }
-
- $scope.load = function(){
- $scope.goPage(1);
- }
- $scope.load();
-
- });
|