authorityApplyCtrl.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. angular.module('push')
  2. .controller('authorityApplyCtrl', function ($scope, $stateParams, AuthorityService, UtilService, $timeout, UserService, ConstantService,CommonService) {
  3. if($scope.app){
  4. $scope.setStatusBar(0);
  5. }
  6. //初始化当前信息
  7. $scope.content = $stateParams.content;
  8. var messageId = $stateParams.messageId;
  9. $scope.type = $stateParams.type;//10:审批人 11:申请人
  10. $scope.appmessage = {targetid: 0};
  11. $scope.auditmessage = {content: ""};
  12. $scope.TRACE_TYPE_2640 = ConstantService.TRACE_TYPE_2640;//权限申请
  13. $scope.TRACE_TYPE_2641 = ConstantService.TRACE_TYPE_2641;//权限申请反馈
  14. // 申请权限详情
  15. var getApplyAuthorityDetail = function () {
  16. AuthorityService.getApplyAuthorityDetail(messageId).then(function (response) {
  17. //result 0:未审核,1:同意,2:拒绝
  18. $scope.appmessage = response.data;
  19. }, function () {
  20. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  21. });
  22. };
  23. getApplyAuthorityDetail();
  24. $scope.auditApply = function (result) {
  25. /*if ($scope.auditmessage.content.length < 1) {
  26. UtilService.showMess("申请理由不能为空");
  27. return;
  28. }*/
  29. var params = {
  30. aid: $scope.appmessage.targetid,
  31. userid: UserService.id,
  32. msgid: messageId,
  33. msg: $scope.auditmessage.content + " ",
  34. result: result
  35. };
  36. $scope.showLoadingToast();
  37. AuthorityService.auditApplyAuthority(params).then(function (response) {
  38. if($scope.app){
  39. UtilService.showMess("处理成功");
  40. }else{
  41. CommonService.showMessage('处理成功',$scope);
  42. }
  43. $timeout(function () {
  44. $scope.goback();
  45. }, 1000);
  46. $scope.hideLoadingToast();
  47. }, function () {
  48. $scope.hideLoadingToast();
  49. if($scope.app){
  50. UtilService.showMess("网络不给力,请稍后重试");
  51. }else{
  52. CommonService.showMessage('网络不给力,请稍后重试',$scope);
  53. }
  54. })
  55. };
  56. // 进入个人主页
  57. $scope.goPublisher = function (userid) {
  58. if (userid != 0) {
  59. $scope.go('publisher', {Id: userid});
  60. }
  61. };
  62. $scope.goInfoDetail = function () {
  63. if ($scope.appmessage.module_type == 81) {
  64. $scope.go('cloudDockingdetail', {
  65. infoid: $scope.appmessage.targetid,
  66. infocomefrom: $scope.appmessage.tarcomefrom,
  67. creator: $scope.appmessage.tarcreator
  68. });
  69. } else {
  70. $scope.go('resourceDetails', {
  71. recourceid: $scope.appmessage.targetid,
  72. recourcetype: $scope.appmessage.module_type,
  73. recourcecomefrom: $scope.appmessage.tarcomefrom,
  74. creator: $scope.appmessage.tarcreator
  75. });
  76. }
  77. };
  78. });