Browse Source

feat(checkIn):考勤页面迟到早退状态显示

HMY 1 year ago
parent
commit
c723346ed3
1 changed files with 26 additions and 6 deletions
  1. 26 6
      pages/mine/checkIn/checkIn.vue

+ 26 - 6
pages/mine/checkIn/checkIn.vue

@@ -28,15 +28,20 @@
 						<text class="ygoa-icon icon-day"></text>
 						<text class="value">晨签时间:</text>
 					</view>
-					<text class="label">{{ todayData.startTime || '未打卡' }} </text>
+					<view>
+						<text class="label">{{ todayData.startTime || '未打卡' }}</text>
+						<text class="att_status">{{todayData.startStatus}}</text>
+					</view>
 				</view>
 				<view class="info-row">
 					<view>
 						<text class="ygoa-icon icon-night"></text>
 						<text class="value">晚签时间:</text>
 					</view>
-
-					<text class="label">{{ todayData.endTime || '未打卡' }} </text>
+					<view>
+						<text class="label">{{ todayData.endTime || '未打卡' }}</text>
+						<text class="att_status">{{todayData.endStatus}}</text>
+					</view>
 				</view>
 
 			</view>
@@ -139,13 +144,17 @@
 	import {ref,onMounted,reactive} from 'vue';
 	import {checkAttendance,getMyTotalCount,getMyQDQtAttendance,getMyTotalMonthCount} from '@/api/mine.js'
 	import {useUserStore} from '@/store/user.js';
+	import { useConfigStore } from '@/store/config'
 	const userStore = useUserStore();
-
+	//考勤规则数据
+	const configStore = useConfigStore();
 	// 创建一个响应式对象记录今天的考勤数据
 	const todayData = reactive({
 		day: '', // 当前日期
 		startTime: '', // 晨签到时间
+		startStatus:'',//晨签状态
 		endTime: '', // 晚签到时间
+		endStatus:'',//晚签状态
 	})
 
 
@@ -232,8 +241,10 @@
 		checkAttendance(params).then(res => {
 			if ("success" == res.returnMsg) {
 				//数据初始化
-				todayData.startTime = '';
-				todayData.endTime = '';
+				todayData.startTime = ''
+				todayData.endTime = ''
+				todayData.startStatus=''
+				todayData.endStatus=''
 				if (res.returnParams.list.length == 0) {
 					return
 				}
@@ -262,9 +273,15 @@
 				
 				if (time1 !== undefined) {
 					todayData.startTime = time1.att_time.split(' ')[1];
+					if(todayData.startTime>configStore.signInTimeRange[1]){
+						todayData.startStatus='(迟到)'
+					}
 				}
 				if (time2 !== undefined) {
 					todayData.endTime = time2.att_time.split(' ')[1];
+					if(todayData.endTime<configStore.signOutTimeRange[0]){
+						todayData.endStatus='(早退)'
+					}
 				}
 			}
 		})
@@ -798,6 +815,9 @@
 		align-items: center;
 		justify-content: space-between;
 		margin-bottom: 10px;
+		.att_status{
+			color: red;
+		}
 	}