Prechádzať zdrojové kódy

增加按物料。商品过滤,增加翻页自动选择或清除功能

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9212 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 rokov pred
rodič
commit
e43f959dc0
1 zmenil súbory, kde vykonal 23 pridanie a 4 odobranie
  1. 23 4
      src/main/webapp/resources/js/index/app.js

+ 23 - 4
src/main/webapp/resources/js/index/app.js

@@ -1159,6 +1159,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			InvitationRecord.reInvite({id: id}, {}, function(data) {
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
+					$scope.tableParams.page(1);
+		  			$scope.tableParams.reload();
 				}
 			}, function(response) {
 				toaster.pop('error', '提示', response.data);
@@ -1213,6 +1215,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			InvitationRecord.reInvite({id: id}, {}, function(data) {
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
+					$scope.tableParams.page(1);
+		  			$scope.tableParams.reload();
 				}
 			}, function(response) {
 				toaster.pop('error', '提示', response.data);
@@ -10077,6 +10081,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			Products.matchall({}, function(data) {
 				toaster.pop('info', '提示', '匹配成功'+data.size+'标准器件');
 				window.location.href = "#/sale/productmatches";
+				$rootScope.productMatchStatus = "sale";
 			}, function(response) {
 				toaster.pop('error', '提示', response.data);
 			});
@@ -15686,7 +15691,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 	}]);
 	
 	// 当前企业匹配的标准物料信息
-	app.controller('ProductmatchesCtrl', ['$scope', 'ProductAll', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', function($scope, ProductAll, ngTableParams, $filter, BaseService, toaster, $timeout, Products) {
+	app.controller('ProductmatchesCtrl', ['$scope', 'ProductAll', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$rootScope', 'PurcProduct', 'GetProductInfo', function($scope, ProductAll, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $rootScope, PurcProduct, GetProductInfo) {
 		BaseService.scrollBackToTop();
 		$scope.active = 'all';
 		$scope.agreedText = '全部';
@@ -15715,7 +15720,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			}
 		};
 		var getService = function() {
-			return Products.matchResult;
+			if($rootScope.productMatchStatus === 'sale') {
+				return GetProductInfo;
+			} else if($rootScope.productMatchStatus === 'purc') {
+				return PurcProduct;
+			} else {
+				return Products.matchResult;
+			}
 		};
 		
 		$scope.tableParams = new ngTableParams({
@@ -15734,10 +15745,17 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				getService().call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
 					if(page) {
+						console.log(page);
 						params.total(page.totalElement);
 						$defer.resolve(page.content);
 						$scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
 						$scope.searchFilterXls = angular.copy(pageParams.searchFilter);
+						angular.forEach(page.content, function(product) { // 每次进入判断全选状态,然后给单据赋状态
+							ids = [];
+							if(product.matchresults.length == 1) {
+								product.checked = $scope.checks.checked;
+							}
+						});
 					}
 				}, function(response) {
 					$scope.loading = false;
@@ -15843,7 +15861,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 						});
 					}
 				} 
-        	})
+        	});
         	if(ids.length == 0) {
 				toaster.pop('info', '提示', '请先选择标准器件');
 			} else {
@@ -15864,7 +15882,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 	/**
 	 * 采购物料资料
 	 */
-	app.controller('PurcProductCtrl', ['$scope', 'PurcProduct', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$modal', 'GetProductInfo', function($scope, PurcProduct, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $modal, GetProductInfo) {
+	app.controller('PurcProductCtrl', ['$scope', 'PurcProduct', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$modal', 'GetProductInfo', '$rootScope', function($scope, PurcProduct, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $modal, GetProductInfo, $rootScope) {
 		BaseService.scrollBackToTop();
 		$scope.active = 'all';
 		$scope.agreedText = '全部';
@@ -16023,6 +16041,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			Products.matchall({}, function(data) {
 				toaster.pop('info', '提示', '匹配成功'+data.size+'标准器件');
 				window.location.href = "#/purc/productmatches";
+				$rootScope.productMatchStatus = 'purc';
 			}, function(response) {
 				toaster.pop('error', '提示', response.data);
 			});