AuditRealAuthCtrl.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. define(['app/app'], function (app) {
  2. 'use strict';
  3. app.register.controller('AuditRealAuthCtrl', ['$scope', 'ngTableParams', 'User', 'toaster', 'BaseService', '$modal', function ($scope, ngTableParams, User, toaster, BaseService, $modal) {
  4. $scope.active = 'tobeAudit';
  5. $scope.status = 2;
  6. //table设置
  7. $scope.realAuthTableParams = new ngTableParams({
  8. page : 1,
  9. count : 5
  10. }, {
  11. total : 0,
  12. getData : function ($defer, params) {
  13. const param = BaseService.parseParams(params.url());
  14. param.status = $scope.status;
  15. User.getPageStatusRealAuth(param, function (data) {
  16. params.total(data.totalElements);
  17. $defer.resolve(data.content);
  18. }, function (response) {
  19. toaster.pop('error', '获取账户信息失败 ', response.data);
  20. });
  21. }
  22. });
  23. $scope.updateIdEnable = function(idEnable, info){
  24. User.updateIdEnable({userUU:info.userUU,idEnable:idEnable},{},function(data){
  25. toaster.pop('success', '审批完成');
  26. $scope.realAuthTableParams.reload();
  27. },function(response){
  28. toaster.pop('error', response.data);
  29. });
  30. }
  31. $scope.remarks = function (info) {
  32. openModal(info);
  33. }
  34. // 备注模态框
  35. var openModal = function(info) {
  36. var modalInstance = $modal.open({
  37. templateUrl : 'static/view/admin/modal/realAuth_remarks.html', //指向上面创建的视图
  38. controller : 'AuthRemarksEditCtrl',// 初始化模态范围
  39. size : 'sm', // 大小配置
  40. resolve: {
  41. info: function() {
  42. return info;
  43. }
  44. }
  45. });
  46. modalInstance.opened.then(function(){// 模态窗口打开之后执行的函数
  47. });
  48. modalInstance.result.then(function(updatedProperty){
  49. $scope.realAuthTableParams.reload();
  50. }, function(res){
  51. });
  52. }
  53. }]);
  54. app.register.controller('AuthRemarksEditCtrl', ['$scope','info', '$modalInstance','ngTableParams', 'User', 'toaster', 'BaseService', function ($scope, info, $modalInstance, ngTableParams, User, toaster, BaseService) {
  55. $scope.confirm = function(){
  56. User.updateIdEnable({userUU: info.userUU,idEnable: 0,idRemarks: $scope.idRemarks},{},function(data){
  57. toaster.pop('success', '审批完成,已将审批不通过原因发送给用户');
  58. $modalInstance.close();
  59. },function(response){
  60. toaster.pop('error', response.data);
  61. });
  62. }
  63. $scope.cancel = function() {
  64. $modalInstance.dismiss();
  65. }
  66. }]);
  67. });