Sfoglia il codice sorgente

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

liujt 5 mesi fa
parent
commit
0c92f5f5f4

+ 1 - 1
src/BIZComponents/inventoryTable.vue

@@ -282,7 +282,7 @@
             v-model="scope.row.singlePrice"
             placeholder="请输入"
             :disabled="quoteType === 2"
-            @input="changeCount(scope.row, scope.$index)"
+            @input="handleCountChange(scope.row, scope.$index)"
             type="number"
           >
             <template slot="append">元</template>

+ 24 - 23
src/BIZComponents/setProduct.js

@@ -1,27 +1,27 @@
-import C from 'highlight.js/lib/languages/1c';
 import Vue from 'vue';
 
 //改变数量
 export function changeCount(row, countObj, noDiscountSingle, weightType) {
   // console.log('changeCount~~', row, countObj, noDiscountSingle);
-  let total = row[countObj.countKey] || 0;
-  let data = row;
+  let data = JSON.parse(JSON.stringify(row));
+  let total = data[countObj.countKey] || 0;
+
   let _endIndex = 0; //计算单重需要
-  if (row.packageDispositionList) {
-    let endIndex = row.packageDispositionList.findIndex(
-      (ite) => row[countObj.unitIdKey] == ite.id
+  if (data.packageDispositionList) {
+    let endIndex = data.packageDispositionList.findIndex(
+      (ite) => data[countObj.unitIdKey] == ite.id
     );
     _endIndex = endIndex;
-    let packageData = row.packageDispositionList.find(
-      (ite) => row[countObj.unitIdKey] == ite.id
+    let packageData = data.packageDispositionList.find(
+      (ite) => data[countObj.unitIdKey] == ite.id
     );
-    row[countObj.unitKey] = packageData.conversionUnit;
-    if (row.weightUnit == row.measuringUnit && row.singleWeight) {
-      row.packageDispositionList[1].packageCell = row.singleWeight;
+    data[countObj.unitKey] = packageData.conversionUnit;
+    if (data.weightUnit == data.measuringUnit && data.singleWeight) {
+      data.packageDispositionList[1].packageCell = data.singleWeight;
     }
     for (; 0 < endIndex; endIndex--) {
       total = Vue.prototype.$math.format(
-        row.packageDispositionList[endIndex].packageCell * total,
+        data.packageDispositionList[endIndex].packageCell * total,
         14
       );
     }
@@ -41,14 +41,13 @@ export function changeCount(row, countObj, noDiscountSingle, weightType) {
 
   data['totalPrice'] = 0;
   data['discountTotalPrice'] = 0;
-  if (row.pricingWay == 2 || row.pricingWay == 3) {
-    let weightKey = countObj.weightKey || 'totalWeight';
-    if (row[weightKey] && row.singlePrice) {
-      data['totalPrice'] = (row[weightKey] * row.singlePrice).toFixed(2);
+  if (data.pricingWay == 2 || data.pricingWay == 3) {
+    if (data.totalWeight && data.singlePrice) {
+      data['totalPrice'] = (data.totalWeight * data.singlePrice).toFixed(2);
     }
   } else {
-    if (row[countObj.countKey] && row.singlePrice) {
-      data['totalPrice'] = (row[countObj.countKey] * row.singlePrice).toFixed(
+    if (data[countObj.countKey] && data.singlePrice) {
+      data['totalPrice'] = (data[countObj.countKey] * data.singlePrice).toFixed(
         2
       );
     }
@@ -58,13 +57,13 @@ export function changeCount(row, countObj, noDiscountSingle, weightType) {
     : data.discountTotalPrice;
   return data;
 }
-
 // 计算总重
 function setWeight(row, countObj) {
+  // return
   if (row.weightUnit == row.measuringUnit) {
     row['totalWeight'] = row.totalCount;
-  } else if (row.totalCount&& row.singleWeight) {
-    row['totalWeight'] = (row.totalCount * row.singleWeight).toFixed(2);
+  } else if (row.totalCount && row.singleWeight) {
+    row['totalWeight'] = Number((row.totalCount * row.singleWeight).toFixed(2));
   } else {
     row['totalWeight'] = 0;
   }
@@ -99,9 +98,11 @@ function setSingleWeight(row, countObj, endIndex) {
       );
     }
     // console.log(totalWeight, 'totalWeight');
-    row['singleWeight'] = Number(totalWeight/row[countObj.countKey]).toFixed(2);
+    row['singleWeight'] = Number(totalWeight / row[countObj.countKey]).toFixed(
+      2
+    );
   } else if (row.totalWeight && row.totalCount) {
-    row['singleWeight'] = (row.totalWeight / row.totalCount).toFixed(2);
+    row['singleWeight'] = Number((row.totalWeight / row.totalCount).toFixed(2));
   } else {
     row['singleWeight'] = 0;
   }

+ 7 - 15
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -527,7 +527,6 @@
                 <el-option
                   :label="item.conversionUnit"
                   :value="item.id"
-                
                   v-for="(item, index) in scope.row.packageDispositionList"
                   :key="index"
                 ></el-option>
@@ -913,7 +912,7 @@
             prop: 'totalWeight',
             label: '总重',
             slot: 'totalWeight',
-            align: 'center',
+            align: 'center'
             // formatter: (row, column) => {
             //   if (row.totalWeight) {
             //     return row.totalWeight + ' ' + (row.weightUnit || '');
@@ -1123,11 +1122,7 @@
           this.changeAll();
         }
       },
-      // 改变总重
-      changeTotalWeight(row, index) {
 
-        this.changeCount(row, index)
-      },
       //改变数量
       changeCount(row, index, weightType) {
         // if (this.detailType) {
@@ -1142,18 +1137,15 @@
         };
         if (!row) {
           this.form.datasource.forEach((item, index) => {
-            this.$set(
-              this.form,
-              'datasource[' + index + ']',
-              changeCount(item, countObj)
-            );
-           this.setIncreaseTotalWeight(item, index);
-
+            this.$set(this.form.datasource, index, changeCount(item, countObj));
+            this.setIncreaseTotalWeight(item, index);
           });
         } else {
+          console.log(changeCount(row, countObj, false, weightType), '556644');
+
           this.$set(
-            this.form,
-            'datasource[' + index + ']',
+            this.form.datasource,
+            index,
             changeCount(row, countObj, false, weightType)
           );
           this.setIncreaseTotalWeight(row, index);

+ 3 - 5
src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue

@@ -121,8 +121,7 @@
           <el-input
             type="number"
             v-model="scope.row.receiveTotalWeight"
-                    @input="changeCount(scope.row, scope.$index, 'totalWeight')"
-
+            @input="changeCount(scope.row, scope.$index, 'totalWeight')"
             style="width: 100%"
             :disabled="isDis(scope.row)"
           >
@@ -989,7 +988,6 @@
         this.setIcreaseTotalWeight(this.curIndex);
       },
       isDis(row) {
-
         if (row.weightUnit == row.purchaseUnit) {
           return true;
         }
@@ -1006,8 +1004,8 @@
           );
         }
         this.$set(
-          this.form,
-          'datasource[' + index + ']',
+          this.form.datasource,
+          index,
           changeCount(
             row,
             {

+ 2 - 2
src/views/purchasingManage/purchaseOrder/outSourceSend/components/inventoryTable.vue

@@ -714,8 +714,8 @@
       //改变数量
       changeCount(row, index) {
         this.$set(
-          this.form,
-          'datasource[' + index + ']',
+          this.form.datasource,
+          index,
           changeCount(row, {
             countKey: 'purchaseCount',
             unitKey: 'purchaseUnit',

+ 2 - 2
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -1098,8 +1098,8 @@
         }
 
         this.$set(
-          this.form,
-          'datasource[' + index + ']',
+          this.form.datasource,
+          index,
           changeCount(
             row,
             {