Browse Source

供应商下载销售订单附件是给出判断和提示

hejq 7 years ago
parent
commit
2bc2453d2b
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/main/webapp/resources/js/index/app.js

+ 11 - 1
src/main/webapp/resources/js/index/app.js

@@ -3459,12 +3459,16 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.isUser = data.isUser;
         });
 
+        var existFile = false;
         var loadData = function () {
             PurcOrder.get({id: $stateParams.id}, function (data) {
                 $scope.order = data;
                 var sum = 0;
                 angular.forEach($scope.order.orderItems, function (item) {
                     sum += item.qty * item.price;
+                    if (item.attachs.length > 0) {
+                        existFile = true;
+                    }
                 });
                 $scope.order.total = sum;
                 if ($scope.order.display == 1) {//未查看的设为已查看
@@ -3565,10 +3569,16 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             }
         };
 
+        // 下载附件
         $scope.fileDownload = function (id) {
-            window.open("file/batch/" + id);
+            if (!existFile) {
+                toaster.pop('error', '提示', "当前采购单不存在附件信息");
+            } else {
+                window.open("file/batch/" + id);
+            }
         }
     }]);
+
     app.controller('SaleChangeCtrl', ['$scope', '$filter', 'PurcChange', 'PurcChanges', 'ngTableParams', 'toaster', 'BaseService', 'PurcChangeHis', 'CurrentRole', function ($scope, $filter, PurcChange, PurcChanges, ngTableParams, toaster, BaseService, PurcChangeHis, CurrentRole) {
         BaseService.scrollBackToTop();