Jelajahi Sumber

2022.7.8 消息跳转日期bug

ggooalice 2 tahun lalu
induk
melakukan
104016fcaa

+ 16 - 7
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -3355,10 +3355,6 @@
             changeMonthOut() {
                 this.getAllDate();
                 
-                this.choseDay = 0;
-                sessionStorage.msg = this.date + '-01'
-                let monthdate = new Date(this.date + '-01')
-                this.curDate = (monthdate.getMonth() + 1) + '月' + monthdate.getDate() + '日'
                 this.getReportList();
                 this.getDepartment();
             },
@@ -3430,6 +3426,16 @@
                 if (this.choseDay > day-1) {
                     this.choseDay = day-1;
                 }
+                if(sessionStorage.from != 1){
+                    console.log('非消息跳转');
+                    this.choseDay = 0;
+                    sessionStorage.msg = this.date + '-01'
+                    let monthdate = new Date(this.date + '-01')
+                    this.curDate = (monthdate.getMonth() + 1) + '月' + monthdate.getDate() + '日'
+                }else{
+                    this.choseDay = parseInt(sessionStorage.msg.split('-')[2]) - 1
+                }
+                
                 //从消息点击跳转过来的,直接加载指定日期
                 if (sessionStorage.from == 1 && sessionStorage.msg) {
                     this.curDate = sessionStorage.msg;
@@ -3442,9 +3448,12 @@
                         this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
                     }
                 }
-                this.curDate = this.curDate.split('月')[0] + '月' + (this.choseDay + 1) + '日'
-                let msgday = this.choseDay + 1
-                sessionStorage.msg = this.date + '-' + (msgday < 10 ? '0' + msgday : msgday)
+                // this.curDate = this.curDate.split('月')[0] + '月' + (this.choseDay + 1) + '日'
+                if(!sessionStorage.msg){
+                    let msgday = this.choseDay + 1
+                    sessionStorage.msg = this.date + '-' + (msgday < 10 ? '0' + msgday : msgday)
+                }
+                
                 this.getReportFillStatus();
             },