From 8a5e8bd9c98ce11dc41adfe511f43f2bb82061e4 Mon Sep 17 00:00:00 2001 From: zzyuan <781948537@qq.com> Date: Thu, 7 Nov 2024 20:03:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E4=BA=BA=E5=91=98=E6=89=93?= =?UTF-8?q?=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workAttendance/tempClock/index.vue | 81 ++++++++++--------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/pages/realName/workAttendance/tempClock/index.vue b/pages/realName/workAttendance/tempClock/index.vue index ebf6ded..98564d7 100644 --- a/pages/realName/workAttendance/tempClock/index.vue +++ b/pages/realName/workAttendance/tempClock/index.vue @@ -64,7 +64,7 @@ export default { return { userId:uni.getStorageSync('realNameUser').userId, userName:uni.getStorageSync('realNameUser').userName, - idNumber:uni.getStorageSync('realNameUser').idNumber, + idNumber:"", proId:uni.getStorageSync('realNameUser').proId, teamId:uni.getStorageSync('realNameUser').teamId, teamList:[],//打卡点列表 @@ -135,7 +135,7 @@ export default { success: res => { res = res.data; if(res.code==200){ - console.log(res) + this.teamList=res.data; if(this.teamList.length>0){ this.teamList.forEach((item,index)=>{ @@ -214,10 +214,10 @@ export default { //获取人员信息(打卡时间) getWork(){ let param={ - idNumber:this.idNumber + proId:this.proId } uni.request({ - url: config.realAppUrl + '/BasePerson/downloadWorkPerson', + url: config.realAppUrl + '/BasePerson/downloadTemporaryWorkPerson', method: 'post', data: param, header: { @@ -228,12 +228,45 @@ export default { res = res.data; if(res.code==200){ console.log(res) - this.userData=res.data[0] - if(res.data[0].isToWork!="0"){ - this.isToWork=res.data[0].isToWork; - } - if(res.data[0].isOffWork!="0"){ - this.isOffWork=res.data[0].isOffWork; + if(res.data.length>0){ + let userIndex = res.data.findIndex(v=>v.idNumber==this.idNumber) + console.log(userIndex) + if(userIndex>-1){ + this.userData=res.data[userIndex] + 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('不存在临时人员!'); } } }, @@ -291,35 +324,11 @@ export default { console.log(uploadFileRes) if(uploadFileRes.code==200){ if(uploadFileRes.data.face){ - this.faceData=JSON.parse(uploadFileRes.data.personData) - console.log(this.faceData) - if(this.faceData){ - // if(this.faceData.idNumber==this.idNumber){//人脸身份证号与登录身份证号相同 - // this.idNumber=this.faceData.idNumber; + this.faceData=JSON.parse(uploadFileRes.data.personData) + if(this.faceData){ this.idNumber=this.faceData.idNumber; this.getWork() 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{ // uni.$u.toast('不是本人!'); // }