|
@@ -578,7 +578,7 @@ 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) {
|
|
|
|
|
|
|
+ app.register.controller('UserRoleEditCtrl', ['$scope', '$modalInstance', '$timeout', 'AccountResource', 'toaster', 'user', 'BaseService','AccountRole','User', function ($scope, $modalInstance, $timeout, AccountResource, toaster, user, BaseService, AccountRole, User) {
|
|
|
var init = function () {
|
|
var init = function () {
|
|
|
$scope.user = angular.copy(user);
|
|
$scope.user = angular.copy(user);
|
|
|
AccountRole.query({},function (data) {
|
|
AccountRole.query({},function (data) {
|
|
@@ -594,6 +594,7 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
init();
|
|
init();
|
|
|
|
|
+ $scope.checked = [];
|
|
|
|
|
|
|
|
//勾选角色
|
|
//勾选角色
|
|
|
$scope.checkRole = function (role) {
|
|
$scope.checkRole = function (role) {
|
|
@@ -604,5 +605,30 @@ define(['app/app'], function(app) {
|
|
|
$scope.cancelModal = function () {
|
|
$scope.cancelModal = function () {
|
|
|
$modalInstance.close();
|
|
$modalInstance.close();
|
|
|
}
|
|
}
|
|
|
|
|
+ $scope.close = function (save) {
|
|
|
|
|
+ if (save) {
|
|
|
|
|
+ if (user.userUU) {
|
|
|
|
|
+ debugger;
|
|
|
|
|
+ console.log($scope.checked);
|
|
|
|
|
+ angular.forEach($scope.rolesData, function (item) {
|
|
|
|
|
+ if (item.checked){
|
|
|
|
|
+ delete item.checked;
|
|
|
|
|
+ $scope.checked.push(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ user.roles = $scope.checked;
|
|
|
|
|
+ User.update({}, user, function () {
|
|
|
|
|
+ toaster.pop('success', '提示', '保存成功');
|
|
|
|
|
+ $modalInstance.close(true);
|
|
|
|
|
+ }, function (response) {
|
|
|
|
|
+ toaster.pop('error', '保存失败', response.data);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $modalInstance.close(true, $scope.checked);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $modalInstance.close(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
}]);
|
|
}]);
|
|
|
});
|
|
});
|