liyg преди 2 години
родител
ревизия
a2526ca56e
променени са 1 файла, в които са добавени 72 реда и са изтрити 52 реда
  1. 72 52
      src/views/sale/components/transportFreight/saleTruckSettlement/bmsTruckDetailsOrderNew.vue

+ 72 - 52
src/views/sale/components/transportFreight/saleTruckSettlement/bmsTruckDetailsOrderNew.vue

@@ -1214,10 +1214,10 @@ export default {
         .then(res => {
           if (res.data.code == '200') {
             this.$message.success('修改详单单价成功!')
-            this.$refs.tableRef.clearSelection()
+            //this.$refs.tableRef.clearSelection()
             //重置未结算详单表单信息
             // this.operation(this.steelMap)
-            this.getSteelReport()
+            this.loadNewData()
             this.dialogFormVisible = false
           } else {
             this.$message.error('修改失败:'+res.data.data)
@@ -1251,10 +1251,10 @@ export default {
               .post('/api/v1/bms/updateBatchDetailsOrder', mapValue)
               .then(res => {
                 if (res.data.code == '200') {
-                  this.$refs.tableRef.clearSelection()
+                  //this.$refs.tableRef.clearSelection()
                   this.$message.success('修改详单单价和地址成功!')
                   // this.operation(this.steelMap)
-                  this.getSteelReport()
+                  this.loadNewData()
                   this.dialogFormVisible = false
                 }else {
                   this.$message.error('修改失败:'+res.data.data)
@@ -2699,18 +2699,18 @@ export default {
         .then(res => {
           this.tableData = res.data.data
           //遍历保留两位小数
-          this.tableData.forEach(e=>{
-              try {
-                  if(e.priceValue){
-                    e.priceValue=e.priceValue.toFixed(2);
-                  }
-                  if(e.detailsAmount){
-                    e.detailsAmount=e.detailsAmount.toFixed(2);
-                  }
-              } catch (error) {
+          // this.tableData.forEach(e=>{
+          //     try {
+          //         if(e.priceValue){
+          //           e.priceValue=e.priceValue.toFixed(2);
+          //         }
+          //         if(e.detailsAmount){
+          //           e.detailsAmount=e.detailsAmount.toFixed(2);
+          //         }
+          //     } catch (error) {
                   
-              }
-          })
+          //     }
+          // })
           this.totalHeight += this.itemHeight
           this.visibleList = res.data.data
           console.log(this.visibleList);
@@ -2746,18 +2746,18 @@ export default {
         .then(res => {
           this.tableData1 = res.data.data
           //遍历保留两位小数
-          this.tableData1.forEach(e=>{
-              try {
-                  if(e.priceValue){
-                    e.priceValue=e.priceValue.toFixed(2);
-                  }
-                  if(e.detailsAmount){
-                    e.detailsAmount=e.detailsAmount.toFixed(2);
-                  }
-              } catch (error) {
+          // this.tableData1.forEach(e=>{
+          //     try {
+          //         if(e.priceValue){
+          //           e.priceValue=e.priceValue.toFixed(2);
+          //         }
+          //         if(e.detailsAmount){
+          //           e.detailsAmount=e.detailsAmount.toFixed(2);
+          //         }
+          //     } catch (error) {
                   
-              }
-          })
+          //     }
+          // })
           this.totalHeight += this.itemHeight
           this.visibleList1 = res.data.data
           console.log(this.visibleList1, 'this.visibleList1')
@@ -2771,6 +2771,52 @@ export default {
     refresh() {
       this.getSteelReport()
     },
+    //仅仅更新变更数据
+    loadNewData(){
+      const loading = this.$loading({
+        lock: true,
+        text: '正在更新数据,请稍候',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+      let startTime = null
+      let endTime = null
+      if (this.startTime && this.endTime) {
+        startTime = sjTime(this.startTime)
+        endTime = sjTime(this.endTime)
+      }
+      let map= {
+        saleOrderMaterialIds:this.visibleList.map(e=>{
+          return e.saleOrderMaterialId
+        })
+      }
+      console.log("map:",map);
+      this.axios
+        .post(
+          '/api/v1/tms/getSaleSteelReportNew?startTime=' +
+            startTime +
+            '&endTime=' +
+            endTime,
+            map
+        )
+        .then(res => {
+          //遍历旧数组
+          this.visibleList.forEach(e1=>{
+            //遍历新数组
+            let temp = res.data.data.find(e2=>{
+              return e1.saleOrderMaterialId==e2.saleOrderMaterialId
+            })
+            //赋值
+            e1.priceValue=temp.priceValue;
+            e1.detailsAmount=temp.detailsAmount;
+            e1.actualAddress=temp.actualAddress;
+          })
+          loading.close();
+        })
+        .catch(() => {
+          loading.close()
+        })
+    },
     //获取钢材统计报表
     getSteelReport() {
       const loading = this.$loading({
@@ -2851,19 +2897,6 @@ export default {
         )
         .then(res => {
           this.tableData = res.data.data
-          //遍历保留两位小数
-          this.tableData.forEach(e=>{
-              try {
-                  if(e.priceValue){
-                    e.priceValue=e.priceValue.toFixed(2);
-                  }
-                  if(e.detailsAmount){
-                    e.detailsAmount=e.detailsAmount.toFixed(2);
-                  }
-              } catch (error) {
-                  
-              }
-          })
           this.totalHeight += this.itemHeight
           this.visibleList = []
           this.visibleList = this.tableData.slice(
@@ -2903,19 +2936,6 @@ export default {
         )
         .then(res => {
           this.tableData1 = res.data.data
-          //遍历保留两位小数
-          this.tableData1.forEach(e=>{
-              try {
-                  if(e.priceValue){
-                    e.priceValue=e.priceValue.toFixed(2);
-                  }
-                  if(e.detailsAmount){
-                    e.detailsAmount=e.detailsAmount.toFixed(2);
-                  }
-              } catch (error) {
-                  
-              }
-          })
           this.totalHeight += this.itemHeight
           this.visibleList1 = []
           this.visibleList1 = this.tableData1.slice(