Browse Source

Merge remote-tracking branch 'origin/feature-201844-wangcz' into feature-201844-wangcz

yuj 7 years ago
parent
commit
16b29d2172

+ 6 - 8
src/main/webapp/resources/js/common/b2bServices.js

@@ -193,21 +193,19 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                     method: 'GET'
                 },
                 findUsers: {
-                    url: b2bPath + '/account/user/customer/:uu',
-                    method: 'POST',
-                    isArray: true
+                    url: b2bPath + '/account/user/customer/:id',
+                    method: 'GET'
                 },
                 findSaleUsers: {
                     url: b2bPath + '/vendorDistribute/:id',
-                    method: 'POST',
-                    isArray: true
+                    method: 'GET'
                 },
                 addSaleUserToVendor: {
                     url: b2bPath + '/vendorDistribute/bindVendor/:id',
                     method: 'POST'
                 },
                 addUserToVendor: {
-                    url: b2bPath + '/account/user/bindUserToVendor/:uu',
+                    url: b2bPath + '/account/user/bindUserToVendor/:id',
                     method: 'POST'
                 },
                 transferSaleUserToVendor: {
@@ -215,7 +213,7 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                     method: 'POST'
                 },
                 transferUserToVendor: {
-                    url: b2bPath + '/account/user/transferUserToVendor/:uu',
+                    url: b2bPath + '/account/user/transferUserToVendor/:id',
                     method: 'POST'
                 },
                 transferMyDistribute: {
@@ -228,7 +226,7 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                     isArray: true
                 },
                 getDistribute: {
-                    url: b2bPath + '/account/user/getDistribute/:custUU',
+                    url: b2bPath + '/account/user/getDistribute/:id',
                     method: 'GET'
                 },
                 getEnTransfer: {

+ 114 - 53
src/main/webapp/resources/js/usercenter/controllers/b2b/Purc/PurcVendorCtrl.js

@@ -67,6 +67,9 @@ define(['app/app'], function(app) {
                 resolve: {
                     customer: function () {
                         return customer;
+                    },
+                    thisUser: function () {
+                        return $scope.thisUser
                     }
                 }
             });
@@ -90,6 +93,9 @@ define(['app/app'], function(app) {
                 resolve: {
                     customer: function () {
                         return customer;
+                    },
+                    thisUser: function () {
+                        return $scope.thisUser
                     }
                 }
             });
@@ -107,43 +113,71 @@ 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.findSaleUsers({id : customer.id}, {}, 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.findSaleUsers(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) {
@@ -198,7 +232,7 @@ define(['app/app'], function(app) {
         $scope.close = function (save) {
             var chooseResult = [];
             if (save) {
-                if (customer.vendorEnterprise.uu) {
+                if (customer.id) {
                     // 当前用户是管理员时
                     angular.forEach($scope.userinfos, function (item, i) {
                         chooseResult.push(item);
@@ -227,29 +261,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;
-                $scope.checkboxes = {
-                    checked: false
-                };
-                $scope.loading = true;
-                $scope.distribute = [];
-                AccountUser.findSaleUsers({id : customer.id}, null, function (data) {
-                    $scope.userinfos = data;
-                    var distribute = [];
-                    angular.forEach($scope.userinfos, function (user, index) {
-                        if (user.distribute) {
-                            distribute.push({num: index});
+    app.register.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'B2bAccountUser', 'toaster', 'ngTableParams', 'BaseService', 'thisUser',
+        function ($scope, $modalInstance, customer, AccountUser, toaster, ngTableParams, BaseService, thisUser) {
+            $scope.thisUser = thisUser
+            $scope.checkboxes = {
+                checked: false
+            };
+            $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.findSaleUsers(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) {

+ 110 - 56
src/main/webapp/resources/js/vendor/controllers/b2b/sale/saleCustomerCtrl.js

@@ -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);

+ 6 - 16
src/main/webapp/resources/view/vendor/b2b/modal/add_userInfo.html

@@ -3,20 +3,10 @@
 		width: 492px;
 	}
 	#user-lists{
-		max-height: 600px;
+		max-height: 510px;
 		overflow-x: hidden;
 		overflow-y: scroll;
 	}
-	@media screen and (max-width: 1366px){
-		#user-lists{
-			max-height: 368px;
-		}
-	}
-	@media screen and (max-width: 1600px){
-		#user-lists{
-			max-height: 400px;
-		}
-	}
 </style>
 <div class="b2b-com-modal b2b-operate-modal">
 	<p class="title">
@@ -24,14 +14,14 @@
 	</p>
 	<div class="form-group" id="window-search" style="height: 36px; margin-bottom: 0; margin-top: 16px;padding-bottom: 45px;border-bottom: 1px solid #e3e3e3;">
 		<div class="col-sm-12">
-			<input type="text" class="form-control input-sm" required="" placeholder="输入用户名关键词搜索" autofocus="" ng-model="keyword" ng-search="onSearch(keyword)" />
+			<input type="text" class="form-control input-sm" required="" placeholder="输入用户电话和用户名关键词搜索" ng-model="keyword" ng-search="onSearch(keyword)" />
 			<a class="btn input-group-addon" ng-click="onSearch()">搜索</a>
 		</div>
 	</div>
 	<div class="modal-body" id="user-lists">
-		<table class="table b2b-modal-table">
+		<table class="table b2b-modal-table" ng-table="userParams">
 			<thead>
-			<th width="80px;">用户UU</th>
+			<th width="80px;">用户电话</th>
 			<th width="100px;">用户名称</th>
 			<th width="40px;" style="text-align: center">
 				<label class="com-check-box">
@@ -43,8 +33,8 @@
 			</thead>
 			<tbody>
 			<div style="overflow-y:scroll; width:100%;max-height:500px">
-				<tr ng-repeat="user in userinfos| filter: keyword track by $index">
-					<td width="80px;">{{user.userUU}}</td>
+				<tr ng-repeat="user in userinfos track by $index">
+					<td width="80px;">{{user.userTel}}</td>
 					<td width="100px;">{{user.userName}}</td>
 					<td width="40px;" style="text-align: center">
 						<label class="com-check-box">

+ 10 - 20
src/main/webapp/resources/view/vendor/b2b/modal/transfer_userInfo.html

@@ -3,20 +3,10 @@
 		width: 492px;
 	}
 	#user-lists{
-		max-height: 600px;
+		max-height: 510px;
 		overflow-x: hidden;
 		overflow-y: scroll;
 	}
-	@media screen and (max-width: 1366px){
-		#user-lists{
-			max-height: 368px;
-		}
-	}
-	@media screen and (max-width: 1600px){
-		#user-lists{
-			max-height: 400px;
-		}
-	}
 </style>
 <div class="b2b-com-modal b2b-operate-modal">
 	<p class="title">
@@ -24,21 +14,21 @@
 	</p>
 	<div class="form-group" id="window-search" style="height: 36px; margin-bottom: 0; margin-top: 16px;padding-bottom: 45px;border-bottom: 1px solid #e3e3e3;">
 		<div class="col-sm-12">
-			<input type="text" class="form-control input-sm" required="" placeholder="输入用户名关键词搜索" autofocus="" ng-model="keyword" ng-search="onSearch(keyword)" />
+			<input type="text" class="form-control input-sm" required="" placeholder="输入用户电话和用户名关键词搜索" ng-model="keyword" ng-search="onSearch(keyword)" />
 			<a class="btn input-group-addon" ng-click="onSearch()">搜索</a>
 		</div>
 	</div>
 	<div class="modal-body" id="user-lists">
-		<table class="table b2b-modal-table">
+		<table class="table b2b-modal-table" ng-table="userParams">
 			<thead>
-			<th width="80px;">用户UU</th>
+			<th width="80px;">用户电话</th>
 			<th width="100px;">用户名称</th>
 			<th width="40px;"></th>
 			</thead>
 			<tbody ng-if="thisUser.sys">
 			<!-- 当前用户是管理员时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword track by $index" style="overflow-y:scroll; width:100%;max-height:500px">
-				<td width="80px;">{{user.userUU}}</td>
+			<tr ng-repeat="user in userinfos track by $index" style="overflow-y:scroll; width:100%;max-height:500px">
+				<td width="80px;">{{user.userTel}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center">
 					<label class="com-check-box">
@@ -50,8 +40,8 @@
 			</tbody>
 			<tbody ng-if="!thisUser.sys && thisUser.transfer">
 			<!-- 当前用户是被管理员转移权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword track by $index">
-				<td width="80px;">{{user.userUU}}</td>
+			<tr ng-repeat="user in userinfos track by $index">
+				<td width="80px;">{{user.userTel}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center">
 					<label class="com-check-box">
@@ -63,8 +53,8 @@
 			</tbody>
 			<tbody ng-if="!thisUser.sys && !thisUser.transfer">
 			<!-- 当前用户是非管理员,但有查看权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword track by $index" ng-if="!user.distribute">
-				<td width="80px;">{{user.userUU}}</td>
+			<tr ng-repeat="user in userinfos track by $index" ng-if="!user.distribute">
+				<td width="80px;">{{user.userTel}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center">
 					<label class="com-check-box">