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