调整选课点名,修复状态问题,增加迟到状态计数
This commit is contained in:
parent
d69bf5e937
commit
d256372289
@ -28,6 +28,10 @@
|
||||
<text class="font-18 font-bold cor-danger">{{ dmInfo.qqRs }}</text>
|
||||
<text class="font-12 cor-666 mt-3">缺勤</text>
|
||||
</view>
|
||||
<view class="stat-item flex-col items-center">
|
||||
<text class="font-18 font-bold cor-danger">{{ dmInfo.cdRs }}</text>
|
||||
<text class="font-12 cor-666 mt-3">迟到</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -164,7 +168,8 @@ const dmInfo = ref<any>({
|
||||
zrs: 0,
|
||||
sdRs: 0,
|
||||
qjRs: 0,
|
||||
qqRs: 0
|
||||
qqRs: 0,
|
||||
cdRs: 0,
|
||||
});
|
||||
// 学生列表 - 匹配后端XkDmXs实体字段
|
||||
const xsList = ref<any[]>([]);
|
||||
@ -197,6 +202,9 @@ const getStatusClass = (status: string) => {
|
||||
case "C":
|
||||
case "缺勤":
|
||||
return "status-absent";
|
||||
case "F":
|
||||
case "迟到":
|
||||
return "status-overtime";
|
||||
default:
|
||||
return "status-normal";
|
||||
}
|
||||
@ -211,6 +219,8 @@ const getStatusText = (status: string) => {
|
||||
return "请假";
|
||||
case "C":
|
||||
return "缺勤";
|
||||
case "F":
|
||||
return "迟到";
|
||||
default:
|
||||
return status || "正常";
|
||||
}
|
||||
@ -219,16 +229,23 @@ const getStatusText = (status: string) => {
|
||||
// 获取学生状态选项
|
||||
const loadStatusOptions = async () => {
|
||||
try {
|
||||
// 使用默认状态 - 匹配后端字段
|
||||
statusOptions.value = [
|
||||
{text: "正常", value: "A"},
|
||||
{text: "请假", value: "B"},
|
||||
{text: "缺勤", value: "C"},
|
||||
{text: "迟到", value: "F"},
|
||||
];
|
||||
// 假设字典表中考勤状态的pid为763939514,根据实际情况修改
|
||||
const res = await findByPid({pid: 763939514});
|
||||
if (res && res.result) {
|
||||
statusOptions.value = res.result.map((item: any) => {
|
||||
return {
|
||||
text: item.dictionaryValue,
|
||||
value: item.dictionaryCode
|
||||
};
|
||||
});
|
||||
}
|
||||
// const res = await findByPid({pid: 763939514});
|
||||
// if (res && res.result) {
|
||||
// statusOptions.value = res.result.map((item: any) => {
|
||||
// return {
|
||||
// text: item.dictionaryValue,
|
||||
// value: item.dictionaryCode
|
||||
// };
|
||||
// });
|
||||
// }
|
||||
} catch (error) {
|
||||
console.error("获取状态选项失败", error);
|
||||
// 使用默认状态 - 匹配后端字段
|
||||
@ -281,6 +298,7 @@ const rebuildNumInfo = () => {
|
||||
let sd = 0;
|
||||
let qj = 0;
|
||||
let qq = 0;
|
||||
let cd = 0;
|
||||
|
||||
// 循环统计状态对应的人数
|
||||
for (let i = 0; i < xsList.value.length; i++) {
|
||||
@ -300,6 +318,10 @@ const rebuildNumInfo = () => {
|
||||
case "缺勤":
|
||||
qq++;
|
||||
break;
|
||||
case "F":
|
||||
case "迟到":
|
||||
cd++;
|
||||
break;
|
||||
default:
|
||||
sd++; // 默认算作正常
|
||||
break;
|
||||
@ -308,6 +330,7 @@ const rebuildNumInfo = () => {
|
||||
dmInfo.value.sdRs = sd; // 实到人数
|
||||
dmInfo.value.qjRs = qj; // 请假人数
|
||||
dmInfo.value.qqRs = qq; // 缺勤人数
|
||||
dmInfo.value.cdRs = cd; // 缺勤人数
|
||||
};
|
||||
|
||||
// 打开状态选择器
|
||||
|
||||
@ -71,6 +71,10 @@
|
||||
<text class="stat-number">{{ data.qqRs || 0 }}</text>
|
||||
<text class="stat-label">缺勤</text>
|
||||
</view>
|
||||
<view class="stat-item overtime">
|
||||
<text class="stat-number">{{ data.cdRs || 0 }}</text>
|
||||
<text class="stat-label">迟到</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="record-footer">
|
||||
@ -447,7 +451,7 @@ onMounted(() => {
|
||||
|
||||
.record-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 10px;
|
||||
margin-bottom: 15px;
|
||||
|
||||
|
||||
@ -50,6 +50,14 @@
|
||||
<view class="stat-number">{{ safeDmRecord.qqRs || 0 }}</view>
|
||||
<view class="stat-label">缺勤</view>
|
||||
</view>
|
||||
<view
|
||||
class="stat-item absent"
|
||||
:class="{ active: currentFilter === 'F' }"
|
||||
@click="setFilter('F')"
|
||||
>
|
||||
<view class="stat-number">{{ safeDmRecord.cdRs || 0 }}</view>
|
||||
<view class="stat-label">迟到</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -180,6 +188,8 @@ const getStatusClass = (status: string) => {
|
||||
case '请假': return 'status-leave';
|
||||
case 'C':
|
||||
case '缺勤': return 'status-absent';
|
||||
case 'F':
|
||||
case '迟到': return 'status-overtime';
|
||||
default: return 'status-normal';
|
||||
}
|
||||
};
|
||||
@ -190,6 +200,7 @@ const getStatusText = (status: string) => {
|
||||
case 'A': return '正常';
|
||||
case 'B': return '请假';
|
||||
case 'C': return '缺勤';
|
||||
case 'F': return '迟到';
|
||||
default: return status || '正常';
|
||||
}
|
||||
};
|
||||
@ -292,14 +303,14 @@ onMounted(() => {
|
||||
.attendance-stats {
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 20rpx;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 20rpx 0;
|
||||
padding-bottom: 20rpx;
|
||||
text-align: center;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
||||
cursor: pointer;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user