|
@@ -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);
|
|
|
})
|