Browse Source

信息修改权限控制

yangc 7 years ago
parent
commit
ee9843373c

+ 11 - 5
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -4,7 +4,7 @@
  */
 define(['app/app'], function (app) {
     "use strict";
-    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal', 'BaseService', 'ngTableParams', '$http', 'AuthenticationService', '$stateParams','AccountResource','AccountRole', function ($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService, $stateParams, AccountResource, AccountRole) {
+    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal', 'BaseService', 'ngTableParams', '$http', 'AuthenticationService', '$stateParams','AccountResource','AccountRole', 'Authority', function ($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService, $stateParams, AccountResource, AccountRole, Authority) {
         $rootScope.active = 'vendor_account_management';
         document.title = '账户管理-优软商城';
         $scope.tab = 'base';
@@ -410,10 +410,16 @@ define(['app/app'], function (app) {
             //     toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
             //     return;
             // }
-            $scope.updateState = isUpdate;
-            if ($scope.updateState == false) {
-                $scope.enterpriseInfo = angular.copy($scope.enterpriseInfoBackup);
-            }
+            Authority.getAuthority({resUrl: '/basic/enterprise/*/updateInfo'}, function (data) {
+                if (data.status == 'fail') {
+                    toaster.pop('error', data.msg || '系统错误');
+                } else {
+                    $scope.updateState = isUpdate;
+                    if ($scope.updateState == false) {
+                        $scope.enterpriseInfo = angular.copy($scope.enterpriseInfoBackup);
+                    }
+                }
+            });
         };
 
           /**

+ 29 - 17
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_store_maintain_ctrl.js

@@ -1,6 +1,6 @@
 define(['app/app'], function (app) {
 	"use strict";
-	app.register.controller('vendorStoreMaintainCtrl', ['$scope', '$rootScope', 'Enterprise', 'StoreInfo', '$modal', 'toaster', '$timeout', '$state', 'RecommendProductService', function($scope, $rootScope, Enterprise, StoreInfo, $modal, toaster, $timeout, $state, RecommendProductService) {
+	app.register.controller('vendorStoreMaintainCtrl', ['$scope', '$rootScope', 'Enterprise', 'StoreInfo', '$modal', 'toaster', '$timeout', '$state', 'RecommendProductService', 'Authority', function($scope, $rootScope, Enterprise, StoreInfo, $modal, toaster, $timeout, $state, RecommendProductService, Authority) {
 		$rootScope.active = "vendor_store";
 		document.title = '我的店铺-优软商城';
 		// 编辑状态
@@ -145,7 +145,13 @@ define(['app/app'], function (app) {
 			// 	toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
 			// 	return;
 			// }
-			changeEditStatus(module, true);
+			Authority.getAuthority({resUrl: '/store-service/stores/*'}, function (data) {
+				if (data.status == 'fail') {
+					toaster.pop('error', data.msg || '系统错误');
+				} else {
+					changeEditStatus(module, true);
+				}
+			});
 		};
 
 		/**
@@ -549,22 +555,28 @@ define(['app/app'], function (app) {
 			// 	toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
 			// 	return;
 			// }
-			if (module == 'BATCH_OPERATION') {
-				$scope.canBatchOperation = status;
-				return ;
-			}
-			if (module == 'EDIT_PRODUCTS') {
-				$scope.canEditProduct = status;
-
-				// 扩充products
-				console.log(10 - $scope.recommendProducts.length);
-				for (var i = $scope.recommendProducts.length; i < 10; i++) {
-					$scope.recommendProducts[i] = { exist: false, order: i + 1 };
+			Authority.getAuthority({resUrl: '/store-service/stores/*'}, function (data) {
+				if (data.status == 'fail') {
+					toaster.pop('error', data.msg || '系统错误');
+				} else {
+					if (module == 'BATCH_OPERATION') {
+						$scope.canBatchOperation = status;
+						return ;
+					}
+					if (module == 'EDIT_PRODUCTS') {
+						$scope.canEditProduct = status;
+
+						// 扩充products
+						console.log(10 - $scope.recommendProducts.length);
+						for (var i = $scope.recommendProducts.length; i < 10; i++) {
+							$scope.recommendProducts[i] = { exist: false, order: i + 1 };
+						}
+						console.log($scope.recommendProducts.length);
+						return ;
+					}
+					return false;
 				}
-				console.log($scope.recommendProducts.length);
-				return ;
-			}
-			return false;
+			});
 		}
 
 		function cancleProductEdit(module) {