|
|
@@ -2,9 +2,9 @@
|
|
|
* index
|
|
|
*
|
|
|
*/
|
|
|
-define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-upload', 'common/directives', 'common/services', 'toaster', 'ngSanitize', 'services/Project', 'services/Activity', 'services/Organization', 'ui-form'], function(angularAMD) {
|
|
|
+define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-upload', 'common/directives', 'common/services', 'toaster', 'ngSanitize', 'services/Project', 'services/Activity', 'services/Organization', 'ui-form', 'services/User'], function(angularAMD) {
|
|
|
'use strict';
|
|
|
- var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'angularFileUpload', 'common.directives', 'common.services', 'toaster', 'ngSanitize', 'ProjectService', 'ActivityService', 'OrganizationService', 'ui.form']);
|
|
|
+ var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'angularFileUpload', 'common.directives', 'common.services', 'toaster', 'ngSanitize', 'ProjectService', 'ActivityService', 'OrganizationService', 'ui.form', 'UserService']);
|
|
|
app.init = function() {
|
|
|
angularAMD.bootstrap(app);
|
|
|
};
|
|
|
@@ -161,6 +161,9 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
return url;
|
|
|
};
|
|
|
|
|
|
+ // 定义主要领域
|
|
|
+ var areas = ['全部', '疾病援助', '扶贫/救灾', '教育/助学' , '环境/动物保护', '其他'];
|
|
|
+
|
|
|
app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', 'toaster', 'BaseService', '$modal', 'SessionService',
|
|
|
function ($scope, $window, AuthenticationService, toaster, BaseService, $modal, SessionService) {
|
|
|
$scope.isAuthed = AuthenticationService.isAuthed(); //AuthenticationService模块在common/下
|
|
|
@@ -2230,10 +2233,11 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
$scope.setActive = function (value) {
|
|
|
if ($scope.active != value) {
|
|
|
$scope.active = value;
|
|
|
- if ($scope.activityParams.page() == 1)
|
|
|
+ if ($scope.activityParams.page() == 1) {
|
|
|
$scope.activityParams.reload();
|
|
|
- else
|
|
|
+ } else {
|
|
|
$scope.activityParams.page(1);
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -2792,11 +2796,13 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
}
|
|
|
$scope.keyword = '';
|
|
|
|
|
|
+ $scope.areas = areas;
|
|
|
+
|
|
|
/**
|
|
|
* 修改分类
|
|
|
* @param value
|
|
|
*/
|
|
|
- $scope.setActive = function (value) {
|
|
|
+ $scope.setState = function (value) {
|
|
|
if ($scope.active != value) {
|
|
|
$scope.active = value;
|
|
|
if ($scope.orgParams.page() == 1)
|
|
|
@@ -2815,7 +2821,7 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
|
|
|
$scope.orgParams = new ngTableParams({
|
|
|
page: 1,
|
|
|
- count: 5,
|
|
|
+ count: 10,
|
|
|
sorting: {
|
|
|
'id': 'desc'
|
|
|
}
|
|
|
@@ -2875,9 +2881,6 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
});
|
|
|
|
|
|
modalInstance.result.then(function(data){
|
|
|
- if (data.success) {
|
|
|
- toaster.pop('success', '操作成功');
|
|
|
- }
|
|
|
$scope.orgParams.reload();
|
|
|
}, function(){
|
|
|
|
|
|
@@ -2885,6 +2888,29 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
|
|
|
};
|
|
|
|
|
|
+ // true通过 false驳回
|
|
|
+ $scope.auditOrg = function(org, type) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/view/user/org_audit.html',
|
|
|
+ controller: 'OrgAuditCtrl',
|
|
|
+ resolve: {
|
|
|
+ org : function() {
|
|
|
+ return org;
|
|
|
+ },
|
|
|
+ type : function() {
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data){
|
|
|
+ $scope.orgParams.reload();
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
}]);
|
|
|
|
|
|
@@ -2926,15 +2952,22 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
});
|
|
|
|
|
|
modalInstance.result.then(function(data){
|
|
|
+ loadData();
|
|
|
+ $modalInstance.close(data);
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.delete = function(id) {
|
|
|
+ Organization.delete({id: id}, {}, function(data) {
|
|
|
if (data.success) {
|
|
|
- toaster.pop('success','操作成功');
|
|
|
+ toaster.pop('success', data.success);
|
|
|
+ $modalInstance.close(data);
|
|
|
}
|
|
|
if (data.error) {
|
|
|
- toaster.pop('error','操作失败');
|
|
|
+ toaster.pop('error', data.error);
|
|
|
}
|
|
|
- loadData();
|
|
|
- }, function(){
|
|
|
-
|
|
|
});
|
|
|
};
|
|
|
}]);
|
|
|
@@ -2956,12 +2989,24 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
// true通过 false驳回
|
|
|
$scope.ensure = function(type) {
|
|
|
if (type) {
|
|
|
- Organization.agree({id: $scope.org.id}, {}, function () {
|
|
|
- toaster.pop('success', '审核成功');
|
|
|
+ Organization.agree({id: $scope.org.id}, {}, function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ toaster.pop('success','审核成功');
|
|
|
+ }
|
|
|
+ if (data.error) {
|
|
|
+ toaster.pop('error','操作失败');
|
|
|
+ }
|
|
|
+ $modalInstance.close(data);
|
|
|
});
|
|
|
} else {
|
|
|
- Organization.disagree({id: $scope.org.id, refuse: $scope.org.refuse}, {}, function () {
|
|
|
- toaster.pop('success', '驳回成功');
|
|
|
+ Organization.disagree({id: $scope.org.id, refuse: $scope.org.refuse}, {}, function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ toaster.pop('success','驳回成功');
|
|
|
+ }
|
|
|
+ if (data.error) {
|
|
|
+ toaster.pop('error','操作失败');
|
|
|
+ }
|
|
|
+ $modalInstance.close(data);
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
@@ -2975,125 +3020,234 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
BaseService.scrollBackToTop();
|
|
|
$rootScope.tree = 'user';
|
|
|
$rootScope.thief = 'userList';
|
|
|
- // var getOrgState = function (active) {
|
|
|
- // var fn = 'getAudited';
|
|
|
- // switch (active) {
|
|
|
- // // 已审核
|
|
|
- // case 'audited':
|
|
|
- // fn = 'getAudited';
|
|
|
- // break;
|
|
|
- // // 未审核
|
|
|
- // case 'unaudited':
|
|
|
- // fn = 'getUnaudited';
|
|
|
- // break;
|
|
|
- // // 未通过
|
|
|
- // case 'disagreed':
|
|
|
- // fn = 'getDisagreed';
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // return fn;
|
|
|
- // };
|
|
|
- //
|
|
|
- // $scope.active = 'done';
|
|
|
- // if ($rootScope.active) {
|
|
|
- // $scope.active = $rootScope.active;
|
|
|
- // }
|
|
|
- // $scope.keyword = '';
|
|
|
- //
|
|
|
- // /**
|
|
|
- // * 修改分类
|
|
|
- // * @param value
|
|
|
- // */
|
|
|
- // $scope.setActive = function (value) {
|
|
|
- // if ($scope.active != value) {
|
|
|
- // $scope.active = value;
|
|
|
- // if ($scope.orgParams.page() == 1)
|
|
|
- // $scope.orgParams.reload();
|
|
|
- // else
|
|
|
- // $scope.orgParams.page(1);
|
|
|
- // }
|
|
|
- // };
|
|
|
- //
|
|
|
- // $scope.reload = function() {
|
|
|
- // if ($scope.orgParams.page() == 1)
|
|
|
- // $scope.orgParams.reload();
|
|
|
- // else
|
|
|
- // $scope.orgParams.page(1);
|
|
|
- // };
|
|
|
- //
|
|
|
- // $scope.orgParams = new ngTableParams({
|
|
|
- // page: 1,
|
|
|
- // count: 5,
|
|
|
- // sorting: {
|
|
|
- // 'id': 'desc'
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // total: 0,
|
|
|
- // counts: [5, 10, 25, 50],
|
|
|
- // getData: function ($defer, params) {
|
|
|
- // $scope.loading = true;
|
|
|
- // var pageParams = params.url();
|
|
|
- // var realActive = {};
|
|
|
- // pageParams.searchFilter = { // 筛选条件
|
|
|
- // keyword: $scope.keyword,
|
|
|
- // area: $scope.selectedArea,
|
|
|
- // type: $scope.selectedType
|
|
|
- // };
|
|
|
- // Organization[getOrgState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
- // $scope.loading = false;
|
|
|
- // if (page) {
|
|
|
- // params.total(page.totalElements);
|
|
|
- // $defer.resolve(page.content);
|
|
|
- // // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词 做导出时需要的字段
|
|
|
- // }
|
|
|
- // }, function (response) {
|
|
|
- // $scope.loading = false;
|
|
|
- // toaster.pop('error', '数据加载失败', response.data);
|
|
|
- // });
|
|
|
- // }
|
|
|
- // });
|
|
|
- //
|
|
|
- // $scope.onSearch = function () {
|
|
|
- // if ($scope.orgParams.page() == 1)
|
|
|
- // $scope.orgParams.reload();
|
|
|
- // else
|
|
|
- // $scope.orgParams.page(1);
|
|
|
- // };
|
|
|
- //
|
|
|
- // var getNum = function() {
|
|
|
- // Organization.getOrgsNum({}, {}, function(data) {
|
|
|
- // $scope.auditedNum = data.auditedNum;
|
|
|
- // $scope.unauditedNum = data.unauditedNum;
|
|
|
- // $scope.disagreedNum = data.disagreedNum;
|
|
|
- // });
|
|
|
- // };
|
|
|
- // getNum();
|
|
|
- //
|
|
|
- // // 弹出详情页模态框
|
|
|
- // $scope.showDetail = function (id) {
|
|
|
+ var getState = function (active) {
|
|
|
+ var fn = 'getAll';
|
|
|
+ switch (active) {
|
|
|
+ // 管理员
|
|
|
+ case 'admin':
|
|
|
+ fn = 'getAdmin';
|
|
|
+ break;
|
|
|
+ // 机构用户
|
|
|
+ case 'orgUser':
|
|
|
+ fn = 'getOrgUser';
|
|
|
+ break;
|
|
|
+ // 机构操作员
|
|
|
+ case 'orgOperator':
|
|
|
+ fn = 'getOrgOperator';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return fn;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.active = 'all';
|
|
|
+ if ($rootScope.active) {
|
|
|
+ $scope.active = $rootScope.active;
|
|
|
+ }
|
|
|
+ $scope.keyword = '';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改分类
|
|
|
+ * @param value
|
|
|
+ */
|
|
|
+ $scope.setActive = function (value) {
|
|
|
+ if ($scope.active != value) {
|
|
|
+ $scope.active = value;
|
|
|
+ if ($scope.userParams.page() == 1)
|
|
|
+ $scope.userParams.reload();
|
|
|
+ else
|
|
|
+ $scope.userParams.page(1);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.reload = function() {
|
|
|
+ if ($scope.userParams.page() == 1)
|
|
|
+ $scope.userParams.reload();
|
|
|
+ else
|
|
|
+ $scope.userParams.page(1);
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.userParams = new ngTableParams({
|
|
|
+ page: 1,
|
|
|
+ count: 10,
|
|
|
+ sorting: {
|
|
|
+ 'userUU': 'asc'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts: [],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ var realActive = {};
|
|
|
+ pageParams.searchFilter = { // 筛选条件
|
|
|
+ keyword: $scope.keyword
|
|
|
+ };
|
|
|
+ User[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词 做导出时需要的字段
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.onSearch = function () {
|
|
|
+ if ($scope.userParams.page() == 1)
|
|
|
+ $scope.userParams.reload();
|
|
|
+ else
|
|
|
+ $scope.userParams.page(1);
|
|
|
+ };
|
|
|
+
|
|
|
+ var getNum = function() {
|
|
|
+ User.getUserNum({}, {}, function(data) {
|
|
|
+ $scope.allUserNum = data.allUserNum;
|
|
|
+ $scope.adminNum = data.adminNum;
|
|
|
+ $scope.orgUserNum = data.orgUserNum;
|
|
|
+ $scope.orgOperatorNum = data.orgOperatorNum;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ getNum();
|
|
|
+
|
|
|
+ // 弹出详情页模态框
|
|
|
+ $scope.showDetail = function (user) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/view/user/user_detail.html',
|
|
|
+ controller: 'UserDetailCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ user: function () {
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data){
|
|
|
+ $scope.userParams.reload();
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户详情框
|
|
|
+ */
|
|
|
+ app.controller('UserDetailCtrl', ['$scope', 'User', 'toaster', '$modalInstance', 'BaseService', 'user', '$modal', 'ngTableParams',
|
|
|
+ function($scope, User, toaster, $modalInstance, BaseService, user, $modal, ngTableParams) {
|
|
|
+
|
|
|
+ $scope.active = 'project';
|
|
|
+ var getState = function(value) {
|
|
|
+ var fn = 'getJoinedProjectRecords';
|
|
|
+ switch (value) {
|
|
|
+ case 'project' :
|
|
|
+ fn = 'getJoinedProjectRecords';
|
|
|
+ break;
|
|
|
+ case 'activity' :
|
|
|
+ fn = 'getJoinedActivityRecords';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return fn;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.setActive = function(value) {
|
|
|
+ if ($scope.active != value) {
|
|
|
+ $scope.active = value;
|
|
|
+ if ($scope.tableParams.page !== 1) {
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ } else {
|
|
|
+ $scope.tableParams.load();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.user = user;
|
|
|
+ var loadData = function() {
|
|
|
+ // 获取项目详情
|
|
|
+ User.getDetailByUserUU({userUU :user.userUU}, {}, function(data) {
|
|
|
+ $scope.user = data;
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '详情加载失败');
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancel= function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page: 1,
|
|
|
+ count: 5,
|
|
|
+ sorting: {
|
|
|
+ 'id': 'desc'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts: [],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ var realActive = {};
|
|
|
+ pageParams.searchFilter = { // 筛选条件
|
|
|
+ id: $scope.user.userUU,
|
|
|
+ keyword: $scope.keyword
|
|
|
+ };
|
|
|
+ User[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词 做导出时需要的字段
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // // true通过 false驳回
|
|
|
+ // $scope.auditOrg = function(type) {
|
|
|
// var modalInstance = $modal.open({
|
|
|
- // templateUrl: 'static/view/user/organization_detail.html',
|
|
|
- // controller: 'OrgDetailCtrl',
|
|
|
- // size: 'lg',
|
|
|
+ // animation: true,
|
|
|
+ // templateUrl: 'static/view/user/org_audit.html',
|
|
|
+ // controller: 'OrgAuditCtrl',
|
|
|
// resolve: {
|
|
|
- // id: function () {
|
|
|
- // return id;
|
|
|
+ // org : function() {
|
|
|
+ // return $scope.org;
|
|
|
+ // },
|
|
|
+ // type : function() {
|
|
|
+ // return type;
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
//
|
|
|
// modalInstance.result.then(function(data){
|
|
|
- // if (data.success) {
|
|
|
- // toaster.pop('success', '操作成功');
|
|
|
- // }
|
|
|
- // $scope.orgParams.reload();
|
|
|
+ // loadData();
|
|
|
+ // $modalInstance.close(data);
|
|
|
// }, function(){
|
|
|
//
|
|
|
// });
|
|
|
- //
|
|
|
// };
|
|
|
|
|
|
-
|
|
|
+ $scope.delete = function(id) {
|
|
|
+ User.delete({id: id}, {}, function(data) {
|
|
|
+ if (data.success) {
|
|
|
+ toaster.pop('success', data.success);
|
|
|
+ $modalInstance.close(data);
|
|
|
+ }
|
|
|
+ if (data.error) {
|
|
|
+ toaster.pop('error', data.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
}]);
|
|
|
|
|
|
return app;
|