Browse Source

物料保存后跳转到列表页

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9682 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 years ago
parent
commit
cfa94c706d
1 changed files with 36 additions and 31 deletions
  1. 36 31
      src/main/webapp/resources/js/index/app.js

+ 36 - 31
src/main/webapp/resources/js/index/app.js

@@ -10970,7 +10970,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
                     $rootScope.isProductEdit = false;
-					loadData();
+//					loadData();
+                    window.location.href="#/sale/prodList";
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);
@@ -11121,36 +11122,37 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		}
 		//提交
 		$scope.submit = function(prodInfo){
-			console.log(prodInfo);
 			$scope.prodInfo.isSale = 1;
-//			var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
-//			$upload.upload({
-//				url: 'product/baseInfo/addNewProduct',
-//				file: file,
-//				method: 'POST',
-//				data: {
-//					prodInfo: prodInfo
-//				},
-//			}).success(function(data) {
-//				if(data.success) {
-//					toaster.pop('success', '提示', data.success);
-//					$timeout(function() {
-//						//提交后跳转到详情页面,防止重复提交
+			var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
+			$upload.upload({
+				url: 'product/baseInfo/addNewProduct',
+				file: file,
+				method: 'POST',
+				data: {
+					prodInfo: prodInfo
+				},
+			}).success(function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+					$timeout(function() {
+						//提交后跳转到详情页面,防止重复提交
 //						window.location.href="#/sale/prodList/"+data.id;
-//					}, 500);
-//				}
-//				if(data.error) {
-//					toaster.pop('error', '提示', data.error);
-//					$timeout(function() {
-//						//提交后跳转到详情页面,防止重复提交
+						window.location.href="#/sale/prodList";
+					}, 500);
+				}
+				if(data.error) {
+					toaster.pop('error', '提示', data.error);
+					$timeout(function() {
+						//提交后跳转到详情页面,防止重复提交
 //						window.location.href="#/sale/prodList/"+data.id;
-//					}, 500);
-//				}
-//				
-//			}).error(function(data) {
-//				$scope.loadingShow = false;
-//				toaster.pop('error', '操作失败', data.error);
-//			});
+						window.location.href="#/sale/prodList";
+					}, 500);
+				}
+				
+			}).error(function(data) {
+				$scope.loadingShow = false;
+				toaster.pop('error', '操作失败', data.error);
+			});
 		};
 		
 		$scope.previewShow = false;
@@ -17951,14 +17953,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 					toaster.pop('success', '提示', data.success);
 					$timeout(function() {
 						//提交后跳转到详情页面,防止重复提交
-						window.location.href="#/sale/prodList/"+data.id;
+//						window.location.href="#/sale/prodList/"+data.id;
+						window.location.href="#/sale/prodList";
 					}, 500);
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);
 					$timeout(function() {
 						//提交后跳转到详情页面,防止重复提交
-						window.location.href="#/sale/prodList/"+data.id;
+//						window.location.href="#/sale/prodList/"+data.id;
+						window.location.href="#/sale/prodList";
 					}, 500);
 				}
 				
@@ -18153,7 +18157,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			}).success(function(data) {
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
-					loadData();
+//					loadData();
+					window.location.href="#/sale/prodList";
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);