Browse Source

fix:客户权限转移和分配问题处理

dongbw 7 years ago
parent
commit
9ccc664a11

+ 25 - 33
src/main/webapp/resources/js/vendor/controllers/b2b/sale/saleCustomerCtrl.js

@@ -54,10 +54,6 @@ define(['app/app'], function (app) {
 
         // 分配用户
         $scope.addUserInfo = function (customer) {
-            if (!$scope.enabled) {
-                toaster.pop('error', '您没有为当前客户分配用户的权限!');
-                return;
-            }
             // 获取当前用户在当前企业是否被转移权限
             AccountUser.getEnTransfer ({custUU: customer.myEnterprise.uu}, function(data) {
                 customer.enTransfer = data.result;
@@ -80,6 +76,7 @@ define(['app/app'], function (app) {
                             else
                                 loadUsers();
                         }
+                        $scope.customerParams.reload();
                     });
 
                 } else {
@@ -91,10 +88,6 @@ define(['app/app'], function (app) {
         // 转移权限
         $scope.transferUserInfo = function (customer) {
             customer.enDistribute = null;
-            if (!$scope.enabled) {
-                toaster.pop('error', '您没有转移当前客户权限的权限!');
-                return;
-            }
             // 获取当前用户在当前企业是否被转移权限
             AccountUser.getDistribute ({custUU: customer.myEnterprise.uu}, function(data) {
                 customer.enDistribute = data.result;
@@ -117,6 +110,7 @@ define(['app/app'], function (app) {
                             else
                                 loadUsers();
                         }
+                        $scope.customerParams.reload();
                     });
 
                 } else {
@@ -234,14 +228,8 @@ define(['app/app'], function (app) {
         var checkStatus = function (userinfos) {
             var transfer = [];
             angular.forEach(userinfos, function (user, index) {
-                if ($scope.thisUser.sys || $scope.thisUser.transfer) {
-                    if (user.transfer) {
-                        transfer.push({num: index});
-                    }
-                } else {
-                    if (user.transfer) {
-                        transfer.push({num: index});
-                    }
+                if (user.transfer) {
+                    transfer.push({num: index});
                 }
             });
             $scope.transfer = transfer;
@@ -342,24 +330,28 @@ define(['app/app'], function (app) {
         };
 
     }]);
-    app.register.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'B2bAccountUser', 'toaster', function ($scope, $modalInstance, customer, AccountUser, toaster) {
-        $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});
-                }
+    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.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.distribute = distribute;
+                $scope.havedone = angular.copy($scope.distribute);
+                $scope.loading = false;
             });
-            $scope.distribute = distribute;
-            $scope.havedone = angular.copy($scope.distribute);
-            $scope.loading = false;
-        })
+        });
 
         var checkStatus = function (userinfos) {
             var distribute = [];

+ 0 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_offer_ctrl.js

@@ -53,7 +53,6 @@ define(['app/app'], function(app) {
 
       seekPurchase.getSeekUrl({}, function(data) {
         var seekUrl = data.url;
-        //   var seekUrl = 'http://10.1.51.82:24002';
         // 获取我的报价列表
         $scope.seekPurchaseTableParams = new ngTableParams({
           pageNumber: 1,

+ 0 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -51,7 +51,6 @@ define(['app/app'], function (app) {
 
           seekPurchase.getSeekUrl({}, function(data) {
             var seekUrl = data.url;
-            // var seekUrl = 'http://10.1.51.82:24002';
           var initInquiryItem = function () {
             $scope.validSayPrice = {
               leadtime: false,

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

@@ -43,7 +43,7 @@
 			</thead>
 			<tbody>
 			<div style="overflow-y:scroll; width:100%;max-height:500px">
-				<tr ng-repeat="user in userinfos| filter: keyword track by $index">
+				<tr ng-repeat="user in userinfos| filter: keyword track by $index" ng-if = "thisUser.userUU != user.userUU">
 					<td width="80px;">{{user.userUU}}</td>
 					<td width="100px;">{{user.userName}}</td>
 					<td width="40px;" style="text-align: center">

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

@@ -37,7 +37,7 @@
 			</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" ng-if="!user.sys">
+			<tr ng-repeat="user in userinfos| filter: keyword track by $index" style="overflow-y:scroll; width:100%;max-height:500px" ng-if="!user.sys && thisUser.userUU != user.userUU">
 				<td width="80px;">{{user.userUU}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center">
@@ -50,7 +50,7 @@
 			</tbody>
 			<tbody ng-if="!thisUser.sys && thisUser.transfer">
 			<!-- 当前用户是被管理员转移权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword track by $index" ng-if="!user.sys">
+			<tr ng-repeat="user in userinfos| filter: keyword track by $index" ng-if="!user.sys && thisUser.userUU != user.userUU">
 				<td width="80px;">{{user.userUU}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center">
@@ -63,12 +63,12 @@
 			</tbody>
 			<tbody ng-if="!thisUser.sys && !thisUser.transfer">
 			<!-- 当前用户是非管理员,但有查看权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword track by $index" ng-if="!user.distribute && !user.sys">
+			<tr ng-repeat="user in userinfos| filter: keyword track by $index" ng-if="!user.distribute && !user.sys && thisUser.userUU != user.userUU">
 				<td width="80px;">{{user.userUU}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center">
 					<label class="com-check-box">
-						<input id="{{'user2' + $index}}" name="distribute" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择">
+						<input id="{{'user2' + $index}}" name="distribute" ng-model="user.transfer" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择">
 						<label for="{{'user2' + $index}}"></label>
 					</label>
 				</td>