临时人员打卡

This commit is contained in:
zzyuan 2024-11-07 20:03:43 +08:00
parent 2d3631e3a8
commit 8a5e8bd9c9
1 changed files with 45 additions and 36 deletions

View File

@ -64,7 +64,7 @@ export default {
return { return {
userId:uni.getStorageSync('realNameUser').userId, userId:uni.getStorageSync('realNameUser').userId,
userName:uni.getStorageSync('realNameUser').userName, userName:uni.getStorageSync('realNameUser').userName,
idNumber:uni.getStorageSync('realNameUser').idNumber, idNumber:"",
proId:uni.getStorageSync('realNameUser').proId, proId:uni.getStorageSync('realNameUser').proId,
teamId:uni.getStorageSync('realNameUser').teamId, teamId:uni.getStorageSync('realNameUser').teamId,
teamList:[],// teamList:[],//
@ -135,7 +135,7 @@ export default {
success: res => { success: res => {
res = res.data; res = res.data;
if(res.code==200){ if(res.code==200){
console.log(res)
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)=>{
@ -214,10 +214,10 @@ export default {
// //
getWork(){ getWork(){
let param={ let param={
idNumber:this.idNumber proId:this.proId
} }
uni.request({ uni.request({
url: config.realAppUrl + '/BasePerson/downloadWorkPerson', url: config.realAppUrl + '/BasePerson/downloadTemporaryWorkPerson',
method: 'post', method: 'post',
data: param, data: param,
header: { header: {
@ -228,12 +228,45 @@ export default {
res = res.data; res = res.data;
if(res.code==200){ if(res.code==200){
console.log(res) console.log(res)
this.userData=res.data[0] if(res.data.length>0){
if(res.data[0].isToWork!="0"){ let userIndex = res.data.findIndex(v=>v.idNumber==this.idNumber)
this.isToWork=res.data[0].isToWork; console.log(userIndex)
} if(userIndex>-1){
if(res.data[0].isOffWork!="0"){ this.userData=res.data[userIndex]
this.isOffWork=res.data[0].isOffWork; console.log(this.userData)
if(this.userData.isToWork!="0"){
this.isToWork=this.userData.isToWork;
}
if(this.userData.isOffWork!="0"){
this.isOffWork=this.userData.isOffWork;
}
this.proId = this.userData.proId
let costTime=this.getTimeDiff(this.userData.isToWork,this.timeStr);
if(this.type==2&&this.userData.isToWork==0){
uni.$u.toast('还未打上班卡!');
}
// 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小时');
}else if(this.userData.lightStatus==0&&this.userData.attDayNum>7){
uni.$u.toast('红灯人员只能打7天卡');
}else if(this.userData.isFurloughPerson==1){
uni.$u.toast('暂退人员无法打卡!');
}else if(this.userData.workerType==1||this.userData.workerType==2){
uni.$u.toast('只有临时人员可在当前页面打卡!');
}else{
this.uploadAttendance()
}
}else{
uni.$u.toast('打卡人员不存在当前工程!');
}
}else{
uni.$u.toast('不存在临时人员!');
} }
} }
}, },
@ -292,34 +325,10 @@ export default {
if(uploadFileRes.code==200){ if(uploadFileRes.code==200){
if(uploadFileRes.data.face){ if(uploadFileRes.data.face){
this.faceData=JSON.parse(uploadFileRes.data.personData) this.faceData=JSON.parse(uploadFileRes.data.personData)
console.log(this.faceData)
if(this.faceData){ if(this.faceData){
// if(this.faceData.idNumber==this.idNumber){//
// this.idNumber=this.faceData.idNumber;
this.idNumber=this.faceData.idNumber; this.idNumber=this.faceData.idNumber;
this.getWork() this.getWork()
this.userName=this.faceData.name; this.userName=this.faceData.name;
this.proId=this.faceData.proId;
let costTime=this.getTimeDiff(this.userData.isToWork,this.timeStr);
if(this.type==2&&this.userData.isToWork==0){
uni.$u.toast('还未打上班卡!');
}
// 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(costTime<2){
uni.$u.toast('上下班打卡间隔2小时');
}else if(this.userData.lightStatus==0&&this.userData.attDayNum>7){
uni.$u.toast('红灯人员只能打7天卡');
}else if(this.userData.isFurloughPerson==1){
uni.$u.toast('暂退人员无法打卡!');
}else if(this.userData.workerType==1||this.userData.workerType==2){
uni.$u.toast('只有临时人员可在当前页面打卡!');
}else{
this.uploadAttendance()
}
// }else{ // }else{
// uni.$u.toast(''); // uni.$u.toast('');
// } // }