Explorar o código

提交移动端按周填报的问题

Lijy hai 1 ano
pai
achega
428cd73bbc

+ 34 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -490,6 +490,16 @@
             };
         },
         methods: {
+            // 获取地址上的参数
+            getUrlKey(name) {
+                return (
+                    decodeURIComponent(
+                        (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
+                            location.href
+                        ) || [, ""])[1].replace(/\+/g, "%20")
+                    ) || null
+                );
+            },
             getRecentlyProject() {
                 this.$axios.post('/project/nearProject',{})
                 .then(res => {
@@ -672,6 +682,7 @@
                 // }else{
                 //     this.weekIndex = 5
                 // }
+                const { enableNewWeeklyfill } = this.user.timeType // 针对物奇
                 if(this.user.timeType.alertNonWorkday) {
                     if(this.user.timeType.alertNonWorkday == '110' || this.user.timeType.alertNonWorkday == '10') {
                         this.weekIndex = 7
@@ -684,6 +695,17 @@
                 }
 
                 let nowDate = new Date()
+
+                console.log(nowDate, '<=== nowDate')
+                // 针对物奇
+                if(enableNewWeeklyfill == 1) {
+                    const urldate = this.getUrlKey('date')
+                    if(urldate) {
+                        nowDate = new Date(urldate)
+                    }
+                }
+                
+
                 let nowWeekday = nowDate.getDay()
 
                 let shuldDate
@@ -697,10 +719,10 @@
 
                 // 时间段数组
                 let date = new Date(shuldDate.getFullYear(),shuldDate.getMonth(),shuldDate.getDate()-shuldDate.getDay()+1)
-
-                const { enableNewWeeklyfill } = this.user.timeType // 针对物奇
+                console.log(this.formatDate(date), '<=== date', this.formatDate(shuldDate), this.formatDate(nowWeekday))
                 this.dateRange = []
-                if(enableNewWeeklyfill) {
+
+                if(enableNewWeeklyfill) { // 针对物奇
                     let { data } = await this.$axios.post('/report/getWeeklyFillReportData', {
                         targetDate: this.formatDate(date)
                     })
@@ -2284,6 +2306,15 @@
         },
         
         mounted() {
+            this.getUrlKey('date')
+            const { enableNewWeeklyfill } = this.user.timeType // 针对物奇
+            // if(enableNewWeeklyfill == 1) {
+            //     const urldate = this.getUrlKey('date')
+            //     if(urldate) {
+            //         this.nowTime = this.formatTime(urldate)
+            //         console.log(this.nowTime, '时间')
+            //     }
+            // }
             this.timeRange = []
             for(let i=0.5; i<=20; i+=0.5){
                 this.timeRange.push(i)