Browse Source

新增物料,新增询价保存后跳转到详情页

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

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

@@ -2225,8 +2225,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		}
 	};
 
-    app.controller('PurcOrderCtrl', ['$scope', '$filter', 'PurcOrderItem', 'PurcOrder', 'ngTableParams', 'toaster', 'ReportService', 'BaseService', '$rootScope',
-        function($scope, $filter, PurcOrderItem, PurcOrder, ngTableParams, toaster, ReportService, BaseService, $rootScope){
+    app.controller('PurcOrderCtrl', ['$scope', '$filter', 'PurcOrderItem', 'PurcOrder', 'ngTableParams', 'toaster', 'ReportService', 'BaseService', '$rootScope', 'PurchaseOrder',
+        function($scope, $filter, PurcOrderItem, PurcOrder, ngTableParams, toaster, ReportService, BaseService, $rootScope, PurchaseOrder){
 		    BaseService.scrollBackToTop();
             if ($rootScope.active) {
                 $scope.active = $rootScope.active;
@@ -2399,6 +2399,19 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
   			$scope.tableParams.page(1);
   			$scope.tableParams.reload();
   		};
+  		
+  		// 复制订单
+  		$scope.copyorder = function(id) {
+  			console.log(id);
+  			PurchaseOrder.copyorder({id: id}, {}, function(data) {
+  				console.log(data);
+  				if(data.id) {
+  					window.location.hash = "#purc/cart/" + data.id;
+  				}
+  			}, function(response) {
+  				toaster.pop('error', '提示', response.data);
+  			});
+  		}
   	}]);
 	
 	app.controller('PurcOrderDetailCtrl', ['$scope', '$stateParams', 'PurcOrder', 'PurcOrderItem', 'toaster', 'ReportService', function($scope, $stateParams, PurcOrder, PurcOrderItem, toaster, ReportService){
@@ -5197,8 +5210,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				if($stateParams.id)
 					window.location.reload();
 				else 
-//					window.location.hash = '#/sale/quotation/' + data.id;
-					window.location.hash = '#/sale/quotation/list';
+					window.location.hash = '#/sale/quotation/' + data.id;
+//					window.location.hash = '#/sale/quotation/list';
 			}, function(response){
 				$scope.loading = false;
 				toaster.pop('error', '保存失败', response.data);
@@ -11074,16 +11087,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 					toaster.pop('success', '提示', '产品添加成功');
 					$timeout(function() {
 						//提交后跳转到详情页面,防止重复提交
-//						window.location.href="#/sale/prodList/"+data.id;
-						window.location.href="#/sale/prodList";
+						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";
+						window.location.href="#/sale/prodList/"+data.id;
+//						window.location.href="#/sale/prodList";
 					}, 500);
 				}
 				
@@ -12964,9 +12977,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			cartOperation.deleteCartDetail({id: id}, {}, function(data) {
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
-					$timeout(function() {
-						window.location.reload();
-					},500);
+					loadData();
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);
@@ -18020,16 +18031,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="#/purc/product";
+						window.location.href="#/purc/prodList/"+data.id;
+//						window.location.href="#/purc/product";
 					}, 500);
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);
 					$timeout(function() {
 						//提交后跳转到详情页面,防止重复提交
-//						window.location.href="#/sale/prodList/"+data.id;
-						window.location.href="#/purc/product";
+						window.location.href="#/purc/prodList/"+data.id;
+//						window.location.href="#/purc/product";
 					}, 500);
 				}