实名制临时打卡判断修改

This commit is contained in:
zzyuan 2024-11-11 15:19:15 +08:00
parent ffbe02fa5c
commit 1cda80d56e
1 changed files with 29 additions and 17 deletions

View File

@ -36,7 +36,7 @@
<view class="img-item upload-btn"> <view class="img-item upload-btn">
<image class="img" src="../../../../static/realName/tianjia-img.png" mode=""></image> <image class="img" src="../../../../static/realName/tianjia-img.png" mode=""></image>
</view> </view>
<view style="font-size: 28rpx;font-weight: bold;color: #757575;margin-top: 20rpx;" v-if="isShow">已进入考勤范围</view>
</view> </view>
<view class="title-view"> <view class="title-view">
下班打卡 下班打卡
@ -45,7 +45,7 @@
<view class="img-item upload-btn"> <view class="img-item upload-btn">
<image class="img" src="../../../../static/realName/tianjia-img.png" mode=""></image> <image class="img" src="../../../../static/realName/tianjia-img.png" mode=""></image>
</view> </view>
<view style="font-size: 28rpx;font-weight: bold;color: #757575;margin-top: 20rpx;" v-if="isShow">已进入考勤范围</view>
</view> </view>
</view> </view>
@ -80,6 +80,7 @@ export default {
faceData:{}, faceData:{},
photoPath:'', photoPath:'',
attendanceImgUrl:'', attendanceImgUrl:'',
isShow:false
} }
}, },
onLoad(option) { onLoad(option) {
@ -87,7 +88,7 @@ export default {
this.Time();// this.Time();//
this.getPro() this.getPro()
// this.getWork() // this.getWork()
// this.getTeamList() this.getTeamList()
}, },
onShow() { onShow() {
@ -135,16 +136,15 @@ export default {
success: res => { success: res => {
res = res.data; res = res.data;
if(res.code==200){ if(res.code==200){
this.teamList=res.data; this.teamList=res.data;
if(this.teamList.length>0){ if(this.teamList.length>0){
this.teamList.forEach((item,index)=>{ this.teamList.forEach((item,index)=>{
let distance=this.getDistance(this.latitude,this.longitude,item.lat,item.lon) let distance=this.getDistance(this.latitude,this.longitude,item.lat,item.lon)
// console.log(distance)
item.distance=distance; item.distance=distance;
}) })
this.teamList.sort((a, b) => { return a.distance - b.distance; }); this.teamList.sort((a, b) => { return a.distance - b.distance; });
this.rangeName=this.teamList[0].rangeName; this.rangeName=this.teamList[0].rangeName;
console.log(this.teamList)
} }
} }
}, },
@ -170,7 +170,22 @@ export default {
success: e => { success: e => {
this.longitude=e.longitude; this.longitude=e.longitude;
this.latitude=e.latitude; this.latitude=e.latitude;
if(this.teamList.length>0){
this.teamList.forEach((item,index)=>{
let distance=this.getDistance(this.latitude,this.longitude,item.lat,item.lon)
item.distance=distance;
})
}
console.log(this.teamList)
var index = this.teamList.findIndex(item => {return item.distance < 6})
console.log(index)
if(index>-1){//-
this.isShow=true;
}else{
this.isShow=false;
}
},fail:e=>{ },fail:e=>{
} }
}); });
}, },
@ -242,18 +257,15 @@ export default {
} }
this.proId = this.userData.proId this.proId = this.userData.proId
let costTime=this.getTimeDiff(this.userData.isToWork,this.timeStr); let costTime=this.getTimeDiff(this.userData.isToWork,this.timeStr);
if(this.type==2&&this.userData.isToWork==0){ var index = this.teamList.findIndex(item => {return item.distance < 6})
if(index<0){//存在-在考勤范围内
uni.$u.toast('不在考勤范围内!');
}else if(this.type==2&&this.userData.isToWork==0){
uni.$u.toast('还未打上班卡!'); uni.$u.toast('还未打上班卡!');
} }else if(this.type==2&&costTime<2){
// else if(this.type==1&&this.userData.isToWork!=0){
// uni.$u.toast('');
// }else if(this.type==2&&this.userData.isOffWork!=0){
// uni.$u.toast('');
// }
else if(this.type==2&&costTime<2){
uni.$u.toast('上下班打卡间隔2小时'); uni.$u.toast('上下班打卡间隔2小时');
}else if(this.userData.lightStatus==0&&this.userData.attDayNum>7){ }else if(this.userData.attDayNum>7){
uni.$u.toast('红灯人员只能打7天卡'); uni.$u.toast('临时人员只能打7天卡');
}else if(this.userData.isFurloughPerson==1){ }else if(this.userData.isFurloughPerson==1){
uni.$u.toast('暂退人员无法打卡!'); uni.$u.toast('暂退人员无法打卡!');
}else if(this.userData.workerType==1||this.userData.workerType==2){ }else if(this.userData.workerType==1||this.userData.workerType==2){
@ -327,8 +339,8 @@ export default {
this.faceData=JSON.parse(uploadFileRes.data.personData) this.faceData=JSON.parse(uploadFileRes.data.personData)
if(this.faceData){ if(this.faceData){
this.idNumber=this.faceData.idNumber; this.idNumber=this.faceData.idNumber;
this.getWork()
this.userName=this.faceData.name; this.userName=this.faceData.name;
this.getWork()
// }else{ // }else{
// uni.$u.toast(''); // uni.$u.toast('');
// } // }