app.controller('AdminBaseInfoModifyApplyCtrl', function($rootScope, $scope, $http, $timeout, $state, $window, $q, toaster) { $scope.pageObj = {pageSize: 10, total: 1, page: 1, totalPage: 1, query: '',reply_status: ''}; $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 std'); $scope.pageObj.page = page; var getCount = $http({ url : $rootScope.host_url + '/adminOptr/baseInfoModifyApplyCount?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/baseInfoModifyApply?session=' + $rootScope.session, method : 'post', data : angular.toJson($scope.pageObj) }).success(function(data) { if(data.code == 0){ $scope.applies = data.result; } }).error(function() { }); $scope.myPromise = $q.all([getData, getCount]); } $scope.load = function(){ $scope.goPage(1); } $scope.load(); $scope.showDetail = function(applyId){ $state.go('baseInfoModifyApplyDetail', {id: applyId}); } }) .controller('AdminBaseInfoModifyApplyDetailCtrl', function($rootScope, $scope, $http, $timeout, $state, $window, $q, toaster, $stateParams) { $scope.load = function(){ var fuheRequest = $http({ url :$rootScope.host_url + '/adminOptr/baseInfoModifyApplyDetail?id=' + $stateParams.id + '&session=' + $rootScope.session, method : 'GET' }).success(function(data) { if(data.code == 0 && data.result){ $scope.apply = data.result; } }).error(function() { }); $scope.myPromise = $q.all([fuheRequest]); } $scope.load(); $scope.submitForm = function(){ if(!$scope.apply.status || $scope.apply.status.length == 0){ toaster.pop('error', '请输入审核结果!'); return; } $rootScope.dialogMsg("请确认是否提交审核结果", function(){ $scope.myPromise = $http({ url : $rootScope.host_url + '/adminOptr/postBaseInfoModifyApplyReply?&session=' + $rootScope.session, method : 'POST', data : angular.toJson($scope.apply) }).success(function(data) { if(data.code == 0){ $scope.load(); } }).error(function() { }); }); } $scope.showStdOverview = function(std_id){ $state.go('stdInfo', {std_id: std_id}); } });