Pārlūkot izejas kodu

Merge branch 'dev' into test

liujt 4 mēneši atpakaļ
vecāks
revīzija
0c762d9148
1 mainītis faili ar 27 papildinājumiem un 14 dzēšanām
  1. 27 14
      src/BIZComponents/paymentCollectionPlan/Index.vue

+ 27 - 14
src/BIZComponents/paymentCollectionPlan/Index.vue

@@ -366,16 +366,16 @@
       },
       info: {
         handler(newval) {
-          if (newval && newval.receiptPaymentList) {
-            this.isLoadingFromApi = true;
-            this.form.datasource = newval.receiptPaymentList;
-            if (newval.payAmount) {
-              this.discountAmount = newval.payAmount;
-            }
-            setTimeout(() => {
-              this.isLoadingFromApi = false;
-            }, 100);
-          }
+          // if (newval && newval.receiptPaymentList) {
+          //   this.isLoadingFromApi = true;
+          //   this.form.datasource = newval.receiptPaymentList;
+          //   if (newval.payAmount) {
+          //     this.discountAmount = newval.payAmount;
+          //   }
+          //   setTimeout(() => {
+          //     this.isLoadingFromApi = false;
+          //   }, 100);
+          // }
         },
         deep: true
       }
@@ -469,7 +469,6 @@
               ...r,
               price: price
             };
-            console.log('updated item', i, 'price:', price);
           }
         }
         
@@ -588,7 +587,15 @@
           }
         }
         console.log('tempList~~~', tempList);
-        this.form.datasource = tempList;
+        // 清空原数组并逐个添加新元素,确保Vue能够检测到变化
+        this.form.datasource = [];
+        this.$nextTick(() => {
+          this.form.datasource = tempList;
+          console.log('form.datasource after update:', this.form.datasource);
+          // 强制组件重新渲染
+          this.$forceUpdate();
+          console.log('forceUpdate called');
+        });
       },
 
       transformDaysFun(date) {
@@ -697,10 +704,16 @@
         // }
         
         console.log('付款计划列表:~~', tempList);
-        this.form.datasource = tempList;
         // this.$set(this.form, 'datasource', tempList);
         console.log('付款计划列表:', this.form.datasource);
-        this.$forceUpdate();
+        this.form.datasource = [];
+        this.$nextTick(() => {
+          this.form.datasource = tempList;
+          console.log('form.datasource after update:', this.form.datasource);
+          // 强制组件重新渲染
+          this.$forceUpdate();
+          console.log('forceUpdate called');
+        });
       },
       // 添加
       handlAdd() {