소스 검색

客户分配筛选问题的处理

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@10130 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 년 전
부모
커밋
d8e90f7d1e
1개의 변경된 파일15개의 추가작업 그리고 21개의 파일을 삭제
  1. 15 21
      src/main/webapp/resources/js/index/app.js

+ 15 - 21
src/main/webapp/resources/js/index/app.js

@@ -2060,7 +2060,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			var distribute = [];
 			angular.forEach($scope.userinfos, function(user, index) {
 				if(user.distribute) {
-					distribute.push(index);
+					distribute.push({num: index});
 				}
 			});
 			$scope.distribute = distribute;
@@ -2068,36 +2068,29 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			$scope.loading = false;
 		})
 		
+		var checkStatus = function(userinfos) {
+        	var distribute = [];
+			angular.forEach(userinfos, function(user, index) {
+				if(user.distribute) {
+					distribute.push({num: index});
+				}
+			});
+			$scope.distribute = distribute;
+			$scope.isChanged = !angular.equals($scope.havedone, $scope.distribute);
+        }
 		$scope.isChanged = false;
         $scope.isChangedAll = false;
 		$scope.changes = [];
 		// 点击勾选全部的复选框
-		$scope.checkAll = function(isChanged) {
+		$scope.checkAll = function() {
 			angular.forEach($scope.userinfos, function(item, index) {
 				item.distribute = $scope.checkboxes.checked;
 			});
-//			$scope.isChanged = true;
+			checkStatus($scope.userinfos);
 		};
 		
-		$scope.isChanged = function() {
-        	return angular.equals($scope.distribute, $scope.changes);
-        }
 		// 点击其中一个明细的复选框
-		$scope.checkOne = function(vendor, isChanged, index){
-			if(isChanged) {
-				angular.forEach($scope.changes, function(item, value) {
-					if(item.num == index) {
-						$scope.changes.splice(value, 1);
-					}
-				}) ;
-			} else {
-				$scope.changes.push({num: index});
-			}
-			if($scope.changes.length != 0) {
-				$scope.isChanged = true;
-			} else {
-				$scope.isChanged = false;
-			}
+		$scope.checkOne = function() {
 			var result = true;
 			angular.forEach($scope.userinfos, function(item) {
 				if(item.distribute != true){
@@ -2106,6 +2099,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				}
 			});
 			$scope.checkboxes.checked = result;
+			checkStatus($scope.userinfos);
 		};
 		$scope.close = function(save) {
 			var chooseResult = [];