Browse Source

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1047 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 11 years ago
parent
commit
5b6f29f1ec
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/main/webapp/resources/js/index/app.js

+ 10 - 2
src/main/webapp/resources/js/index/app.js

@@ -38,6 +38,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			},
 			controller: function($scope) {
 				$scope.truck = [];
+				$scope.dataChanged = false;
 			}
 		}).state('sale.index', {
 			url : "",
@@ -260,7 +261,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		});
 	});
 	app.controller('TruckCtrl', function($scope, $rootScope, $modal, SaleTruck){
-		
 		SaleTruck.query({}, function(data){
 			$rootScope.truck = data;
 			$scope.truckCount = data ? data.length : 0;
@@ -281,7 +281,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				controller: 'TruckModalCtrl',
 				size: 'lg'
 			}).result.then(function(s){
-				s && ($scope.clearAll());
+				if(s) {
+					$scope.clearAll();
+					$rootScope.dataChanged = true;
+				}
 			});
 		};
 	});
@@ -1296,6 +1299,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		}, function(data) {
 			truck =  $rootScope.truck;
 		}, true);
+		$scope.$watch(function(){
+			return $rootScope.dataChanged;
+		}, function(data) {
+			data &&	($scope.tableParams.reload());
+		}, true);
 	});
 	app.controller('SaleNoticeSendByBatchCtrl', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster){
 		$scope.notices = angular.copy(selectedNotices);