htc 1 month ago
parent
commit
663158b88d
3 changed files with 18 additions and 12 deletions
  1. 1 1
      manifest.json
  2. 3 4
      pagesStatistics/components/CusCalendar/index.vue
  3. 14 7
      pagesStatistics/index.vue

+ 1 - 1
manifest.json

@@ -116,7 +116,7 @@
         },
         "permission" : {
             "scope.userLocation" : {
-                "desc" : "需要获取您的位置以计算距离"
+                "desc" : "获取您的具体位置信息,用于考勤打卡"
             }
         }
     },

+ 3 - 4
pagesStatistics/components/CusCalendar/index.vue

@@ -22,13 +22,11 @@
 				weekList:['一','二','三','四','五','六','日'],
 				year:new Date().getFullYear(),
 				month:new Date().getMonth()+1,
+				ruleWeeks:[],
 				calendarList:[],
 				clockList:[]
 			}
 		},
-		// created() {
-		// 	this.getDataByMonth(this.year,this.month);
-		// },
 		methods:{
 			getDataByMonth(year,month){
 				const daysInMonth = new Date(year, month, 0).getDate();
@@ -42,7 +40,8 @@
 					  month,
 					  day,
 					  week: date.getDay()||7,
-					  isweekday:(date.getDay()||7)<6,
+					  // isweekday:(date.getDay()||7)<6,
+					  isweekday:this.ruleWeeks.includes(date.getDay()),
 					  iscurrentday:nyr==new Date().Format('yyyy-MM-dd')
 					});
 				}

+ 14 - 7
pagesStatistics/index.vue

@@ -78,29 +78,35 @@
 				maxDate:'',
 				userInfo:null,
 				list:[],
-				info:null
+				info:null,
+				ruleWeeks:[],
 			}
 		},
-		onLoad() {
+		async onLoad() {
 			this.currentDay = new Date().Format('yyyy MM.dd');
 			this.currentTime = new Date().Format('yyyy-MM-dd hh:mm');
 			if(uni.getStorageSync('userInfo')){
 				this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
 			}
+			await this.getRules();
 			this.getUserMonthClock(new Date().getFullYear(),new Date().getMonth()+1);
 		},
 		mounted() {
-			this.getRules();
 			let d = new Date();
 			this.minDate = new Date(d.getFullYear()-1,d.getMonth()+1,d.getDate()).getTime();
 			this.maxDate = new Date().getTime();	
 		},
 		methods:{
 			getRules(){
-				this.$api.get('/wms/outsourced/attendance/rule').then(res=>{
-					if(res.data.code!==0) return this.$showToast(res.data.msg)
-					this.workingTime = res.data.data.workingTime.slice(0,5);
-					this.offWorkTime = res.data.data.offWorkTime.slice(0,5);
+				return new Promise((resolve,reject)=>{
+					this.$api.get('/wms/outsourced/attendance/rule').then(res=>{
+						if(res.data.code!==0) return this.$showToast(res.data.msg)
+						this.workingTime = res.data.data.workingTime.slice(0,5);
+						this.offWorkTime = res.data.data.offWorkTime.slice(0,5);
+						let rw = res.data?.data?.checkInOfWeek.split(',').map(r=> Number(r) - 1);
+						this.ruleWeeks = rw;
+						resolve()
+					})
 				})
 			},
 			getUserMonthClock(year,month){
@@ -113,6 +119,7 @@
 					this.workHours = res.data.data.reduce((a,b)=>a+Number(b.workingHours),0);
 					this.mealTimes = res.data.data.reduce((a,b)=>a+Number(b.mealTimes),0);
 					
+					this.$refs.calendarRef.ruleWeeks = this.ruleWeeks;
 					this.$refs.calendarRef.clockList = res.data.data||[];
 					this.$refs.calendarRef.getDataByMonth(year,month);
 				})