소스 검색

2022.7.8 工时报告日期bug

ggooalice 3 년 전
부모
커밋
600c756894
1개의 변경된 파일20개의 추가작업 그리고 7개의 파일을 삭제
  1. 20 7
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

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

@@ -3427,11 +3427,22 @@
                     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() + '日'
+                    
+                    let nowmonth = new Date().getMonth() + 1
+                    let nowd = new Date().getFullYear() + '-' + (nowmonth < 10 ? '0' + nowmonth : nowmonth)
+                    if(nowd == this.date){
+                        let nowday = new Date().getDate()
+                        this.choseDay = nowday - 1
+                        sessionStorage.msg = this.date + '-' + (nowday < 10 ? '0' + nowday : nowday)
+                        let monthdate = new Date(sessionStorage.msg)
+                        this.curDate = (monthdate.getMonth() + 1) + '月' + monthdate.getDate() + '日'
+                        console.log('choseday',sessionStorage.msg,this.choseDay,monthdate.getDate());
+                    }else{
+                        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
                 }
@@ -3442,9 +3453,11 @@
                     sessionStorage.from = 0;
                 } else {
                     if (curMonthDay != null) {
-                        this.curDate = curMonthDay;
+                        // this.curDate = curMonthDay;
+                        let d = new Date(sessionStorage.msg)
+                        this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
                     } else {
-                        var d = new Date(this.date.replace(/-/g, "/")+'/01')
+                        let d = new Date(this.date.replace(/-/g, "/")+'/01')
                         this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
                     }
                 }