|
|
@@ -67,8 +67,8 @@ define(['app/app'], function (app) {
|
|
|
customer: function () {
|
|
|
return customer;
|
|
|
},
|
|
|
- type: function () {
|
|
|
- return 'purchase'
|
|
|
+ thisUser: function () {
|
|
|
+ return $scope.thisUser
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -104,8 +104,8 @@ define(['app/app'], function (app) {
|
|
|
customer: function () {
|
|
|
return customer;
|
|
|
},
|
|
|
- type: function () {
|
|
|
- return 'purchase'
|
|
|
+ thisUser: function () {
|
|
|
+ return $scope.thisUser
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -194,43 +194,70 @@ define(['app/app'], function (app) {
|
|
|
}
|
|
|
}]);
|
|
|
// 转移权限
|
|
|
- app.register.controller('TransferUserInfoCtrl', ['$scope', '$rootScope', '$modalInstance', 'customer', 'B2bAccountUser', 'toaster', 'B2bAuthenticationService', function ($scope, $rootScope, $modalInstance, customer, AccountUser, toaster, AuthenticationService) {
|
|
|
- AuthenticationService.getAuthentication().success(function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- $scope.thisUser = data;
|
|
|
- $scope.checkboxes = {
|
|
|
- checked: false
|
|
|
- };
|
|
|
- $scope.loading = true;
|
|
|
- $scope.transfer = [];
|
|
|
- AccountUser.findUsers({uu: customer.myEnterprise.uu}, {}, function (data) {
|
|
|
- $scope.userinfos = data;
|
|
|
- var transfer = [];
|
|
|
- angular.forEach($scope.userinfos, function (user, index) {
|
|
|
- // 当前用户是被管理员转移权限时,转移的是被管理员转移的权限。
|
|
|
- if ($scope.thisUser.userUU === user.userUU && user.transfer) {
|
|
|
- $scope.thisUser.transfer = true;
|
|
|
- }
|
|
|
- });
|
|
|
- angular.forEach($scope.userinfos, function (user, index) {
|
|
|
- if ($scope.thisUser.sys || $scope.thisUser.transfer) {
|
|
|
- if (user.transfer) {
|
|
|
- transfer.push({num: index});
|
|
|
- user.checked = true;
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (user.distribute) {
|
|
|
- transfer.push({num: index});
|
|
|
- user.checked = true;
|
|
|
- }
|
|
|
+ app.register.controller('TransferUserInfoCtrl', ['$scope', '$rootScope', '$modalInstance', 'customer', 'B2bAccountUser', 'toaster', 'ngTableParams', 'BaseService', 'thisUser', function ($scope, $rootScope, $modalInstance, customer, AccountUser, toaster, ngTableParams, BaseService, thisUser) {
|
|
|
+ $scope.checkboxes = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+ $scope.thisUser = thisUser;
|
|
|
+ $scope.userParams = new ngTableParams({
|
|
|
+ page: 1,
|
|
|
+ count:10,
|
|
|
+ sorting:{}
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts: [5, 10, 15, 25, 50],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ $scope.transfer = [];
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ pageParams.id = customer.id;
|
|
|
+ AccountUser.findUsers(BaseService.parseParams(pageParams), function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (data) {
|
|
|
+ $defer.resolve(data.content);
|
|
|
+ $scope.userinfos = data.content;
|
|
|
+ var transfer = [];
|
|
|
+ angular.forEach($scope.userinfos, function (user, index) {
|
|
|
+ // 当前用户是被管理员转移权限时,转移的是被管理员转移的权限。
|
|
|
+ if ($scope.thisUser.userUU === user.userUU && user.transfer) {
|
|
|
+ $scope.thisUser.transfer = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ angular.forEach($scope.userinfos, function (user, index) {
|
|
|
+ if ($scope.thisUser.sys || $scope.thisUser.transfer) {
|
|
|
+ if (user.transfer) {
|
|
|
+ transfer.push({num: index});
|
|
|
+ user.checked = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (user.distribute) {
|
|
|
+ transfer.push({num: index});
|
|
|
+ user.checked = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.transfer = transfer;
|
|
|
+ $scope.havedone = angular.copy($scope.transfer);
|
|
|
+ $scope.total = data.totalElement;
|
|
|
+ params.total(data.totalElement);
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
|
|
|
}
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
});
|
|
|
- $scope.transfer = transfer;
|
|
|
- $scope.havedone = angular.copy($scope.transfer);
|
|
|
- $scope.loading = false;
|
|
|
- });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function () {
|
|
|
+ $scope.userParams.page(1);
|
|
|
+ $scope.userParams.reload();
|
|
|
+ $scope.isChanged = false;
|
|
|
+ $scope.isChangedAll = false;
|
|
|
+ };
|
|
|
+
|
|
|
var checkStatus = function (userinfos) {
|
|
|
var transfer = [];
|
|
|
angular.forEach(userinfos, function (user, index) {
|
|
|
@@ -285,7 +312,7 @@ define(['app/app'], function (app) {
|
|
|
$scope.close = function (save) {
|
|
|
var chooseResult = [];
|
|
|
if (save) {
|
|
|
- if (customer.myEnterprise.uu) {
|
|
|
+ if (customer.id) {
|
|
|
// 当前用户是管理员时
|
|
|
if ($scope.thisUser.sys) {
|
|
|
angular.forEach($scope.userinfos, function (item, i) {
|
|
|
@@ -336,29 +363,56 @@ define(['app/app'], function (app) {
|
|
|
};
|
|
|
|
|
|
}]);
|
|
|
- app.register.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'B2bAccountUser', 'toaster', 'AuthenticationService',
|
|
|
- function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService) {
|
|
|
- AuthenticationService.getAuthentication().success(function (data) {
|
|
|
- $scope.thisUser = data;
|
|
|
+ app.register.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'B2bAccountUser', 'toaster', 'ngTableParams', 'BaseService', 'thisUser',
|
|
|
+ function ($scope, $modalInstance, customer, AccountUser, toaster, ngTableParams, BaseService, thisUser) {
|
|
|
$scope.checkboxes = {
|
|
|
checked: false
|
|
|
};
|
|
|
- $scope.loading = true;
|
|
|
- $scope.distribute = [];
|
|
|
- AccountUser.findUsers({uu: customer.myEnterprise.uu}, null, function (data) {
|
|
|
- $scope.userinfos = data;
|
|
|
- var distribute = [];
|
|
|
- angular.forEach($scope.userinfos, function (user, index) {
|
|
|
- if (user.distribute) {
|
|
|
- distribute.push({num: index});
|
|
|
+ $scope.thisUser = thisUser;
|
|
|
+ $scope.userParams = new ngTableParams({
|
|
|
+ page: 1,
|
|
|
+ count: 10,
|
|
|
+ sorting: {}
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts:[5,10,15,25,50],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ $scope.distribute = [];
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ pageParams.id = customer.id
|
|
|
+ AccountUser.findUsers(BaseService.parseParams(pageParams), function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if(data) {
|
|
|
+ $defer.resolve(data.content);
|
|
|
+ $scope.userinfos = data.content;
|
|
|
+ var distribute = [];
|
|
|
+ angular.forEach($scope.userinfos, function (user, index) {
|
|
|
+ if (user.distribute) {
|
|
|
+ distribute.push({num: index});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.distribute = distribute;
|
|
|
+ $scope.havedone = angular.copy($scope.distribute);
|
|
|
+ $scope.total = data.totalElement;
|
|
|
+ params.total(data.totalElement);
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
|
|
|
}
|
|
|
+ }, function (err) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', err.data);
|
|
|
});
|
|
|
- $scope.distribute = distribute;
|
|
|
- $scope.havedone = angular.copy($scope.distribute);
|
|
|
- $scope.loading = false;
|
|
|
- });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+ $scope.onSearch = function () {
|
|
|
+ $scope.userParams.page(1);
|
|
|
+ $scope.userParams.reload();
|
|
|
+ $scope.isChanged = false;
|
|
|
+ $scope.isChangedAll = false;
|
|
|
+ };
|
|
|
+
|
|
|
var checkStatus = function (userinfos) {
|
|
|
var distribute = [];
|
|
|
angular.forEach(userinfos, function (user, index) {
|
|
|
@@ -395,13 +449,13 @@ define(['app/app'], function (app) {
|
|
|
$scope.close = function (save) {
|
|
|
var chooseResult = [];
|
|
|
if (save) {
|
|
|
- if (customer.myEnterprise.uu) {
|
|
|
+ if (customer.id) {
|
|
|
angular.forEach($scope.userinfos, function (item, i) {
|
|
|
chooseResult.push(item);
|
|
|
});
|
|
|
if (chooseResult.length > 0) {
|
|
|
$scope.loading = true;
|
|
|
- AccountUser.addUserToVendor({uu: customer.myEnterprise.uu}, chooseResult, function (data) {
|
|
|
+ AccountUser.addUserToVendor({id: customer.id}, chooseResult, function (data) {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('success', '提示', '保存成功');
|
|
|
$modalInstance.close(false);
|