scorpio 2 лет назад
Родитель
Сommit
dbaa6bf3ee
1 измененных файлов с 21 добавлено и 19 удалено
  1. 21 19
      src/views/home/component/params/params3.vue

+ 21 - 19
src/views/home/component/params/params3.vue

@@ -248,27 +248,29 @@ export default {
      * @param index 索引
      */
     showMonth (year, type, index) {
-      const item = { editType: type, year, index }
-      if (type === 1) {
-        item.planMonths = this.form.month_plan_complete_amount.find(sub => sub.year === year).monthlyData
-        item.months = this.form.month_complete_amount.find(sub => sub.year === year).monthlyData
-      } else if (type === 2) {
-        item.planMonths = this.form.month_plan_investment.find(sub => sub.year === year).monthlyData
-        item.months = this.form.month_investment_amount.find(sub => sub.year === year).monthlyData
-      }
-      this.current = Object.assign({}, item)
-      for (let i = 1; i <= 12; i++) {
-        const index = this.current.months.findIndex(sub => sub.month === i.toString())
-        if (index === -1 && this.current.months.length < 12) {
-          const ele = { month: i.toString(), data: '', year: '' }
-          this.current.months.push(ele)
+      this.$nextTick(() => {
+        const item = { editType: type, year, index }
+        if (type === 1) {
+          item.planMonths = this.form.month_plan_complete_amount.find(sub => sub.year === year).monthlyData
+          item.months = this.form.month_complete_amount.find(sub => sub.year === year).monthlyData
+        } else if (type === 2) {
+          item.planMonths = this.form.month_plan_investment.find(sub => sub.year === year).monthlyData
+          item.months = this.form.month_investment_amount.find(sub => sub.year === year).monthlyData
         }
-        const planIndex = this.current.planMonths.findIndex(sub => sub.month === i.toString())
-        if (planIndex === -1 && this.current.planMonths.length < 12) {
-          const sub = { month: i.toString(), data: '', year: '' }
-          this.current.planMonths.push(sub)
+        this.current = Object.assign({}, item)
+        for (let i = 1; i <= 12; i++) {
+          const index = this.current.months.findIndex(sub => sub.month === i.toString())
+          if (index === -1 && this.current.months.length < 12) {
+            const ele = { month: i.toString(), data: '', year: '' }
+            this.current.months.push(ele)
+          }
+          const planIndex = this.current.planMonths.findIndex(sub => sub.month === i.toString())
+          if (planIndex === -1 && this.current.planMonths.length < 12) {
+            const sub = { month: i.toString(), data: '', year: '' }
+            this.current.planMonths.push(sub)
+          }
         }
-      }
+      })
       this.show = !this.show
     },
     /**