Browse Source

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU/icore-pass

zengyf 2 years ago
parent
commit
0a327290d7

+ 79 - 3
src/views/sale/components/transportFreight/saleTruckSettlement/bmsTruckDetailsOrderNew.vue

@@ -1067,6 +1067,7 @@ export default {
             start + Math.floor(this.maxHeight / this.itemHeight) + 1
           )
           this.getSpanArr(this.visibleList)
+          this.getSpanArr1(this.visibleList1)
         })
       }
     }
@@ -2470,6 +2471,28 @@ export default {
         }
       }
     },
+    getSpanArr1(data) {
+      //每次调用方法初始化
+      this.spanArr1 = []
+      for (var i = 0; i < data.length; i++) {
+        if (i === 0) {
+          this.spanArr1.push(1)
+          data[i].group = i
+          this.pos = 0
+        } else {
+          // 判断当前元素与上一个元素是否相同
+          if (data[i].saleOrderMaterialId === data[i - 1].saleOrderMaterialId) {
+            this.spanArr1[this.pos] += 1
+            data[i].group = data[i - 1].group
+            this.spanArr1.push(0)
+          } else {
+            this.spanArr1.push(1)
+            this.pos = i
+            data[i].group = data[i - 1].group + 1
+          }
+        }
+      }
+    },
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
       if (this.mergeList.indexOf(column.label) != -1) {
         const _row = this.spanArr[rowIndex]
@@ -2482,7 +2505,7 @@ export default {
     },
     objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
       if (this.mergeList1.indexOf(column.label) != -1) {
-        const _row = this.spanArr[rowIndex]
+        const _row = this.spanArr1[rowIndex]
         const _col = _row > 0 ? 1 : 0
         return {
           rowspan: _row,
@@ -2677,6 +2700,20 @@ export default {
           this.tableData = res.data.data
           this.totalHeight += this.itemHeight
           this.visibleList = res.data.data
+          console.log(this.visibleList);
+          try {
+            //遍历保留两位小数
+            this.visibleList.forEach(e=>{
+                if(e.priceValue){
+                  e.priceValue=e.priceValue.toFixed(2);
+                }
+                if(e.detailsAmount){
+                  e.detailsAmount=e.detailsAmount.toFixed(2);
+                }
+            }) 
+          } catch (error) {
+              
+          }
           console.log(this.visibleList, 'this.visibleList')
           this.getSpanArr(this.visibleList)
           this.getTotalNum(this.tableData)
@@ -2710,8 +2747,21 @@ export default {
           this.tableData = res.data.data
           this.totalHeight += this.itemHeight
           this.visibleList1 = res.data.data
+          try {
+            //遍历保留两位小数
+            this.visibleList1.forEach(e=>{
+                if(e.priceValue){
+                  e.priceValue=e.priceValue.toFixed(2);
+                }
+                if(e.detailsAmount){
+                  e.detailsAmount=e.detailsAmount.toFixed(2);
+                }
+            }) 
+          } catch (error) {
+              
+          }
           console.log(this.visibleList1, 'this.visibleList1')
-          this.getSpanArr(this.visibleList1)
+          this.getSpanArr1(this.visibleList1)
           this.getTotalNum(this.tableData)
           console.log(this.visibleList1)
         })
@@ -2807,6 +2857,19 @@ export default {
             0,
             Math.floor(this.maxHeight / this.itemHeight) + 1
           )
+          try {
+            //遍历保留两位小数
+            this.visibleList.forEach(e=>{
+                if(e.priceValue){
+                  e.priceValue=e.priceValue.toFixed(2);
+                }
+                if(e.detailsAmount){
+                  e.detailsAmount=e.detailsAmount.toFixed(2);
+                }
+            }) 
+          } catch (error) {
+              
+          }
           console.log(this.visibleList)
           this.getSpanArr(this.visibleList)
           this.getTotalNum(this.tableData)
@@ -2846,8 +2909,21 @@ export default {
             0,
             Math.floor(this.maxHeight / this.itemHeight) + 1
           )
+          try {
+            //遍历保留两位小数
+            this.visibleList1.forEach(e=>{
+                if(e.priceValue){
+                  e.priceValue=e.priceValue.toFixed(2);
+                }
+                if(e.detailsAmount){
+                  e.detailsAmount=e.detailsAmount.toFixed(2);
+                }
+            }) 
+          } catch (error) {
+              
+          }
           console.log(this.visibleList1)
-          this.getSpanArr(this.visibleList1)
+          this.getSpanArr1(this.visibleList1)
           this.getTotalNum(this.tableData1)
           loading.close()
         })