Bläddra i källkod

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 år sedan
förälder
incheckning
f1f3dd7f70
1 ändrade filer med 39 tillägg och 6 borttagningar
  1. 39 6
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

+ 39 - 6
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -22,7 +22,7 @@
                     :disabled="canSelect(item)">{{weekArr[index]}}</van-button>
                 </van-grid-item>
                 <van-grid-item v-if="weekIndex != 7">
-                    <van-button type="default" size="mini" class="selectgxbtn" @click="addWeekIndex()" icon="plus"></van-button>
+                    <van-button type="default" size="mini" class="selectgxbtn" @click="addWeekIndex()" icon="plus" v-if="user.timeType.enableNewWeeklyfill != 1"></van-button>
                 </van-grid-item>
                 <div class="kaoqin2" v-if="kaoqinText"><span>当日考勤:</span><span>{{kaoqinText}}</span></div>
                 <div class="kaoqin" v-if="workTimeText"><span>已填报工时:</span><span>{{workTimeText}}小时</span></div>
@@ -660,7 +660,7 @@
                 })
             },
             // 获取周填报时间数据
-            getDateRange(){
+            async getDateRange(){
                 // if(this.user.companyId == 817){
                 //     this.weekIndex = 6
                 // }else{
@@ -679,6 +679,7 @@
 
                 let nowDate = new Date()
                 let nowWeekday = nowDate.getDay()
+
                 let shuldDate
                 if(nowWeekday == 0){
                     // 取上周日期
@@ -690,11 +691,21 @@
 
                 // 时间段数组
                 let date = new Date(shuldDate.getFullYear(),shuldDate.getMonth(),shuldDate.getDate()-shuldDate.getDay()+1)
+
+                const { enableNewWeeklyfill } = this.user.timeType // 针对物奇
                 this.dateRange = []
-                for(let i=0;i<this.weekIndex;i++){
-                    this.dateRange.push(new Date(date.getFullYear(),date.getMonth(),date.getDate()+i))
+                if(enableNewWeeklyfill) {
+                    let { data } = await this.$axios.post('/report/getWeeklyFillReportData', {
+                        targetDate: this.formatDate(date)
+                    })
+                    let { dateList } = data
+                    this.dateRange = dateList.map(item => new Date(item.date))
+                } else {
+                    for(let i=0;i<this.weekIndex;i++){
+                        this.dateRange.push(new Date(date.getFullYear(),date.getMonth(),date.getDate()+i))
+                    }
                 }
-
+                
                 // 时间段字符串
                 let startDate = this.dateRange[0]
                 let startDateM = startDate.getMonth() + 1
@@ -2178,7 +2189,29 @@
                         }
                     )
                 });
-            }
+            },
+            // 中国标准时间转成YYYY-MM-DD
+            formatDate(date) {
+                if (!date) {
+                    return '';
+                }
+                const newDate = new Date(date);
+                const year = newDate.getFullYear();
+                const month = newDate.getMonth() + 1;
+                const day = newDate.getDate();
+                return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
+            },
+            // 将 YYYY-MM-DD 转成 中国标准时间
+            formatTime(date) {
+                if (!date) {
+                    return '';
+                }
+                const newDate = new Date(date);
+                const year = newDate.getFullYear();
+                const month = newDate.getMonth() + 1;
+                const day = newDate.getDate();
+                return `${year}/${month < 10 ? '0' + month : month}/${day < 10 ? '0' + day : day}`;
+            },
         },
         
         mounted() {