Browse Source

修复以前日期不显示日报状态的bug

QuYueTing 7 months ago
parent
commit
fa51d3e3c3
1 changed files with 29 additions and 9 deletions
  1. 29 9
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/view/calendar.vue

+ 29 - 9
fhKeeper/formulahousekeeper/timesheet_h5/src/views/view/calendar.vue

@@ -12,6 +12,7 @@
             :style="{ height: tableHeight+'px' }"
             :className="'van-calendar__top-info'"
             @select="selectDate"
+            @month-show="onMonthShow"
             />
         </div>
     </div>
@@ -107,32 +108,51 @@
                 this.showPicker = false;
                 this.getReport();
             },
-
-            // 获取日报
-            getReport() {
+            onMonthShow(data) {
                 this.hasWaiting = false;
                 const toast = this.$toast.loading({
                     forbidClick: true,
                     duration: 0
                 });
-                var startDate = new Date();
-                startDate.setMonth(startDate.getMonth() -2);
-                this.$axios.post("/report/getReportFillStatus", {startDate: this.format(startDate), endDate:this.format(this.maxDate), userId: this.user.id})
+                var startDate = data.date;
+                var endDate = new Date(startDate);
+                endDate.setMonth(endDate.getMonth() + 1, 0);
+                this.$axios.post("/report/getReportFillStatus", {startDate: this.format(startDate), endDate:this.format(endDate), userId: this.user.id})
                 .then(res => {
                     if(res.code == "ok") {
                         this.$toast.clear();
-                        this.report = res.data;
-                        
+                        this.report = this.report.concat(res.data);
                     } else {
                         this.$toast.clear();
                         this.$toast.fail('获取失败');
                     }
                 }).catch(err=> {this.$toast.clear();});
             },
+            // 获取日报
+            // getReport() {
+            //     this.hasWaiting = false;
+            //     const toast = this.$toast.loading({
+            //         forbidClick: true,
+            //         duration: 0
+            //     });
+            //     var startDate = new Date();
+            //     startDate.setMonth(startDate.getMonth() -1);
+            //     this.$axios.post("/report/getReportFillStatus", {startDate: this.format(startDate), endDate:this.format(this.maxDate), userId: this.user.id})
+            //     .then(res => {
+            //         if(res.code == "ok") {
+            //             this.$toast.clear();
+            //             this.report = res.data;
+                        
+            //         } else {
+            //             this.$toast.clear();
+            //             this.$toast.fail('获取失败');
+            //         }
+            //     }).catch(err=> {this.$toast.clear();});
+            // },
         },
 
         mounted() {
-            this.getReport();
+            // this.getReport();
         }
     };
 </script>