Browse Source

新增/删除物料

yangc 7 years ago
parent
commit
176178a222

+ 11 - 4
src/main/webapp/resources/js/usercenter/controllers/forstore/bomListDetailCtrl.js

@@ -24,8 +24,8 @@ define(['app/app'], function(app) {
             })
         }
         loadData();
-        var initIndex = function () {
-            angular.forEach($scope.bomData.seekPurchaseByBatchs, function (item, index) {
+        var initIndex = function (list) {
+            angular.forEach(list, function (item, index) {
                 item.$index = index;
             });
         }
@@ -241,9 +241,9 @@ define(['app/app'], function(app) {
                 isInBrandList: false,
                 amount: 0
             });
-            initIndex();
-            $scope.tmpEditBom = angular.copy($scope.bomData);
+            initIndex($scope.bomData.seekPurchaseByBatchs);
             $scope.setAllCheck(true);
+            $scope.tmpEditBom = angular.copy($scope.bomData);
         };
 
         // 打开日期选择框
@@ -501,5 +501,12 @@ define(['app/app'], function(app) {
             item.brand = brand;
             $scope.setShowSimilarList(item, 'showSimilarBrandList', false);
         }
+        $scope.deleteDetail = function ($index) {
+            $scope.bomData.seekPurchaseByBatchs.splice($index, 1);
+            $scope.tmpEditBom.seekPurchaseByBatchs.splice($index, 1);
+            initIndex($scope.bomData.seekPurchaseByBatchs);
+            initIndex($scope.tmpEditBom.seekPurchaseByBatchs);
+        }
+
     }]);
 });

+ 1 - 1
src/main/webapp/resources/view/usercenter/forstore/bomListDetail.html

@@ -360,7 +360,7 @@
                     </div>
                 </td>
                 <td class="base-info pcs-line" style="position:relative;">
-                    <div class="content-clear" ng-if="!detail.id" ng-click="tmpEditBom.seekPurchaseByBatchs.splice(detail.$index, 1);bomData.seekPurchaseByBatchs.splice(detail.$index, 1)">
+                    <div class="content-clear" ng-if="!detail.id" ng-click="deleteDetail($index)">
                         <i class="fa fa-close"></i>
                     </div>
                     <div class="content-line">