1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2026-03-22 10:23:30 +00:00
Classworks/src/components/attendance/AttendanceSidebar.vue
chenziang fca33c1b95
feat(settings): 添加迟到学生是否计入出勤人数的显示设置
- 在设置工具中新增 display.lateStudentsArePresent 配置项
- 修改考勤侧边栏计算逻辑以支持迟到人数统计选项
- 更新作业网格组件中的出勤人数计算方式
- 添加设置导入功能到相关组件中
- 在显示设置卡片中增加新的配置选项界面
2026-01-11 07:34:34 +08:00

125 lines
3.0 KiB
Vue

<template>
<v-col
v-if="studentList && studentList.length"
v-ripple="!isEditingDisabled ? {
class: `text-${
['primary', 'secondary', 'info', 'success', 'warning', 'error'][
Math.floor(Math.random() * 6)
]
}`,
} : false"
:class="{ 'cursor-not-allowed': isEditingDisabled }"
class="attendance-area no-select"
cols="1"
@click="handleClick"
>
<h1>出勤</h1>
<h2>
<span style="white-space: nowrap"> 应到</span>
:
<span style="white-space: nowrap">
{{ studentList.length - attendance.exclude.length }}人
</span>
</h2>
<h2>
<span style="white-space: nowrap"> 实到</span>
:
<span style="white-space: nowrap">
{{
studentList.length -
attendance.absent.length -
(!getSetting("display.lateStudentsArePresent")) * attendance.late.length -
attendance.exclude.length
}}人
</span>
</h2>
<h2>
<span style="white-space: nowrap"> 请假</span>
:
<span style="white-space: nowrap">
{{ attendance.absent.length }}人
</span>
</h2>
<h3
v-for="(name, index) in attendance.absent"
:key="'absent-' + index"
class="gray-text"
>
<span v-if="display.lgAndUp.value">{{ `${index + 1}. ` }}</span
><span style="white-space: nowrap">{{ name }}</span>
</h3>
<h2>
<span style="white-space: nowrap">迟到</span>
:
<span style="white-space: nowrap">
{{ attendance.late.length }}人
</span>
</h2>
<h3
v-for="(name, index) in attendance.late"
:key="'late-' + index"
class="gray-text"
>
<span v-if="display.lgAndUp.value">{{ `${index + 1}. ` }}</span
><span style="white-space: nowrap">{{ name }}</span>
</h3>
<h2>
<span style="white-space: nowrap">不参与</span>
:
<span style="white-space: nowrap">
{{ attendance.exclude.length }}人
</span>
</h2>
<h3
v-for="(name, index) in attendance.exclude"
:key="'exclude-' + index"
class="gray-text"
>
<span v-if="display.lgAndUp.value">{{ `${index + 1}. ` }}</span
><span style="white-space: nowrap">{{ name }}</span>
</h3>
</v-col>
</template>
<script>
import { useDisplay } from "vuetify";
import {getSetting} from "@/utils/settings.js";
export default {
name: "AttendanceSidebar",
props: {
studentList: {
type: Array,
required: true,
},
attendance: {
type: Object,
required: true,
},
isEditingDisabled: {
type: Boolean,
default: false,
},
},
emits: ["click", "disabled-click"],
setup() {
const display = useDisplay();
return { display };
},
methods: {
getSetting,
handleClick() {
if (this.isEditingDisabled) {
this.$emit('disabled-click');
} else {
this.$emit('click');
}
},
},
};
</script>
<style scoped>
/* Add any specific styles here if needed, or rely on global styles */
</style>