Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/release-201827-wangcz' into release-201827-wangcz

wangyc 7 gadi atpakaļ
vecāks
revīzija
0aac472ff6

+ 8 - 3
src/main/webapp/resources/js/usercenter/controllers/forstore/bomListDetailCtrl.js

@@ -10,7 +10,8 @@ define(['app/app'], function(app) {
             seekPurchase.getBomListDetail({bomId: $stateParams.id}, function (data) {
                 $scope.bomData = data;
                 if ($scope.bomData.seekPurchaseByBatchs) {
-                    angular.forEach($scope.bomData.seekPurchaseByBatchs, function (item) {
+                    angular.forEach($scope.bomData.seekPurchaseByBatchs, function (item, index) {
+                        item.$index = index;
                         item.$checked = false;
                         item.showSimilarCodeList = false;
                         item.showSimilarBrandList = false;
@@ -23,6 +24,11 @@ define(['app/app'], function(app) {
             })
         }
         loadData();
+        var initIndex = function () {
+            angular.forEach($scope.bomData.seekPurchaseByBatchs, function (item, index) {
+                item.$index = index;
+            });
+        }
         // 获取字符长度
         var getRealLen = function (str) {
             var len = 0;
@@ -222,7 +228,6 @@ define(['app/app'], function(app) {
 
         // 新增单条物料信息
         $scope.addNewMateriel = function () {
-            console.log($scope.bomData.seekPurchaseByBatchs)
             $scope.bomData.seekPurchaseByBatchs.unshift({
                 bomId: $scope.bomData.id,
                 brand: '',
@@ -236,9 +241,9 @@ define(['app/app'], function(app) {
                 isInBrandList: false,
                 amount: 0
             });
+            initIndex();
             $scope.tmpEditBom = angular.copy($scope.bomData);
             $scope.setAllCheck(true);
-            console.log($scope.bomData.seekPurchaseByBatchs, $scope.tmpEditBom.seekPurchaseByBatchs)
         };
 
         // 打开日期选择框

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

@@ -284,11 +284,11 @@
             </tr>
         </thead>
         <tbody>
-            <tr ng-repeat="detail in bomData.seekPurchaseByBatchs track by $index">
+            <tr ng-repeat="detail in bomData.seekPurchaseByBatchs track by detail.$index">
                 <td>
                     <label class="com-check-box">
-                        <input type="checkbox" id="{{$index}}" ng-click="initCheckAll()" ng-model="detail.$checked">
-                        <label for="{{$index}}"></label>
+                        <input type="checkbox" id="{{detail.$index}}" ng-click="initCheckAll()" ng-model="detail.$checked">
+                        <label for="{{detail.$index}}"></label>
                     </label>
                 </td>
                 <td class="base-info">
@@ -296,18 +296,18 @@
                         <div class="inline-block title">
                             <i class="must">*</i>品牌:
                         </div>
-                        <div class="inline-block" ng-class="{'similar-wrap': tmpEditBom.seekPurchaseByBatchs[$index].showSimilarBrandList}" title="{{detail.brand}}">
+                        <div class="inline-block" ng-class="{'similar-wrap': tmpEditBom.seekPurchaseByBatchs[detail.$index].showSimilarBrandList}" title="{{detail.brand}}">
                             <span ng-show="!editBom || !detail.$checked" ng-bind="detail.brand || '-'"></span>
                             <input ng-show="editBom && detail.$checked"
-                                   ng-model="tmpEditBom.seekPurchaseByBatchs[$index].brand"
-                                   ng-change="onBrandChange(tmpEditBom.seekPurchaseByBatchs[$index])"
-                                   ng-blur="checkBrand(tmpEditBom.seekPurchaseByBatchs[$index])"
+                                   ng-model="tmpEditBom.seekPurchaseByBatchs[detail.$index].brand"
+                                   ng-change="onBrandChange(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
+                                   ng-blur="checkBrand(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
                                    type="text">
                             <ul class="similar-list"
-                                ng-show="tmpEditBom.seekPurchaseByBatchs[$index].showSimilarBrandList"
-                                ng-mouseenter="tmpEditBom.seekPurchaseByBatchs[$index].isInBrandList = true;"
-                                ng-mouseleave="tmpEditBom.seekPurchaseByBatchs[$index].isInBrandList = false">
-                                <li ng-repeat="sBrand in similarBrand" ng-bind="sBrand.nameEn" title="{{sBrand.nameEn}}" ng-click="setBrand(tmpEditBom.seekPurchaseByBatchs[$index], sBrand.nameEn)"></li>
+                                ng-show="tmpEditBom.seekPurchaseByBatchs[detail.$index].showSimilarBrandList"
+                                ng-mouseenter="tmpEditBom.seekPurchaseByBatchs[detail.$index].isInBrandList = true;"
+                                ng-mouseleave="tmpEditBom.seekPurchaseByBatchs[detail.$index].isInBrandList = false">
+                                <li ng-repeat="sBrand in similarBrand" ng-bind="sBrand.nameEn" title="{{sBrand.nameEn}}" ng-click="setBrand(tmpEditBom.seekPurchaseByBatchs[detail.$index], sBrand.nameEn)"></li>
                             </ul>
                         </div>
                     </div>
@@ -318,9 +318,9 @@
                         <div class="inline-block" title="{{detail.kind}}">
                             <span ng-show="!editBom || !detail.$checked" ng-bind="detail.kind || '-'"></span>
                             <input ng-show="editBom && detail.$checked"
-                                   ng-model="tmpEditBom.seekPurchaseByBatchs[$index].kind"
-                                   ng-change="onKindChange(tmpEditBom.seekPurchaseByBatchs[$index])"
-                                   ng-blur="checkKind(tmpEditBom.seekPurchaseByBatchs[$index])"
+                                   ng-model="tmpEditBom.seekPurchaseByBatchs[detail.$index].kind"
+                                   ng-change="onKindChange(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
+                                   ng-blur="checkKind(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
                                    type="text">
                         </div>
                     </div>
@@ -330,18 +330,18 @@
                         <div class="inline-block title">
                             <i class="must">*</i>型号:
                         </div>
-                        <div class="inline-block" ng-class="{'similar-wrap': tmpEditBom.seekPurchaseByBatchs[$index].showSimilarCodeList}" title="{{detail.code}}">
+                        <div class="inline-block" ng-class="{'similar-wrap': tmpEditBom.seekPurchaseByBatchs[detail.$index].showSimilarCodeList}" title="{{detail.code}}">
                             <span ng-show="!editBom || !detail.$checked" ng-bind="detail.code || '-'"></span>
                             <input ng-show="editBom && detail.$checked"
-                                   ng-model="tmpEditBom.seekPurchaseByBatchs[$index].code"
-                                   ng-change="onCodeChange(tmpEditBom.seekPurchaseByBatchs[$index])"
-                                   ng-blur="checkCode(tmpEditBom.seekPurchaseByBatchs[$index])"
+                                   ng-model="tmpEditBom.seekPurchaseByBatchs[detail.$index].code"
+                                   ng-change="onCodeChange(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
+                                   ng-blur="checkCode(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
                                    type="text">
                             <ul class="similar-list"
-                                ng-show="tmpEditBom.seekPurchaseByBatchs[$index].showSimilarCodeList"
-                                ng-mouseenter="tmpEditBom.seekPurchaseByBatchs[$index].isInCodeList = true;"
-                                ng-mouseleave="tmpEditBom.seekPurchaseByBatchs[$index].isInCodeList = false">
-                                <li ng-repeat="sCode in similarCode" ng-bind="sCode.code" title="{{sCode.code}}" ng-click="setCode(tmpEditBom.seekPurchaseByBatchs[$index], sCode.code)"></li>
+                                ng-show="tmpEditBom.seekPurchaseByBatchs[detail.$index].showSimilarCodeList"
+                                ng-mouseenter="tmpEditBom.seekPurchaseByBatchs[detail.$index].isInCodeList = true;"
+                                ng-mouseleave="tmpEditBom.seekPurchaseByBatchs[detail.$index].isInCodeList = false">
+                                <li ng-repeat="sCode in similarCode" ng-bind="sCode.code" title="{{sCode.code}}" ng-click="setCode(tmpEditBom.seekPurchaseByBatchs[detail.$index], sCode.code)"></li>
                             </ul>
                         </div>
                     </div>
@@ -352,15 +352,15 @@
                         <div class="inline-block" title="{{detail.spec}}">
                             <span ng-show="!editBom || !detail.$checked" ng-bind="detail.spec || '-'"></span>
                             <input ng-show="editBom && detail.$checked"
-                                   ng-model="tmpEditBom.seekPurchaseByBatchs[$index].spec"
-                                   ng-change="onSpecChange(tmpEditBom.seekPurchaseByBatchs[$index])"
-                                   ng-blur="checkSpec(tmpEditBom.seekPurchaseByBatchs[$index])"
+                                   ng-model="tmpEditBom.seekPurchaseByBatchs[detail.$index].spec"
+                                   ng-change="onSpecChange(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
+                                   ng-blur="checkSpec(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
                                    type="text">
                         </div>
                     </div>
                 </td>
                 <td class="base-info pcs-line" style="position:relative;">
-                    <div class="content-clear" ng-if="!detail.id" ng-click="tmpEditBom.seekPurchaseByBatchs.splice($index, 1);bomData.seekPurchaseByBatchs.splice($index, 1)">
+                    <div class="content-clear" ng-if="!detail.id" ng-click="tmpEditBom.seekPurchaseByBatchs.splice(detail.$index, 1);bomData.seekPurchaseByBatchs.splice(detail.$index, 1)">
                         <i class="fa fa-close"></i>
                     </div>
                     <div class="content-line">
@@ -370,8 +370,8 @@
                         <div class="inline-block" title="{{detail.amount}}">
                             <span ng-show="!editBom || !detail.$checked" ng-bind="detail.amount || '-'"></span>
                             <input ng-show="editBom && detail.$checked"
-                                   ng-model="tmpEditBom.seekPurchaseByBatchs[$index].amount"
-                                   ng-change="onAmountChange(tmpEditBom.seekPurchaseByBatchs[$index])"
+                                   ng-model="tmpEditBom.seekPurchaseByBatchs[detail.$index].amount"
+                                   ng-change="onAmountChange(tmpEditBom.seekPurchaseByBatchs[detail.$index])"
                                    type="text">
                         </div>
                     </div>