user.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. define(['angular', 'ui-bootstrap', 'ngResource'], function (angular) {
  2. 'use strict';
  3. angular.module('common.query.user', ['ui.bootstrap', 'ngResource']).factory('UserService', ['$modal', function ($modal) {
  4. return {
  5. open: function (enterprise) {
  6. var modalInstance = $modal.open({
  7. templateUrl: 'static/view/common/query/user.html',
  8. controller: 'UserQueryCtrl',
  9. backdrop: "static",
  10. resolve: {
  11. enterprise: function () {
  12. return enterprise;
  13. }
  14. },
  15. windowClass: 'modal-large'
  16. });
  17. return modalInstance;
  18. }
  19. };
  20. }]).controller('UserQueryCtrl', ['$scope', '$modalInstance', '$http', '$filter', 'enterprise', 'ngTableParams', function ($scope, $modalInstance, $http, $filter, enterprise, ngTableParams) {
  21. $scope.enterprise = enterprise;
  22. $scope.tableParams = new ngTableParams({
  23. page: 1,
  24. total: 1,
  25. count: 500,
  26. sorting: {
  27. 'userName': 'asc'
  28. },
  29. filter: {
  30. 'enabled': 1
  31. }
  32. }, {
  33. groupBy: 'role',
  34. counts: [],
  35. getData: function ($defer, params) {
  36. $http.get('user/' + enterprise.uu + '/users').success(function (users) {
  37. if (users) {
  38. var data = params.filter() ? $filter('filter')(users, params.filter()) : users;
  39. params.total(data.length);
  40. data = params.sorting() ? $filter('orderBy')(data, $scope.tableParams.orderBy()) : data;
  41. $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
  42. }
  43. }).error(function () {
  44. });
  45. }
  46. });
  47. // 关闭模态窗
  48. $scope.close = function () {
  49. $modalInstance.close();
  50. };
  51. // 选中user
  52. $scope.select = function (user) {
  53. $modalInstance.close(angular.copy(user));
  54. };
  55. }]).factory('User', ['$resource', function ($resource) {
  56. return $resource('basic/user/personal', {}, {
  57. postImageUrl: {
  58. url: 'basic/user/setImageUrl',
  59. method: 'POST'
  60. },
  61. getUser: {
  62. method: 'GET'
  63. },
  64. getUserByUU: {
  65. url: 'basic/user/getUserByUU',
  66. method: 'GET'
  67. },
  68. checkPassword: {
  69. url: 'basic/user/checkPassword',
  70. method: 'GET'
  71. },
  72. updatePassword: {
  73. url: 'basic/user/updatePassword',
  74. method: 'POST'
  75. },
  76. update: {
  77. url: 'basic/user',
  78. method: 'PUT'
  79. },
  80. checkUserEmail: {
  81. url: 'basic/user/checkUserEmail',
  82. method: 'GET'
  83. },
  84. sendCheckCode: {
  85. url: 'basic/user/sendCheckCode',
  86. method: 'GET'
  87. },
  88. emailEnable: {
  89. url: 'basic/user/emailEnable',
  90. method: 'GET'
  91. },
  92. validCheckCode: {
  93. url: 'basic/user/validCheckCode',
  94. method: 'GET'
  95. },
  96. updateUserEmail: {
  97. url: 'basic/user/updateUserEmail',
  98. method: 'POST'
  99. },
  100. checkUserTel: {
  101. url: 'basic/user/checkUserTel',
  102. method: 'GET'
  103. },
  104. telEnable: {
  105. url: 'basic/user/telEnable',
  106. method: 'GET'
  107. },
  108. getPageToken: {
  109. url: 'basic/user/getPageToken',
  110. method: 'GET'
  111. },
  112. sendTelCheckCode: {
  113. url: 'basic/user/sendTelCheckCode',
  114. method: 'GET'
  115. },
  116. validTelCheckCode: {
  117. url: 'basic/user/validTelCheckCode',
  118. method: 'GET'
  119. },
  120. updateUserTel: {
  121. url: 'basic/user/updateUserTel',
  122. method: 'POST'
  123. },
  124. checkHaveUserPay: {
  125. url: 'basic/user/checkHaveUserPay',
  126. method: 'GET'
  127. },
  128. checkUserPay: {
  129. url: 'basic/user/checkUserPay',
  130. method: 'GET'
  131. },
  132. updateUserPay: {
  133. url: 'basic/user/updateUserPay',
  134. method: 'POST'
  135. },
  136. updateUserQuestion: {
  137. url: 'basic/user/updateUserQuestion',
  138. method: 'POST'
  139. },
  140. getUserQuestion: {
  141. url: 'basic/user/getUserQuestion',
  142. method: 'GET',
  143. isArray: true
  144. },
  145. updateRealAuth: {
  146. url: 'basic/user/updateRealAuth',
  147. method: 'POST'
  148. },
  149. getPageStatusRealAuth: {
  150. url: 'basic/user/getPageStatusRealAuth',
  151. method: 'GET'
  152. },
  153. updateIdEnable: {
  154. url: 'basic/user/updateIdEnable',
  155. method: 'POST'
  156. },
  157. getAllSecQuestion: {
  158. url: 'user/secQuestion/getPageInfo',
  159. method: 'GET'
  160. }
  161. });
  162. }]).factory('AccountResource', ['$resource', function ($resource) {
  163. return $resource('account/resource', {});
  164. }]).factory('AccountRole', ['$resource', function ($resource) {
  165. return $resource('account/role/:id',{},{
  166. getByExistRoleAndEnuu: {
  167. url: 'account/role/existRole',
  168. method: 'GET',
  169. isArray: true
  170. }
  171. });
  172. }]);
  173. });