Browse Source

指定询价未选择供应商时给出提示

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

+ 22 - 18
src/main/webapp/resources/js/index/app.js

@@ -2932,7 +2932,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         
         
         // 保存
         // 保存
         $scope.save = function() {
         $scope.save = function() {
-        	console.log($scope.inquiry);
 //        	var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
 //        	var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
 //    		$upload.upload({
 //    		$upload.upload({
 //    			url: 'product/baseInfo/updateProdInfo',
 //    			url: 'product/baseInfo/updateProdInfo',
@@ -2953,20 +2952,24 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 //    			$scope.loadingShow = false;
 //    			$scope.loadingShow = false;
 //    			toaster.pop('error', '操作失败', data.error);
 //    			toaster.pop('error', '操作失败', data.error);
 //    		});    
 //    		});    
-        	if( $scope.vendors.length > 0) { // 指定询价
-        		PurchaseInquiry.save({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
-        			if(data.success) {
-        				toaster.pop('success', '提示', data.success);
-        				$timeout(function() {
-        					window.location.hash = "#/purc/inquiry_unapply";
-        				}, 500);
-        			}
-        			if(data.error) {
-        				toaster.pop('error', '提示', data.error);
-        			}
-        		}, function(response) {
-        			toaster.pop('error', '提示', response.data);
-        		});
+        	if( $scope.inquiry.isOpen == 0) { // 指定询价
+        		if( $scope.vendors.length > 0) { 
+            		PurchaseInquiry.save({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
+            			if(data.success) {
+            				toaster.pop('success', '提示', data.success);
+            				$timeout(function() {
+            					window.location.hash = "#/purc/inquiry_unapply";
+            				}, 500);
+            			}
+            			if(data.error) {
+            				toaster.pop('error', '提示', data.error);
+            			}
+            		}, function(response) {
+            			toaster.pop('error', '提示', response.data);
+            		});
+            	} else {
+            		toaster.pop('info', '提示', '请先选择供应商');
+            	}
         	} else {
         	} else {
         		PurchaseInquiry.saveWithoutVendor({inquiry: $scope.inquiry}, {}, function(data) {
         		PurchaseInquiry.saveWithoutVendor({inquiry: $scope.inquiry}, {}, function(data) {
         			if(data.success) {
         			if(data.success) {
@@ -2986,7 +2989,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         
         
         // 保存并提交
         // 保存并提交
         $scope.submit = function() {
         $scope.submit = function() {
-        	if( $scope.isOpen == 0) { // 指定询价
+        	if( $scope.inquiry.isOpen == 0) { // 指定询价
         		if($scope.vendors.length > 0) {
         		if($scope.vendors.length > 0) {
         			PurchaseInquiry.submit({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
         			PurchaseInquiry.submit({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
             			if(data.success) {
             			if(data.success) {
@@ -3001,8 +3004,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             		}, function(response) {
             		}, function(response) {
             			toaster.pop('error', '提示', response.data);
             			toaster.pop('error', '提示', response.data);
             		});
             		});
-        			
-        		}
+        		} else {
+            		toaster.pop('info', '提示', '请先选择供应商');
+            	}
         	} else {
         	} else {
         		PurchaseInquiry.saveAndSubmitWithoutVendor({inquiry: $scope.inquiry}, {}, function(data) {
         		PurchaseInquiry.saveAndSubmitWithoutVendor({inquiry: $scope.inquiry}, {}, function(data) {
         			if(data.success) {
         			if(data.success) {