Browse Source

修复测试提出的部分问题

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@729 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 11 years ago
parent
commit
444f425833
1 changed files with 51 additions and 0 deletions
  1. 51 0
      src/main/webapp/resources/js/index/app.js

+ 51 - 0
src/main/webapp/resources/js/index/app.js

@@ -559,6 +559,57 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				});
 			}
 		};
+		
+		$scope.checkboxes = {
+			checked : false
+		};
+
+		// 点击勾选全部的复选框
+		$scope.checkAll = function(){
+			angular.forEach($scope.tableParams.data, function(item) {
+				item.$selected = $scope.checkboxes.checked;
+			});
+		};
+		
+		// 点击其中一个明细的复选框
+		$scope.checkOne = function(order){
+			var result = true;
+			angular.forEach($scope.tableParams.data, function(item) {
+				if(item.$selected != true){
+					result = false;
+					return;
+				}
+			});
+			$scope.checkboxes.checked = result;
+		};
+		
+		//批量回复采购订单
+		$scope.replyByBatch = function() {
+			$scope.loading = true;
+			var str = '';
+			angular.forEach($scope.tableParams.data, function(order) {
+				if(order.$selected == true) {
+					angular.forEach(order.orderItems, function(item){
+						str += item.id;
+						str += ',';
+					});
+				}
+			});
+			if(!(str == '')) {
+				str = str.substr(0, str.length-1);
+				PurcOrderItem.replyByBatch(str, function(){
+					$scope.loading = false;
+					$scope.tableParams.reload();
+					toaster.pop('success', '提示', '批量回复成功');
+				}, function(data){
+					$scope.loading = false;
+					toaster.pop('error', '批量回复失败', data);
+				});
+			} else {//没有勾选其中的明细
+				$scope.loading = false;
+			}
+			
+		};
 	});
 	app.controller('SaleChangeCtrl', function($scope, $rootScope, $filter, PurcChange, ngTableParams, toaster, BaseService, PurcChangeHis){
 		$rootScope.active = 'change';