feat(xg): 请假审批修复、点名今日汇总与寝室扣分条例脚本
同步请假/销假审批上下文与状态、宿舍点名今日汇总与假期留宿标识,并补充寝室检查扣分条例生产 SQL 与执行说明。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3e6349112c
commit
7cea0566ac
48 files changed
+1966
-116
No files matched your search
@@ -8,6 +8,14 @@ export const listDormRollCall = (query) => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 当前账号当天点名汇总 */
|
||||
export const getTodayRollCallSummary = () => {
|
||||
return request({
|
||||
url: '/dormRollCall/dormRollCall/todaySummary',
|
||||
method: 'GET'
|
||||
});
|
||||
};
|
||||
|
||||
export const getDormRollCall = (id) => {
|
||||
return request({
|
||||
url: '/dormRollCall/dormRollCall/' + id,
|
||||
|
||||
@@ -69,6 +69,11 @@ export default {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
/** 当前用户是否有可办审批待办(优先于 status===waiting) */
|
||||
canApprove: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
// 校验提交按钮是否显示(与Web端逻辑完全一致)
|
||||
@@ -81,8 +86,11 @@ export default {
|
||||
);
|
||||
},
|
||||
|
||||
// 校验审批按钮是否显示(与Web端逻辑完全一致)
|
||||
// 审批按钮:有待办可审,或传统 pageType=approval + waiting
|
||||
approvalButtonShow() {
|
||||
if (this.canApprove) {
|
||||
return true;
|
||||
}
|
||||
return this.pageType === 'approval' && this.status && this.status === 'waiting';
|
||||
},
|
||||
},
|
||||
|
||||
@@ -127,20 +127,41 @@
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="card-actions">
|
||||
<u-button
|
||||
@click="handleApproval(item)"
|
||||
type="primary"
|
||||
size="small"
|
||||
shape="circle"
|
||||
>
|
||||
<u-icon
|
||||
name="edit-pen"
|
||||
size="16"
|
||||
color="#fff"
|
||||
style="margin-right: 8rpx"
|
||||
></u-icon>
|
||||
办理
|
||||
</u-button>
|
||||
<view class="action-btn">
|
||||
<u-button
|
||||
@click.stop="handleApproval(item)"
|
||||
type="primary"
|
||||
size="small"
|
||||
shape="circle"
|
||||
:custom-style="actionButtonStyle"
|
||||
>
|
||||
<u-icon
|
||||
name="edit-pen"
|
||||
size="16"
|
||||
color="#fff"
|
||||
style="margin-right: 8rpx"
|
||||
></u-icon>
|
||||
办理
|
||||
</u-button>
|
||||
</view>
|
||||
<!-- 列表直接审批:仅本页弹窗,不跳转业务页 -->
|
||||
<view class="action-btn">
|
||||
<u-button
|
||||
@click.stop="handleDirectApprove(item)"
|
||||
type="warning"
|
||||
size="small"
|
||||
shape="circle"
|
||||
:custom-style="actionButtonStyle"
|
||||
>
|
||||
<u-icon
|
||||
name="checkmark"
|
||||
size="16"
|
||||
color="#fff"
|
||||
style="margin-right: 8rpx"
|
||||
></u-icon>
|
||||
审批
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -231,15 +252,22 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<!-- 待办直接审批:与业务表单里的审批弹窗是同一个组件 -->
|
||||
<submit-verify ref="submitVerifyRef" @submit-callback="handleApproveCallback" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request } from '@/common/request.js';
|
||||
import { getDict, getDictTagType } from '@/common/dict.js';
|
||||
import SubmitVerify from '@/components/Process/submitVerify.vue';
|
||||
|
||||
export default {
|
||||
name: 'TaskWaiting',
|
||||
components: {
|
||||
SubmitVerify,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -271,6 +299,12 @@ export default {
|
||||
userSearchKeyword: '', // 用户搜索关键词
|
||||
userSearchTimer: null, // 搜索防抖定时器
|
||||
|
||||
actionButtonStyle: {
|
||||
width: '100%',
|
||||
height: '72rpx',
|
||||
margin: '0',
|
||||
},
|
||||
|
||||
// 用户列表分页参数
|
||||
userListParams: {
|
||||
pageNum: 1,
|
||||
@@ -491,6 +525,25 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 直接打开审批弹窗(复用 submitVerify),不进入业务办理页
|
||||
handleDirectApprove(row) {
|
||||
if (!row || row.id == null || row.id === '') {
|
||||
uni.showToast({ title: '缺少任务信息,无法审批', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const verifyRef = this.$refs.submitVerifyRef;
|
||||
if (!verifyRef || typeof verifyRef.openDialog !== 'function') {
|
||||
uni.showToast({ title: '审批组件未就绪', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
verifyRef.openDialog(row.id);
|
||||
},
|
||||
|
||||
// 审批成功:刷新待办列表,停留在本页(不跳转请假列表等业务页)
|
||||
handleApproveCallback() {
|
||||
this.handleQuery();
|
||||
},
|
||||
|
||||
// 办理任务
|
||||
handleApproval(row) {
|
||||
console.log('办理任务:', row);
|
||||
@@ -863,11 +916,17 @@ export default {
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
padding: 20rpx;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
// 申请人选择弹窗样式
|
||||
.user-select-popup {
|
||||
background-color: #fff;
|
||||
|
||||
@@ -461,6 +461,7 @@
|
||||
:page-type="routeParams.type"
|
||||
:task-id="routeParams.taskId"
|
||||
:button-loading="buttonLoading"
|
||||
:can-approve="canApprove"
|
||||
@submitForm="handleSubmitForm"
|
||||
@approvalVerifyOpen="handleApprovalVerifyOpen"
|
||||
@handleApprovalRecord="handleApprovalRecord"
|
||||
@@ -547,6 +548,7 @@ export default {
|
||||
return {
|
||||
routeParams: {},
|
||||
buttonLoading: false,
|
||||
canApprove: false,
|
||||
|
||||
// 流程相关
|
||||
showFlowSelectionPopup: false,
|
||||
@@ -718,6 +720,7 @@ export default {
|
||||
// 如已有销假记录,加载详情
|
||||
if (this.cancelForm.id) {
|
||||
await this.getCancelLeaveDetail(this.cancelForm.id);
|
||||
await this.ensureApprovalCapability(this.cancelForm.id);
|
||||
} else {
|
||||
// 用请假记录中的已存在销假信息初始化
|
||||
Object.assign(this.cancelForm, {
|
||||
@@ -737,6 +740,37 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 以流程引擎待办为准刷新销假审批能力
|
||||
*/
|
||||
async ensureApprovalCapability(cancelLeaveId) {
|
||||
try {
|
||||
this.canApprove = false;
|
||||
if (!cancelLeaveId) {
|
||||
return;
|
||||
}
|
||||
const resp = await request({
|
||||
url: `/workflow/instance/approvalContext/${cancelLeaveId}`,
|
||||
method: 'GET',
|
||||
});
|
||||
const ctx = (resp && resp.data) || {};
|
||||
if (ctx.suggestedBusinessStatus) {
|
||||
this.cancelForm.status = ctx.suggestedBusinessStatus;
|
||||
this.leaveInfo.cancelStatus = ctx.suggestedBusinessStatus;
|
||||
}
|
||||
if (ctx.canApprove) {
|
||||
this.canApprove = true;
|
||||
this.routeParams = {
|
||||
...this.routeParams,
|
||||
type: 'approval',
|
||||
taskId: ctx.taskId != null ? String(ctx.taskId) : this.routeParams.taskId,
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('销假审批上下文检查失败(不影响查看):', e);
|
||||
}
|
||||
},
|
||||
|
||||
async getLeaveDetail(id) {
|
||||
try {
|
||||
const response = await request({
|
||||
|
||||
@@ -145,14 +145,14 @@
|
||||
<!-- 请假信息 -->
|
||||
<view class="info-section">
|
||||
<text class="section-title">请假信息</text>
|
||||
<!-- 请假开始时间和结束时间分两行显示 -->
|
||||
<view class="info-item">
|
||||
<text class="label">开始时间:</text>
|
||||
<text class="value">{{ item.startTime || '-' }}</text>
|
||||
<!-- 请假开始时间和结束时间分两行显示,字号加大方便门岗查看 -->
|
||||
<view class="info-item time-item">
|
||||
<text class="label time-label">开始时间:</text>
|
||||
<text class="value time-value">{{ item.startTime || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">结束时间:</text>
|
||||
<text class="value">{{ item.endTime || '-' }}</text>
|
||||
<view class="info-item time-item">
|
||||
<text class="label time-label">结束时间:</text>
|
||||
<text class="value time-value">{{ item.endTime || '-' }}</text>
|
||||
</view>
|
||||
<!-- 请假天数和是否离校放一行 -->
|
||||
<view class="info-item-row">
|
||||
@@ -359,6 +359,8 @@ export default {
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
approvalStatus: '', // 默认显示全部状态
|
||||
// 排除销假审批已完成(finish / 旧值 1),仅本页使用
|
||||
excludeFinishedCancel: true,
|
||||
},
|
||||
|
||||
// 时间显示
|
||||
@@ -1129,12 +1131,25 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.time-item {
|
||||
align-items: center;
|
||||
background-color: #fff7e6;
|
||||
border-radius: 8rpx;
|
||||
padding: 10rpx 12rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 26rpx;
|
||||
color: #606266;
|
||||
min-width: 140rpx;
|
||||
margin-right: 16rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
&.time-label {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
@@ -1165,6 +1180,13 @@ export default {
|
||||
&.reason {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
&.time-value {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #d4380d;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
// 操作按钮
|
||||
|
||||
@@ -459,6 +459,7 @@
|
||||
:page-type="routeParams.type"
|
||||
:task-id="routeParams.taskId"
|
||||
:button-loading="buttonLoading"
|
||||
:can-approve="canApprove"
|
||||
@submitForm="handleSubmitForm"
|
||||
@approvalVerifyOpen="handleApprovalVerifyOpen"
|
||||
@handleApprovalRecord="handleApprovalRecord"
|
||||
@@ -540,7 +541,6 @@ import SubmitVerify from '@/components/Process/submitVerify.vue';
|
||||
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
|
||||
import weChatSDK from '@/utils/wechat.js';
|
||||
import { downloadFile } from '@/common/request.js';
|
||||
|
||||
export default {
|
||||
name: 'LeaveEdit',
|
||||
components: {
|
||||
@@ -552,6 +552,7 @@ export default {
|
||||
return {
|
||||
routeParams: {},
|
||||
buttonLoading: false,
|
||||
canApprove: false,
|
||||
showLeaveTypePicker: false,
|
||||
showStartTimePicker: false,
|
||||
showEndTimePicker: false,
|
||||
@@ -1071,6 +1072,7 @@ export default {
|
||||
const leaveInfo = response.data;
|
||||
Object.assign(this.form, leaveInfo);
|
||||
this.form.status = leaveInfo.approvalStatus;
|
||||
await this.ensureApprovalCapability(id);
|
||||
|
||||
// 同步时间值到选择器
|
||||
this.startTimeValue = this.form.startTime
|
||||
@@ -1099,6 +1101,34 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 以流程引擎待办为准刷新审批能力(覆盖 draft/back 残留导致无按钮)
|
||||
*/
|
||||
async ensureApprovalCapability(leaveId) {
|
||||
try {
|
||||
this.canApprove = false;
|
||||
const resp = await request({
|
||||
url: `/workflow/instance/approvalContext/${leaveId}`,
|
||||
method: 'GET',
|
||||
});
|
||||
const ctx = (resp && resp.data) || {};
|
||||
if (ctx.suggestedBusinessStatus) {
|
||||
this.form.approvalStatus = ctx.suggestedBusinessStatus;
|
||||
this.form.status = ctx.suggestedBusinessStatus;
|
||||
}
|
||||
if (ctx.canApprove) {
|
||||
this.canApprove = true;
|
||||
this.routeParams = {
|
||||
...this.routeParams,
|
||||
type: 'approval',
|
||||
taskId: ctx.taskId != null ? String(ctx.taskId) : this.routeParams.taskId,
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('请假审批上下文检查失败(不影响查看):', e);
|
||||
}
|
||||
},
|
||||
|
||||
// 获取附件文件
|
||||
async getAttachmentFiles(ossIds) {
|
||||
try {
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
<view v-if="bed.isLeaveAuto" class="leave-tag">
|
||||
<u-tag text="请假" type="warning" size="mini"></u-tag>
|
||||
</view>
|
||||
<view v-else-if="bed.isHolidayStayAuto" class="leave-tag">
|
||||
<u-tag text="假期留宿" type="primary" size="mini"></u-tag>
|
||||
</view>
|
||||
<view class="status-label" :class="getStatusColorClass(bed.rollCallStatus)">
|
||||
{{ getStatusLabel(bed.rollCallStatus) }}
|
||||
</view>
|
||||
@@ -40,6 +43,10 @@
|
||||
<text class="summary-label">请假:</text>
|
||||
<text class="summary-value leave-count">{{ summary.leave }}</text>
|
||||
</view>
|
||||
<view class="summary-item">
|
||||
<text class="summary-label">留宿:</text>
|
||||
<text class="summary-value holiday-stay-count">{{ summary.holidayStay }}</text>
|
||||
</view>
|
||||
<view class="summary-item">
|
||||
<text class="summary-label">不在:</text>
|
||||
<text class="summary-value absent-count">{{ summary.absent }}</text>
|
||||
@@ -53,7 +60,7 @@
|
||||
<!-- 提示文字 -->
|
||||
<view v-if="bedDetails.length > 0" class="hint-bar">
|
||||
<u-icon name="info-circle" color="#909399" size="14"></u-icon>
|
||||
<text class="hint-text">点击床位切换"在寝"和"不在"状态,请假不可修改</text>
|
||||
<text class="hint-text">点击床位切换"在寝"和"不在"状态,请假/假期留宿不可修改</text>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
@@ -102,15 +109,16 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
summary() {
|
||||
let present = 0, leave = 0, absent = 0, empty = 0;
|
||||
let present = 0, leave = 0, holidayStay = 0, absent = 0, empty = 0;
|
||||
this.bedDetails.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++;
|
||||
});
|
||||
return { present, leave, absent, empty };
|
||||
return { present, leave, holidayStay, absent, empty };
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
@@ -177,7 +185,7 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
// 5. 映射为统一格式,并处理点名状态与请假信息
|
||||
// 5. 映射为统一格式,并处理点名状态、请假、假期留宿
|
||||
this.bedDetails = mergedList.map((item) => {
|
||||
const bed = {
|
||||
bedId: item.bedId || item.id,
|
||||
@@ -194,21 +202,34 @@ export default {
|
||||
collegeName: item.collegeName,
|
||||
rollCallStatus: '0',
|
||||
isLeaveAuto: false,
|
||||
isHolidayStayAuto: false,
|
||||
leaveId: null,
|
||||
leaveTypeName: null,
|
||||
leaveStartTime: null,
|
||||
leaveEndTime: null,
|
||||
holidayStayId: null,
|
||||
holidayType: null,
|
||||
holidayStartDate: null,
|
||||
holidayEndDate: null,
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return bed;
|
||||
@@ -231,6 +252,7 @@ export default {
|
||||
getBedCardClass(bed) {
|
||||
if (bed.rollCallStatus === '0') return 'bed-present';
|
||||
if (bed.rollCallStatus === '1') return 'bed-leave';
|
||||
if (bed.rollCallStatus === '4') return 'bed-holiday-stay';
|
||||
if (bed.rollCallStatus === '2') return 'bed-absent';
|
||||
if (bed.rollCallStatus === '3') return 'bed-empty';
|
||||
return '';
|
||||
@@ -239,6 +261,7 @@ export default {
|
||||
getStatusLabel(status) {
|
||||
if (status === '0') return '在寝';
|
||||
if (status === '1') return '请假';
|
||||
if (status === '4') return '假期留宿';
|
||||
if (status === '2') return '不在';
|
||||
if (status === '3') return '空床位';
|
||||
return '';
|
||||
@@ -247,6 +270,7 @@ export default {
|
||||
getStatusColorClass(status) {
|
||||
if (status === '0') return 'color-present';
|
||||
if (status === '1') return 'color-leave';
|
||||
if (status === '4') return 'color-holiday-stay';
|
||||
if (status === '2') return 'color-absent';
|
||||
if (status === '3') return 'color-empty';
|
||||
return '';
|
||||
@@ -257,6 +281,10 @@ export default {
|
||||
uni.showToast({ title: '该学生处于请假状态,不可修改', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (bed.isHolidayStayAuto) {
|
||||
uni.showToast({ title: '该学生处于假期留宿状态,不可修改', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!bed.studentId) {
|
||||
return;
|
||||
}
|
||||
@@ -297,6 +325,10 @@ export default {
|
||||
leaveTypeName: bed.leaveTypeName,
|
||||
leaveStartTime: bed.leaveStartTime,
|
||||
leaveEndTime: bed.leaveEndTime,
|
||||
holidayStayId: bed.holidayStayId,
|
||||
holidayType: bed.holidayType,
|
||||
holidayStartDate: bed.holidayStartDate,
|
||||
holidayEndDate: bed.holidayEndDate,
|
||||
}));
|
||||
|
||||
const submitData = {
|
||||
@@ -308,6 +340,7 @@ export default {
|
||||
totalBeds: this.bedDetails.length,
|
||||
presentCount: this.summary.present,
|
||||
leaveCount: this.summary.leave,
|
||||
holidayStayCount: this.summary.holidayStay,
|
||||
absentCount: this.summary.absent,
|
||||
emptyCount: this.summary.empty,
|
||||
details,
|
||||
@@ -364,6 +397,10 @@ export default {
|
||||
background-color: #fff8e1;
|
||||
border-color: #e6a23c;
|
||||
}
|
||||
.bed-holiday-stay {
|
||||
background-color: #ecf5ff;
|
||||
border-color: #409eff;
|
||||
}
|
||||
.bed-absent {
|
||||
background-color: #ffebee;
|
||||
border-color: #f56c6c;
|
||||
@@ -419,6 +456,9 @@ export default {
|
||||
.color-leave {
|
||||
color: #e6a23c;
|
||||
}
|
||||
.color-holiday-stay {
|
||||
color: #409eff;
|
||||
}
|
||||
.color-absent {
|
||||
color: #f56c6c;
|
||||
}
|
||||
@@ -458,6 +498,9 @@ export default {
|
||||
.leave-count {
|
||||
color: #e6a23c;
|
||||
}
|
||||
.holiday-stay-count {
|
||||
color: #409eff;
|
||||
}
|
||||
.absent-count {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,39 @@
|
||||
<u-loading-page :loading="pageLoading && list.length === 0" loading-text="加载中..."></u-loading-page>
|
||||
|
||||
<view v-if="!pageLoading || list.length > 0" class="content-container">
|
||||
<!-- 当天点名汇总 -->
|
||||
<view class="today-summary-card">
|
||||
<view class="summary-header">
|
||||
<text class="summary-title">今日点名汇总</text>
|
||||
<text class="summary-date">{{ todayLabel }}</text>
|
||||
</view>
|
||||
<view class="summary-grid">
|
||||
<view class="summary-item">
|
||||
<text class="summary-num">{{ todaySummary.checkedRoomCount || 0 }}</text>
|
||||
<text class="summary-label">已点名寝室</text>
|
||||
</view>
|
||||
<view class="summary-item">
|
||||
<text class="summary-num">{{ todaySummary.uncheckedRoomCount || 0 }}</text>
|
||||
<text class="summary-label">未点名寝室</text>
|
||||
</view>
|
||||
<view class="summary-item clickable" @click="openDetailPopup('leave')">
|
||||
<text class="summary-num summary-num--leave">{{ todaySummary.leaveCount || 0 }}</text>
|
||||
<text class="summary-label">请假</text>
|
||||
<text class="summary-tip">点击明细</text>
|
||||
</view>
|
||||
<view class="summary-item clickable" @click="openDetailPopup('holidayStay')">
|
||||
<text class="summary-num summary-num--holiday">{{ todaySummary.holidayStayCount || 0 }}</text>
|
||||
<text class="summary-label">假期留宿</text>
|
||||
<text class="summary-tip">点击明细</text>
|
||||
</view>
|
||||
<view class="summary-item clickable" @click="openDetailPopup('absent')">
|
||||
<text class="summary-num summary-num--absent">{{ todaySummary.absentCount || 0 }}</text>
|
||||
<text class="summary-label">异常</text>
|
||||
<text class="summary-tip">点击明细</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<view v-if="list.length > 0" class="list-section">
|
||||
<view v-for="item in list" :key="item.id" class="check-card" @click="handleView(item)">
|
||||
@@ -87,6 +120,10 @@
|
||||
<text class="stat-num">{{ item.leaveCount || 0 }}</text>
|
||||
<text class="stat-label">请假</text>
|
||||
</view>
|
||||
<view class="stat-item stat-holiday-stay">
|
||||
<text class="stat-num">{{ item.holidayStayCount || 0 }}</text>
|
||||
<text class="stat-label">留宿</text>
|
||||
</view>
|
||||
<view class="stat-item stat-absent">
|
||||
<text class="stat-num">{{ item.absentCount || 0 }}</text>
|
||||
<text class="stat-label">不在</text>
|
||||
@@ -134,6 +171,42 @@
|
||||
@close="showBuildingPicker = false"
|
||||
/>
|
||||
|
||||
<!-- 汇总明细弹框 -->
|
||||
<u-popup
|
||||
:show="detailPopupVisible"
|
||||
mode="bottom"
|
||||
:round="16"
|
||||
:closeable="true"
|
||||
:safe-area-inset-bottom="true"
|
||||
@close="detailPopupVisible = false"
|
||||
>
|
||||
<view class="detail-popup">
|
||||
<view class="detail-popup-title">{{ detailPopupTitle }}</view>
|
||||
<scroll-view scroll-y class="detail-popup-scroll">
|
||||
<view v-if="detailPopupList.length === 0" class="detail-empty">
|
||||
<u-empty text="暂无明细" mode="data"></u-empty>
|
||||
</view>
|
||||
<view v-for="(row, index) in detailPopupList" :key="row.studentId || index" class="detail-row">
|
||||
<view class="detail-row-main">
|
||||
<text class="detail-name">{{ row.studentName || '-' }}</text>
|
||||
<text class="detail-no">{{ row.studentNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="detail-row-sub">
|
||||
<text>{{ row.buildingName || '-' }} · {{ row.roomName || '-' }}</text>
|
||||
<text v-if="row.bedCode"> · {{ row.bedCode }}床</text>
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="row.className">班级:{{ row.className }}</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'leave' && row.leaveTypeName">
|
||||
请假类型:{{ row.leaveTypeName }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'holidayStay' && row.holidayType">
|
||||
假期类型:{{ row.holidayType }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<!-- 悬浮点名按钮 -->
|
||||
<view class="fab-button" @click="handleAdd">
|
||||
<u-icon name="plus" size="24" color="#ffffff" />
|
||||
@@ -142,7 +215,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDormRollCall } from '@/api/dormRollCall.js';
|
||||
import { listDormRollCall, getTodayRollCallSummary } from '@/api/dormRollCall.js';
|
||||
import { request } from '@/common/request.js';
|
||||
|
||||
export default {
|
||||
@@ -169,6 +242,19 @@ export default {
|
||||
height: '32px',
|
||||
boxSizing: 'border-box',
|
||||
},
|
||||
todaySummary: {
|
||||
checkedRoomCount: 0,
|
||||
uncheckedRoomCount: 0,
|
||||
leaveCount: 0,
|
||||
holidayStayCount: 0,
|
||||
absentCount: 0,
|
||||
leaveDetails: [],
|
||||
holidayStayDetails: [],
|
||||
absentDetails: [],
|
||||
},
|
||||
detailPopupVisible: false,
|
||||
detailPopupType: '',
|
||||
detailPopupList: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -178,12 +264,59 @@ export default {
|
||||
totalPages() {
|
||||
return Math.ceil(this.total / this.queryParams.pageSize);
|
||||
},
|
||||
todayLabel() {
|
||||
const now = new Date();
|
||||
const m = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(now.getDate()).padStart(2, '0');
|
||||
return `${now.getFullYear()}-${m}-${d}`;
|
||||
},
|
||||
detailPopupTitle() {
|
||||
const map = {
|
||||
leave: '今日请假明细',
|
||||
holidayStay: '今日假期留宿明细',
|
||||
absent: '今日异常(不在)明细',
|
||||
};
|
||||
return map[this.detailPopupType] || '明细';
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.loadBuildingOptions();
|
||||
this.getList();
|
||||
this.loadTodaySummary();
|
||||
},
|
||||
methods: {
|
||||
async loadTodaySummary() {
|
||||
try {
|
||||
const res = await getTodayRollCallSummary();
|
||||
if (res && res.code === 200 && res.data) {
|
||||
this.todaySummary = {
|
||||
checkedRoomCount: res.data.checkedRoomCount || 0,
|
||||
uncheckedRoomCount: res.data.uncheckedRoomCount || 0,
|
||||
leaveCount: res.data.leaveCount || 0,
|
||||
holidayStayCount: res.data.holidayStayCount || 0,
|
||||
absentCount: res.data.absentCount || 0,
|
||||
leaveDetails: res.data.leaveDetails || [],
|
||||
holidayStayDetails: res.data.holidayStayDetails || [],
|
||||
absentDetails: res.data.absentDetails || [],
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载今日点名汇总失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
openDetailPopup(type) {
|
||||
this.detailPopupType = type;
|
||||
if (type === 'leave') {
|
||||
this.detailPopupList = this.todaySummary.leaveDetails || [];
|
||||
} else if (type === 'holidayStay') {
|
||||
this.detailPopupList = this.todaySummary.holidayStayDetails || [];
|
||||
} else {
|
||||
this.detailPopupList = this.todaySummary.absentDetails || [];
|
||||
}
|
||||
this.detailPopupVisible = true;
|
||||
},
|
||||
|
||||
async getList() {
|
||||
this.pageLoading = true;
|
||||
try {
|
||||
@@ -316,6 +449,134 @@ export default {
|
||||
padding-bottom: 160rpx;
|
||||
}
|
||||
|
||||
.today-summary-card {
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx 20rpx 16rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 81, 217, 0.08);
|
||||
|
||||
.summary-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.summary-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.summary-date {
|
||||
font-size: 24rpx;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
width: calc(33.33% - 8rpx);
|
||||
background: #f7f9fc;
|
||||
border-radius: 12rpx;
|
||||
padding: 16rpx 8rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.clickable:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.summary-num {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #0051d9;
|
||||
line-height: 1.2;
|
||||
|
||||
&--leave {
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
&--holiday {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
&--absent {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.summary-tip {
|
||||
margin-top: 4rpx;
|
||||
font-size: 20rpx;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-popup {
|
||||
padding: 28rpx 24rpx 12rpx;
|
||||
max-height: 70vh;
|
||||
|
||||
.detail-popup-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 16rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.detail-popup-scroll {
|
||||
max-height: 58vh;
|
||||
}
|
||||
|
||||
.detail-empty {
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
.detail-row {
|
||||
padding: 20rpx 8rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.detail-row-main {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 8rpx;
|
||||
|
||||
.detail-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.detail-no {
|
||||
font-size: 24rpx;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-row-sub {
|
||||
font-size: 24rpx;
|
||||
color: #606266;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fab-button {
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
@@ -448,6 +709,15 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
&.stat-holiday-stay {
|
||||
background: #ecf5ff;
|
||||
|
||||
.stat-num,
|
||||
.stat-label {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
&.stat-absent {
|
||||
background: #ffebee;
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
<view class="room-stats-mini" v-if="isRoomCompleted(room)">
|
||||
<text class="stat-present">{{ room.presentCount || 0 }}在</text>
|
||||
<text class="stat-leave">{{ room.leaveCount || 0 }}假</text>
|
||||
<text class="stat-holiday-stay">{{ room.holidayStayCount || 0 }}留</text>
|
||||
<text class="stat-absent">{{ room.absentCount || 0 }}不在</text>
|
||||
</view>
|
||||
<view class="room-status">
|
||||
@@ -316,6 +317,7 @@ export default {
|
||||
this.$set(this.rooms[idx], 'isCompleted', true);
|
||||
this.$set(this.rooms[idx], 'presentCount', countOf(counts.presentCount));
|
||||
this.$set(this.rooms[idx], 'leaveCount', countOf(counts.leaveCount));
|
||||
this.$set(this.rooms[idx], 'holidayStayCount', countOf(counts.holidayStayCount));
|
||||
this.$set(this.rooms[idx], 'absentCount', countOf(counts.absentCount));
|
||||
this.$set(this.rooms[idx], 'emptyCount', countOf(counts.emptyCount));
|
||||
}
|
||||
@@ -468,6 +470,9 @@ export default {
|
||||
.stat-leave {
|
||||
color: #e6a23c;
|
||||
}
|
||||
.stat-holiday-stay {
|
||||
color: #409eff;
|
||||
}
|
||||
.stat-absent {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
<view class="stat-number">{{ summary.leave }}</view>
|
||||
<view class="stat-label">请假</view>
|
||||
</view>
|
||||
<view class="stat-item stat-holiday-stay">
|
||||
<view class="stat-number">{{ summary.holidayStay }}</view>
|
||||
<view class="stat-label">假期留宿</view>
|
||||
</view>
|
||||
<view class="stat-item stat-absent">
|
||||
<view class="stat-number">{{ summary.absent }}</view>
|
||||
<view class="stat-label">不在</view>
|
||||
@@ -71,6 +75,10 @@
|
||||
<u-tag text="请假" type="warning" size="mini"></u-tag>
|
||||
<text class="leave-type">{{ student.leaveTypeName }}</text>
|
||||
</view>
|
||||
<view v-else-if="student.holidayStayId || student.rollCallStatus === '4'" class="leave-info">
|
||||
<u-tag text="假期留宿" type="primary" size="mini"></u-tag>
|
||||
<text v-if="student.holidayType" class="leave-type">{{ student.holidayType }}</text>
|
||||
</view>
|
||||
<view v-if="!student.studentId" class="empty-bed-tag">
|
||||
<text class="empty-text">空床位</text>
|
||||
</view>
|
||||
@@ -100,15 +108,16 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
summary() {
|
||||
let present = 0, leave = 0, absent = 0, empty = 0;
|
||||
let present = 0, leave = 0, holidayStay = 0, absent = 0, empty = 0;
|
||||
this.studentList.forEach((s) => {
|
||||
const status = s.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++;
|
||||
});
|
||||
return { present, leave, absent, empty };
|
||||
return { present, leave, holidayStay, absent, empty };
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -139,6 +148,7 @@ export default {
|
||||
getStatusLabel(status) {
|
||||
if (status === '0') return '在寝';
|
||||
if (status === '1') return '请假';
|
||||
if (status === '4') return '假期留宿';
|
||||
if (status === '2') return '不在';
|
||||
if (status === '3') return '空床位';
|
||||
return '未知';
|
||||
@@ -147,6 +157,7 @@ export default {
|
||||
getStatusClass(status) {
|
||||
if (status === '0') return 'status-present';
|
||||
if (status === '1') return 'status-leave';
|
||||
if (status === '4') return 'status-holiday-stay';
|
||||
if (status === '2') return 'status-absent';
|
||||
if (status === '3') return 'status-empty';
|
||||
return '';
|
||||
@@ -155,6 +166,7 @@ export default {
|
||||
getStatusTagType(status) {
|
||||
if (status === '0') return 'success';
|
||||
if (status === '1') return 'warning';
|
||||
if (status === '4') return 'primary';
|
||||
if (status === '2') return 'error';
|
||||
if (status === '3') return 'info';
|
||||
return 'info';
|
||||
@@ -197,8 +209,8 @@ export default {
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 20rpx;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 12rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
@@ -233,6 +245,13 @@ export default {
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
.stat-holiday-stay {
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
.stat-holiday-stay .stat-number {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.stat-absent {
|
||||
background-color: #ffebee;
|
||||
}
|
||||
@@ -266,6 +285,9 @@ export default {
|
||||
.student-card.status-leave {
|
||||
border-left: 6rpx solid #e6a23c;
|
||||
}
|
||||
.student-card.status-holiday-stay {
|
||||
border-left: 6rpx solid #409eff;
|
||||
}
|
||||
.student-card.status-absent {
|
||||
border-left: 6rpx solid #f56c6c;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user