|
|
@@ -122,7 +122,16 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop('error', '错误', response.data);
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+ $scope.adding = true;
|
|
|
+ $scope.setAdding = function (status) {
|
|
|
+ if (status || !$scope.inSelect) {
|
|
|
+ $scope.adding = status;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.inSelect = false;
|
|
|
+ $scope.setInSelect = function (status) {
|
|
|
+ $scope.inSelect = status;
|
|
|
+ }
|
|
|
/**
|
|
|
* 删除用户
|
|
|
*/
|
|
|
@@ -311,6 +320,19 @@ define(['app/app'], function(app) {
|
|
|
added && (getData());
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ $scope.editUserRole = function (user) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: $rootScope.rootPath + '/static/view/vendor/modal/edit_user_role.html',
|
|
|
+ controller: 'UserRoleEditCtrl',
|
|
|
+ resolve: {
|
|
|
+ user: function () {
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
}]);
|
|
|
|
|
|
/*
|
|
|
@@ -443,6 +465,7 @@ define(['app/app'], function(app) {
|
|
|
}]);
|
|
|
|
|
|
|
|
|
+ //角色权限-编辑角色controller
|
|
|
app.register.controller('RoleEditCtrl', ['$scope', '$modalInstance', '$timeout', 'AccountResource', 'AccountRole', 'toaster', 'role', 'BaseService', function ($scope, $modalInstance, $timeout, AccountResource, AccountRole, toaster, role, BaseService) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
$scope.role = role;
|
|
|
@@ -546,4 +569,32 @@ define(['app/app'], function(app) {
|
|
|
//})
|
|
|
};
|
|
|
}]);
|
|
|
+
|
|
|
+ app.register.controller('UserRoleEditCtrl', ['$scope', '$modalInstance', '$timeout', 'AccountResource', 'toaster', 'user', 'BaseService','AccountRole', function ($scope, $modalInstance, $timeout, AccountResource, toaster, user, BaseService, AccountRole) {
|
|
|
+ var init = function () {
|
|
|
+ $scope.user = angular.copy(user);
|
|
|
+ AccountRole.query({},function (data) {
|
|
|
+ $scope.rolesData = data;
|
|
|
+ angular.forEach($scope.rolesData, function (item) {
|
|
|
+ item.checked = false;
|
|
|
+ angular.forEach($scope.user.roles, function (userItem) {
|
|
|
+ if (item.id === userItem.id) {
|
|
|
+ item.checked = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ init();
|
|
|
+
|
|
|
+ //勾选角色
|
|
|
+ $scope.checkRole = function (role) {
|
|
|
+ role.checked = !role.checked;
|
|
|
+ }
|
|
|
+
|
|
|
+ //关闭模态框
|
|
|
+ $scope.cancelModal = function () {
|
|
|
+ $modalInstance.close();
|
|
|
+ }
|
|
|
+ }]);
|
|
|
});
|