fix(dorm): 假期留宿按时刻判定,点名可同时显示请假与留宿
结束时刻过后不再整天标留宿;请假与假期留宿可同时展示,标签仅显示状态名。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
df4c21bd0d
commit
845c7fd942
8 files changed
+169
-97
No files matched your search
@@ -22,19 +22,31 @@
|
||||
<el-table-column label="床位" prop="bedName" width="70" />
|
||||
<el-table-column label="姓名" prop="studentName" width="80" />
|
||||
<el-table-column label="学号" prop="studentNo" width="120" />
|
||||
<el-table-column label="状态" prop="rollCallStatus" width="90">
|
||||
<el-table-column label="状态" prop="rollCallStatus" width="160">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.rollCallStatus === '0'" type="success" size="small">在寝</el-tag>
|
||||
<el-tag v-else-if="scope.row.rollCallStatus === '1'" type="warning" size="small">请假</el-tag>
|
||||
<el-tag v-else-if="scope.row.rollCallStatus === '4'" type="primary" size="small">假期留宿</el-tag>
|
||||
<template v-if="scope.row.leaveId || scope.row.rollCallStatus === '1' || scope.row.holidayStayId || scope.row.rollCallStatus === '4'">
|
||||
<el-tag v-if="scope.row.leaveId || scope.row.rollCallStatus === '1'" type="warning" size="small">请假</el-tag>
|
||||
<el-tag
|
||||
v-if="scope.row.holidayStayId || scope.row.rollCallStatus === '4'"
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-left: 4px"
|
||||
>假期留宿</el-tag>
|
||||
</template>
|
||||
<el-tag v-else-if="scope.row.rollCallStatus === '0'" type="success" size="small">在寝</el-tag>
|
||||
<el-tag v-else-if="scope.row.rollCallStatus === '2'" type="danger" size="small">不在</el-tag>
|
||||
<el-tag v-else type="info" size="small">空床位</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注信息" min-width="120">
|
||||
<el-table-column label="备注信息" min-width="140">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.leaveTypeName">{{ scope.row.leaveTypeName }}</span>
|
||||
<span v-else-if="scope.row.holidayType || scope.row.holidayStayId">假期留宿{{ scope.row.holidayType ? `(${scope.row.holidayType})` : '' }}</span>
|
||||
<span v-if="scope.row.leaveTypeName || scope.row.holidayType || scope.row.holidayStayId">
|
||||
<template v-if="scope.row.leaveTypeName">{{ scope.row.leaveTypeName }}</template>
|
||||
<template v-if="scope.row.leaveTypeName && (scope.row.holidayType || scope.row.holidayStayId)"> / </template>
|
||||
<template v-if="scope.row.holidayType || scope.row.holidayStayId">
|
||||
假期留宿{{ scope.row.holidayType ? `(${scope.row.holidayType})` : '' }}
|
||||
</template>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -15,14 +15,13 @@
|
||||
<div class="student-no">{{ bed.studentNo }}</div>
|
||||
</div>
|
||||
<div v-else class="empty-bed">空床位</div>
|
||||
<div v-if="bed.leaveId" class="leave-info">
|
||||
<el-tag type="warning" size="small">{{ bed.leaveTypeName || '请假' }}</el-tag>
|
||||
<div v-if="bed.leaveId || bed.holidayStayId" class="leave-info">
|
||||
<!-- 只展示状态名,不展示请假类型(如「其他假」) -->
|
||||
<el-tag v-if="bed.leaveId" type="warning" size="small">请假</el-tag>
|
||||
<el-tag v-if="bed.holidayStayId" type="primary" size="small" style="margin-left: 4px">假期留宿</el-tag>
|
||||
</div>
|
||||
<div v-else-if="bed.holidayStayId" class="leave-info">
|
||||
<el-tag type="primary" size="small">假期留宿</el-tag>
|
||||
</div>
|
||||
<div class="status-label">
|
||||
{{ getStatusLabel(bed.rollCallStatus) }}
|
||||
<div v-if="!bed.leaveId && !bed.holidayStayId" class="status-label">
|
||||
{{ getStatusLabel(bed) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -88,16 +87,26 @@ const summary = computed(() => {
|
||||
let present = 0, leave = 0, holidayStay = 0, absent = 0, empty = 0;
|
||||
bedDetails.value.forEach(bed => {
|
||||
const status = bed.rollCallStatus;
|
||||
if (status === '0') present++;
|
||||
else if (status === '1') leave++;
|
||||
else if (status === '4') holidayStay++;
|
||||
else if (status === '2') absent++;
|
||||
else if (status === '3') empty++;
|
||||
if (status === '3') {
|
||||
empty++;
|
||||
return;
|
||||
}
|
||||
if (status === '2') {
|
||||
absent++;
|
||||
return;
|
||||
}
|
||||
if (status === '0') {
|
||||
present++;
|
||||
return;
|
||||
}
|
||||
if (bed.isLeaveAuto || status === '1') leave++;
|
||||
if (bed.isHolidayStayAuto || status === '4') holidayStay++;
|
||||
});
|
||||
return { present, leave, holidayStay, absent, empty };
|
||||
});
|
||||
|
||||
const getBedCardClass = (bed: BedItem) => {
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave';
|
||||
const status = bed.rollCallStatus;
|
||||
if (status === '0') return 'bed-present';
|
||||
if (status === '1') return 'bed-leave';
|
||||
@@ -107,7 +116,11 @@ const getBedCardClass = (bed: BedItem) => {
|
||||
return '';
|
||||
};
|
||||
|
||||
const getStatusLabel = (status?: string) => {
|
||||
const getStatusLabel = (bed: BedItem | string) => {
|
||||
if (typeof bed !== 'string' && bed.isLeaveAuto && bed.isHolidayStayAuto) {
|
||||
return '请假+假期留宿';
|
||||
}
|
||||
const status = typeof bed === 'string' ? bed : bed.rollCallStatus;
|
||||
if (status === '0') return '在寝';
|
||||
if (status === '1') return '请假';
|
||||
if (status === '4') return '假期留宿';
|
||||
@@ -117,12 +130,14 @@ const getStatusLabel = (status?: string) => {
|
||||
};
|
||||
|
||||
const handleBedClick = (bed: BedItem) => {
|
||||
if (bed.isLeaveAuto) {
|
||||
ElMessage.info('该学生处于请假状态,不可修改');
|
||||
return;
|
||||
}
|
||||
if (bed.isHolidayStayAuto) {
|
||||
ElMessage.info('该学生处于假期留宿状态,不可修改');
|
||||
if (bed.isLeaveAuto || bed.isHolidayStayAuto) {
|
||||
ElMessage.info(
|
||||
bed.isLeaveAuto && bed.isHolidayStayAuto
|
||||
? '该学生同时处于请假与假期留宿,不可修改'
|
||||
: bed.isLeaveAuto
|
||||
? '该学生处于请假状态,不可修改'
|
||||
: '该学生处于假期留宿状态,不可修改'
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!bed.studentId) {
|
||||
@@ -206,20 +221,26 @@ const loadBedDetails = async () => {
|
||||
|
||||
if (!bed.studentId) {
|
||||
bed.rollCallStatus = '3';
|
||||
} else if (item.leaveInfo) {
|
||||
bed.rollCallStatus = '1';
|
||||
bed.isLeaveAuto = true;
|
||||
bed.leaveId = item.leaveInfo.leaveId;
|
||||
bed.leaveTypeName = item.leaveInfo.leaveTypeName;
|
||||
bed.leaveStartTime = item.leaveInfo.leaveStartTime;
|
||||
bed.leaveEndTime = item.leaveInfo.leaveEndTime;
|
||||
} else if (item.holidayStayInfo) {
|
||||
bed.rollCallStatus = '4';
|
||||
bed.isHolidayStayAuto = true;
|
||||
bed.holidayStayId = item.holidayStayInfo.holidayStayId;
|
||||
bed.holidayType = item.holidayStayInfo.holidayType;
|
||||
bed.holidayStartDate = item.holidayStayInfo.applyStartDate;
|
||||
bed.holidayEndDate = item.holidayStayInfo.applyEndDate;
|
||||
} else {
|
||||
if (item.leaveInfo) {
|
||||
bed.isLeaveAuto = true;
|
||||
bed.leaveId = item.leaveInfo.leaveId;
|
||||
bed.leaveTypeName = item.leaveInfo.leaveTypeName;
|
||||
bed.leaveStartTime = item.leaveInfo.leaveStartTime;
|
||||
bed.leaveEndTime = item.leaveInfo.leaveEndTime;
|
||||
}
|
||||
if (item.holidayStayInfo) {
|
||||
bed.isHolidayStayAuto = true;
|
||||
bed.holidayStayId = item.holidayStayInfo.holidayStayId;
|
||||
bed.holidayType = item.holidayStayInfo.holidayType;
|
||||
bed.holidayStartDate = item.holidayStayInfo.applyStartDate;
|
||||
bed.holidayEndDate = item.holidayStayInfo.applyEndDate;
|
||||
}
|
||||
if (bed.isLeaveAuto) {
|
||||
bed.rollCallStatus = '1';
|
||||
} else if (bed.isHolidayStayAuto) {
|
||||
bed.rollCallStatus = '4';
|
||||
}
|
||||
}
|
||||
|
||||
bed.originalStatus = bed.rollCallStatus;
|
||||
|
||||
Reference in new issue
Block a user