|
|
@@ -1822,8 +1822,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- app.controller('UserCtrl', function($scope, $rootScope, $filter, AuthenticationService, AccountUser, BaseService, ngTableParams){
|
|
|
+ app.controller('UserCtrl', function($scope, $rootScope, $filter, AuthenticationService, AccountUser, BaseService, ngTableParams, toaster, $modal){
|
|
|
+ $scope.editing = false;
|
|
|
+ $scope.loading = true;
|
|
|
AuthenticationService.getAuthentication().success(function(data) {
|
|
|
+ $scope.loading = false;
|
|
|
$scope.user = data;
|
|
|
});
|
|
|
var users = [];
|
|
|
@@ -1847,7 +1850,73 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
AccountUser.getAll({}, function(data){
|
|
|
users = data;
|
|
|
$scope.tableParams.reload();
|
|
|
+ $scope.loading = false;
|
|
|
});
|
|
|
+ $scope.saveUser = function(){
|
|
|
+ $scope.loading = true;
|
|
|
+ AccountUser.saveUser({}, $scope.user, function(data){
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('success', '提示', '修改用户信息成功');
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
+ $scope.user = data;
|
|
|
+ });
|
|
|
+ AccountUser.getAll({}, function(data){
|
|
|
+ users = data;
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ });
|
|
|
+ $scope.editing = false;
|
|
|
+ }, function(reponse){
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '失败', reponse.data);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.updatePassword = function(){
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'updatePassword.html',
|
|
|
+ controller: 'PasswordCtrl',
|
|
|
+ resolve: {
|
|
|
+ user: function(){return $scope.user;}
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ app.controller('PasswordCtrl', function($scope, $modalInstance, user, AccountUser, toaster){
|
|
|
+ $scope.user = user;
|
|
|
+ $scope.checking = false;
|
|
|
+ //输入原密码后验证原密码是否正确
|
|
|
+ $scope.checkPassword = function(password) {
|
|
|
+ $scope.checking = true;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ console.log(password);
|
|
|
+ AccountUser.checkPassword({password: password}, function(data){
|
|
|
+ $scope.checkSuccess = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ }, function(response){
|
|
|
+ $scope.checkFailed = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ //确认送样
|
|
|
+ $scope.ok = function () {
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancel = function () {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ };
|
|
|
});
|
|
|
|
|
|
app.controller('LogCtrl', function($scope, $rootScope, BaseService, ngTableParams, ErpLog, UsageLog){
|