angular.module('push') .controller('authorityApplyCtrl', function ($scope, $stateParams, AuthorityService, UtilService, $timeout, UserService, ConstantService,CommonService) { if($scope.app){ $scope.setStatusBar(0); } //初始化当前信息 $scope.content = $stateParams.content; var messageId = $stateParams.messageId; $scope.type = $stateParams.type;//10:审批人 11:申请人 $scope.appmessage = {targetid: 0}; $scope.auditmessage = {content: ""}; $scope.TRACE_TYPE_2640 = ConstantService.TRACE_TYPE_2640;//权限申请 $scope.TRACE_TYPE_2641 = ConstantService.TRACE_TYPE_2641;//权限申请反馈 // 申请权限详情 var getApplyAuthorityDetail = function () { AuthorityService.getApplyAuthorityDetail(messageId).then(function (response) { //result 0:未审核,1:同意,2:拒绝 $scope.appmessage = response.data; }, function () { UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR); }); }; getApplyAuthorityDetail(); $scope.auditApply = function (result) { /*if ($scope.auditmessage.content.length < 1) { UtilService.showMess("申请理由不能为空"); return; }*/ var params = { aid: $scope.appmessage.targetid, userid: UserService.id, msgid: messageId, msg: $scope.auditmessage.content + " ", result: result }; $scope.showLoadingToast(); AuthorityService.auditApplyAuthority(params).then(function (response) { if($scope.app){ UtilService.showMess("处理成功"); }else{ CommonService.showMessage('处理成功',$scope); } $timeout(function () { $scope.goback(); }, 1000); $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess("网络不给力,请稍后重试"); }else{ CommonService.showMessage('网络不给力,请稍后重试',$scope); } }) }; // 进入个人主页 $scope.goPublisher = function (userid) { if (userid != 0) { $scope.go('publisher', {Id: userid}); } }; $scope.goInfoDetail = function () { if ($scope.appmessage.module_type == 81) { $scope.go('cloudDockingdetail', { infoid: $scope.appmessage.targetid, infocomefrom: $scope.appmessage.tarcomefrom, creator: $scope.appmessage.tarcreator }); } else { $scope.go('resourceDetails', { recourceid: $scope.appmessage.targetid, recourcetype: $scope.appmessage.module_type, recourcecomefrom: $scope.appmessage.tarcomefrom, creator: $scope.appmessage.tarcreator }); } }; });