Browse Source

【客户采购询价】1、分段数量比较前转换为int型。做字符串比较会出现问题;2、上传附件放到报价成功之后,上传完才reload,保证刷新时新做的附件修改会显示。

dongbw 8 years ago
parent
commit
85a681cbac

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

@@ -3653,7 +3653,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if ((i > 0 ? r.lapQty : 1) || r.price) {
                     replies.push(r);
                 }
-                if (i > 0 && r.lapQty <= item.replies[i - 1].lapQty || r.lapQty == null) {
+                // 直接比较是字符串比较,需要先转换再比较  2017年9月7日 15:05:51
+                if (i > 0 && parseInt(r.lapQty) <= parseInt(item.replies[i - 1].lapQty) || r.lapQty == null) {
                     valid = false;
                     validLapQty = r.lapQty;
                 }
@@ -3668,37 +3669,52 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }
                 $scope.loading = false;
             } else {
-                var file = item.myFiles, file = file && file.length > 0 ? file[0] : null;
-                $upload.upload({
-                    url: 'sale/inquiry/addAttach',
-                    file: file,
-                    method: 'POST',
-                    data: {
-                        item: item
-                    }
-                }).success(function (data) {
-                    if (data.item) {
-                        item = data.item;
-                    }
-                });
                 if (withSteps) { // 保存并报价
                     PurcInquiry.reply({itemId: item.id, token: $scope.token}, item, function () {
-                        $scope.loading = false;
-                        toaster.pop('info', '提示', '报价成功');
-                        $timeout(function () {
+                        var file = item.myFiles, file = file && file.length > 0 ? file[0] : null;
+                        $upload.upload({
+                            url: 'sale/inquiry/addAttach',
+                            file: file,
+                            method: 'POST',
+                            data: {
+                                item: item
+                            }
+                        }).success(function (data) {
+                            if (data.item) {
+                                item = data.item;
+                            }
+                            $scope.loading = false;
+                            toaster.pop('info', '提示', '报价成功');
                             $scope.tableParams.reload();
-                        }, 300);
+                        }).error(function (data) {
+                            $scope.loading = false;
+                            toaster.pop('error', '附件上传失败');
+                        });
                     }, function (response) {
                         $scope.loading = false;
                         toaster.pop('error', '询价失效', response.data);
                     });
                 } else {  // 保存
                     PurcInquiry.saveItem({itemId: item.id, token: $scope.token}, item, function () {
-                        $scope.loading = false;
-                        toaster.pop('info', '提示', '保存成功');
-                        $timeout(function () {
+                        var file = item.myFiles, file = file && file.length > 0 ? file[0] : null;
+                        $upload.upload({
+                            url: 'sale/inquiry/addAttach',
+                            file: file,
+                            method: 'POST',
+                            data: {
+                                item: item
+                            }
+                        }).success(function (data) {
+                            if (data.item) {
+                                item = data.item;
+                            }
+                            $scope.loading = false;
+                            toaster.pop('info', '提示', '保存成功');
                             $scope.tableParams.reload();
-                        }, 300);
+                        }).error(function (data) {
+                            $scope.loading = false;
+                            toaster.pop('error', '附件上传失败');
+                        });
                     }, function (response) {
                         $scope.loading = false;
                         toaster.pop('error', '保存失败', response.data);

+ 1 - 1
src/main/webapp/resources/tpl/index/sale/inquiry.html

@@ -396,7 +396,7 @@
 					<div ng-repeat="reply in inquiryItem.replies">
 						<div class="form-group input-group input-group-xs">
 							<input type="text" class="form-control input-xs" ng-class="{'input-error': !replylapQtys[$index]}"  ng-change="verifylapQty(reply.lapQty,$index, inquiryItem)"
-								   ng-model="reply.lapQty" min="{{$index == 0 ? 0 :(inquiryItem.replies[$index - 1].lapQty + 1)}}"
+								   ng-model="reply.lapQty" min="{{$index == 0 ? 0 :(inquiryItem.replies[$index - 1].lapQty + 1)}}" ng-pattern="/^\+?[1-9]\d*$/"
 								   ng-Readonly="$index == 0"  placeholder="数量" />
 								   <span class="input-group-btn" ng-show="$index != 0">
 									<button class="btn btn-default" type="button"