Эх сурвалжийг харах

一键匹配,单个更新方法更新

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9188 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 жил өмнө
parent
commit
449e076bff

+ 35 - 16
src/main/webapp/resources/js/index/app.js

@@ -1145,6 +1145,17 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			}).result.then(function(data){
 			});			
 		}
+		
+		// 再次邀请
+		$scope.reInvite = function(id) {
+			InvitationRecord.reInvite({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
 	}]);
 	
 	/**
@@ -15729,6 +15740,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         // 单选
         $scope.checkOne = function(product) {
         	ids = [];// 每次选择时先清空,防止重复
+        	product.checked = !product.checked;
     		var result = true;
     		angular.forEach($scope.tableParams.data, function(item) {
     			if(item.$selected != true){
@@ -15744,7 +15756,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                  }
              });
              $scope.checks.checked = checked;
-             
         };
         
         $scope.product = {
@@ -15784,7 +15795,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         $scope.checkItem = function(result) { 
         	ids = [];
         	result.checked = !result.checked;
-        	console.log(result.checked);
         	checkResults(result);
         }
         
@@ -15792,21 +15802,30 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		$scope.updateAll = function() {
 			angular.forEach($scope.tableParams.data, function(product) {
 				if(product.checked) {
-					angular.forEach(product.matchresults, function(item) {
-						if(item.checked) {
-							ids.push(item.id);
-						}
-					});
-					Products.updateall( {}, ids, function(data) {
-						if(data.success) {
-							toaster.pop('success', '提示', data.success);
-						}
-						ids = []; // 清空ids,防止重复点击出现多余的数据
-					}, function(response) {
-						toaster.pop('error', '提示', response.data);
-					});
-				}
+					if(product.matchresults.length == 1) {
+						ids.push(product.matchresults[0].id);
+					} 
+					if (product.matchresults.length > 1) {
+						angular.forEach(product.matchresults, function(item) {
+							if(item.checked) {
+								ids.push(item.id);
+							}
+						});
+					}
+				} 
         	})
+        	if(ids.length == 0) {
+				toaster.pop('info', '提示', '请先选择标准器件');
+			} else {
+				Products.updateall( {}, ids, function(data) {
+					if(data.success) {
+						toaster.pop('success', '提示', data.success);
+					}
+					ids = []; // 清空ids,防止重复点击出现多余的数据
+				}, function(response) {
+					toaster.pop('error', '提示', response.data);
+				});
+			}
 		}
 	}]);